/* ═══════════════════════════════════════════════════════
   WMS — Warehouse Management System
   Design: Industrial Dark — Outfit + DM Mono
   Mobile-First
═══════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────── */
:root {
  --bg:          #0d0f14;
  --surface:     #131720;
  --surface-2:   #1a2030;
  --surface-3:   #222940;
  --border:      #2a3348;
  --text:        #e8ecf4;
  --text-muted:  #7a8ba8;
  --text-dim:    #4a5a72;

  --accent:      #4f9cf9;
  --accent-glow: rgba(79,156,249,0.15);
  --amber:       #f5a623;
  --green:       #22c55e;
  --red:         #ef4444;
  --purple:      #a855f7;

  --sidebar-w:   240px;
  --topnav-h:    58px;
  --radius:      12px;
  --radius-sm:   8px;

  --font-body:   'Outfit', sans-serif;
  --font-mono:   'DM Mono', monospace;
}

/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7ab8fb; }

.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table-wrap .table { margin-bottom: 0; }
.product-card-sm { min-height: auto; }

.product-thumb-wrap { position: relative; width: 48px; height: 48px; }
.product-thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.product-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-dim); font-size: 1.2rem;
}
.product-list-table tr:hover .product-thumb {
  transform: scale(2.2); z-index: 20; position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.text-sm { font-size: 0.85rem; }
.text-amber { color: var(--amber) !important; }
.text-green { color: var(--green) !important; }
.text-blue  { color: var(--accent) !important; }
.text-red   { color: var(--red) !important; }
.text-purple { color: var(--purple) !important; }

/* ── App Layout ─────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar (Desktop) ──────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  flex-direction: column;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name  { display: block; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { display: block; font-size: 0.7rem; color: var(--text-muted); }

/* ── Sidebar Nav ────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 18px 4px;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 18px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-link-danger { color: #ef9090; }
.nav-link-danger:hover { color: var(--red); background: rgba(239,68,68,0.08); }

/* ── Mobile Offcanvas Sidebar ───────────────────────── */
.sidebar-offcanvas {
  background: var(--surface);
  border-right: 1px solid var(--border);
  width: 270px;
}

.sidebar-offcanvas .offcanvas-header {
  padding: 18px 16px;
}

.sidebar-offcanvas .nav-link {
  padding: 14px 20px;
  font-size: 1rem;
}

/* ── Main Area ──────────────────────────────────────── */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Top Navbar ─────────────────────────────────────── */
.topnav {
  height: var(--topnav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topnav-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Page Content ───────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 20px 16px;
  max-width: 100%;
}

@media (min-width: 768px) {
  .page-content { padding: 24px; }
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0;
}

.btn-icon:hover { background: var(--surface-2); color: var(--text); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #3a87ea;
  border-color: #3a87ea;
  color: #fff;
}

.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #16a34a; border-color: #16a34a; color: #fff; }

.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
  background: transparent;
}
.btn-outline-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

/* ── Cards ──────────────────────────────────────────── */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.content-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.content-card-header h5,
.content-card-header h6 { margin: 0; font-weight: 600; }

/* ── Form Inputs ────────────────────────────────────── */
.form-control,
.form-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  padding: 12px 14px;
  font-size: 0.95rem;
  min-height: 48px;
}

.form-control:focus,
.form-select:focus {
  background: var(--surface-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  color: var(--text);
}

.form-control::placeholder { color: var(--text-dim); }

.form-select option { background: var(--surface); }

.input-group-text {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.form-label { font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-text { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

/* Large form controls for mobile touch targets */
.form-control-lg,
.form-select-lg {
  min-height: 54px;
  font-size: 1rem;
  padding: 14px 16px;
}

.invalid-feedback { font-size: 0.8rem; }

/* ── Messages ───────────────────────────────────────── */
.messages-container {
  margin-bottom: 16px;
}

.alert {
  border-radius: var(--radius-sm);
  border: 1px solid;
  padding: 12px 16px;
  font-size: 0.9rem;
}

.alert-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.3);  color: #fca5a5; }
.alert-warning { background: rgba(245,166,35,.12); border-color: rgba(245,166,35,.3); color: #fcd34d; }
.alert-info    { background: rgba(79,156,249,.12); border-color: rgba(79,156,249,.3); color: #93c5fd; }

/* ── Stat Cards ─────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-blue  .stat-icon { color: var(--accent); }
.stat-blue  .stat-value { color: var(--accent); }
.stat-amber .stat-icon { color: var(--amber); }
.stat-amber .stat-value { color: var(--amber); }
.stat-green .stat-icon { color: var(--green); }
.stat-green .stat-value { color: var(--green); }
.stat-purple .stat-icon { color: var(--purple); }
.stat-purple .stat-value { color: var(--purple); }

/* ── Quick Action Cards ─────────────────────────────── */
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
  min-height: 90px;
}

.quick-action-card i { font-size: 1.6rem; color: var(--accent); }
.quick-action-card:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--text);
}

/* ── Section Labels ─────────────────────────────────── */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Product Grid (Responsive Layout) ────────────── */
#productGrid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 576px) {
  #productGrid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  #productGrid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 992px) {
  #productGrid { grid-template-columns: repeat(4, 1fr); }
}
#productGrid > div { width: 100% !important; max-width: 100% !important; flex: none !important; }

/* ── Product Cards ──────────────────────────────────── */
.product-card-link { display: block; color: inherit; }
.product-card-link:hover { color: inherit; }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  height: 100%;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.product-card-img {
  aspect-ratio: 4/5;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}

.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 2rem;
}

.product-card-asin {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  background: rgba(13,15,20,.8);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.product-card-body {
  padding: 10px 12px;
}

.product-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.product-card-cat {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Badges ─────────────────────────────────────────── */
.badge-cat {
  display: inline-block;
  background: rgba(245,166,35,.15);
  color: var(--amber);
  border: 1px solid rgba(245,166,35,.3);
  border-radius: 20px;
  font-size: 0.7rem;
  padding: 2px 8px;
  font-weight: 500;
}

.badge-subcat {
  display: inline-block;
  background: rgba(79,156,249,.12);
  color: var(--accent);
  border: 1px solid rgba(79,156,249,.25);
  border-radius: 20px;
  font-size: 0.7rem;
  padding: 2px 8px;
  font-weight: 500;
}

.badge-subcategory {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
  padding: 4px 10px;
  color: var(--text-muted);
}

/* ── Empty State ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
  color: var(--text-dim);
}

.empty-state h5 { font-weight: 600; margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-search { width: 100%; }

.filter-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (min-width: 768px) {
  .filter-bar { flex-direction: row; align-items: flex-end; }
  .filter-search { flex: 0 0 280px; }
  .filter-controls { flex: 1; grid-template-columns: 1fr 1fr 1fr auto; }
}

/* ── Product Detail ─────────────────────────────────── */
.asin-mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface-2);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.detail-price {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--green);
}

.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 576px) {
  .specs-grid { grid-template-columns: repeat(3, 1fr); }
}

.spec-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.spec-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.spec-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── Location Page ──────────────────────────────────── */
.location-product-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.location-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background 0.15s;
}

.location-product-item:last-child { border-bottom: none; }
.location-product-item:hover { background: var(--surface-2); }
.location-product-item.active { background: var(--accent-glow); border-color: var(--accent); }

.location-product-thumb {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}

.location-product-thumb img { width: 100%; height: 100%; object-fit: cover; }

.no-image-sm {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.2rem;
}

.location-product-info { flex: 1; min-width: 0; }
.location-product-name { font-size: 0.88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.location-product-asin { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }

.location-detail-thumb {
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}

.location-detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.no-image-lg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 2.5rem;
}

.location-badge-large {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 4px;
  padding: 16px;
  background: rgba(245,166,35,.08);
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid rgba(245,166,35,.2);
}

/* ── Modal ──────────────────────────────────────────── */
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.modal-header, .modal-footer { border-color: var(--border); }

/* ── Pagination ─────────────────────────────────────── */
.page-link {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm) !important;
  padding: 8px 12px;
}

.page-link:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { background: var(--surface); color: var(--text-dim); }

/* ── Accordion ──────────────────────────────────────── */
.accordion-button::after { filter: invert(1); }
.accordion-button:not(.collapsed) { background: var(--surface-2) !important; color: var(--text) !important; box-shadow: none; }
.accordion-button:focus { box-shadow: none; }

/* ── Login Page ─────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-icon {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  margin: 0 auto 14px;
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  margin: 0;
}

.login-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.login-footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 24px;
  margin-bottom: 0;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ── Bootstrap overrides ────────────────────────────── */
.badge.bg-secondary { background: var(--surface-3) !important; color: var(--text-muted); border: 1px solid var(--border); }

/* ── Responsive Tables ──────────────────────────────── */
.table {
  color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border);
}

.table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

@media (max-width: 575px) {
  .content-card { padding: 14px; }
  .stat-value { font-size: 1.6rem; }
  .detail-price { font-size: 1.4rem; }
}

/* ── Suggestions Dropdown ──────────────────────────── */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface) !important;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  max-height: 400px;
  overflow-y: auto;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s ease;
  color: var(--text) !important;
  text-decoration: none;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--surface-2) !important;
  color: var(--accent) !important;
}

.suggestion-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.suggestion-details {
  flex: 1;
  min-width: 0;
}

.suggestion-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}