/* === Design Tokens (Light Theme) === */
:root {
  --bg-deep: #F1F5F9;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --danger: #EF4444;
  --warning: #F59E0B;
  --border-color: #E2E8F0;
  --border-light: #F1F5F9;
  --radius-sm: 0.5rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', 'Inter', system-ui, sans-serif;
}

/* === Base === */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  padding-top: 76px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly: minimum 44px tap targets for interactive elements */
a.btn, button.btn, .nav-link, .list-group-item,
.form-check-label, .dropdown-item {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Smooth tap highlight on mobile */
a, button, .product-card, .card, .stat-card, .bento-card {
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

a { color: var(--text-secondary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }

/* === Navbar === */
.navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  padding: 0.6rem 0;
  min-height: 60px;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  display: flex; align-items: center; gap: 0.5rem;
}

.brand-icon {
  background: var(--accent);
  color: #FFFFFF;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.nav-link {
  color: var(--text-secondary) !important;
  font-size: 0.875rem; font-weight: 500;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-link:hover { color: var(--accent) !important; background: rgba(37, 99, 235, 0.06); }

.search-box {
  position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 12px; color: var(--text-muted); z-index: 2; font-size: 0.85rem;
}
.search-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem 0.75rem 0.45rem 2.2rem;
  border-radius: var(--radius);
  font-size: 0.85rem; width: 200px;
  transition: all var(--transition);
}
.search-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 260px; background: #FFFFFF;
}
.search-input::placeholder { color: var(--text-muted); }

.btn-accent {
  background: var(--accent); color: #FFFFFF;
  border: none; font-weight: 600; font-size: 0.85rem;
  padding: 0.45rem 1.25rem; border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-accent:hover { background: var(--accent-hover); color: #FFFFFF; transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }

.role-badge {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.15em 0.5em; border-radius: 100px; font-weight: 600;
}
.role-customer { background: rgba(71, 85, 105, 0.1); color: #475569; }
.role-sales { background: rgba(37, 99, 235, 0.1); color: #2563EB; }
.role-admin { background: rgba(245, 158, 11, 0.15); color: #B45309; }

.cart-badge { font-size: 0.65rem; }

.dropdown-menu {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.35rem; box-shadow: var(--shadow-lg);
}
.dropdown-item {
  color: var(--text-secondary); font-size: 0.875rem;
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
  transition: all var(--transition);
}
.dropdown-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.dropdown-divider { border-color: var(--border-color); }

.navbar-toggler { border-color: var(--border-color); }
.navbar-toggler-icon { filter: invert(0); }

/* === Main Content === */
.main-content { min-height: calc(100vh - 60px - 200px); }

/* === Footer === */
.site-footer {
  background: #FFFFFF;
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 1.5rem; margin-top: 4rem;
}
.footer-brand { font-family: var(--font-heading); font-size: 1.25rem; color: var(--text-primary); }
.footer-desc { color: var(--text-muted); font-size: 0.875rem; }
.site-footer h6 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 0.75rem; }
.site-footer ul li { margin-bottom: 0.35rem; }
.site-footer ul li a { color: var(--text-secondary); font-size: 0.875rem; }
.footer-bottom {
  margin-top: 2rem; padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted); font-size: 0.8rem; text-align: center;
}

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  overflow: hidden;
}
.card:hover {
  border-color: #CBD5E1;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-heading);
  font-weight: 600; font-size: 1.1rem;
  padding: 1rem 1.25rem; color: var(--text-primary);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.bento-grid.small { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
.bento-card:hover { border-color: #CBD5E1; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.bento-card.large { grid-column: span 2; }

/* === Product Grid === */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.product-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}
.product-card .product-img-wrap {
  aspect-ratio: 4/3;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.product-card .product-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .product-img-wrap img { transform: scale(1.05); }
.product-card .product-img-placeholder {
  font-size: 2.5rem; color: var(--text-muted);
}
.product-card .card-body { padding: 1.25rem; }
.product-card .product-category {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 0.35rem; font-weight: 600;
}
.product-card .product-title {
  font-family: var(--font-heading);
  font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.product-card .product-price {
  font-size: 1.2rem; font-weight: 700; color: var(--accent);
}
.product-card .product-stock {
  font-size: 0.8rem; color: var(--text-muted);
}

/* === Tables === */
.table {
  color: var(--text-primary);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-color);
  --bs-table-hover-bg: rgba(37, 99, 235, 0.04);
}
.table th {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  font-weight: 600; border-bottom-width: 1px;
}
.table td { font-size: 0.875rem; vertical-align: middle; }

/* === Forms === */
.form-control, .form-select {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
  background: #FFFFFF;
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 500; font-size: 0.875rem; margin-bottom: 0.35rem; color: var(--text-secondary); }

/* === Buttons === */
.btn {
  font-weight: 500; font-size: 0.875rem;
  padding: 0.55rem 1.25rem; border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #FFFFFF; font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline-light {
  border-color: var(--border-color); color: var(--text-secondary);
  background: #FFFFFF;
}
.btn-outline-light:hover { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--accent); }
.btn-outline-danger { border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }

/* === Stats Cards === */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 2.2rem; font-weight: 700; color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  margin-bottom: 0.35rem;
}

/* === Chart Container === */
.chart-container { width: 100%; height: 400px; }

/* === Section Header === */
.section-header { margin-bottom: 2rem; }
.section-title {
  font-family: var(--font-heading);
  font-size: 2rem; font-weight: 700; color: var(--text-primary);
}
.section-subtitle { color: var(--text-muted); font-size: 0.925rem; }

/* === Breadcrumb === */
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); }

/* === Badges & Status === */
.status-badge {
  font-size: 0.75rem; font-weight: 600; padding: 0.25em 0.65em;
  border-radius: 100px; text-transform: uppercase; letter-spacing: 0.03em;
}
.status-pending { background: rgba(245,158,11,0.12); color: #B45309; }
.status-paid { background: rgba(34,197,94,0.12); color: #15803D; }
.status-shipped { background: rgba(37,99,235,0.12); color: #1D4ED8; }

.alert-anomaly {
  border-left: 4px solid var(--danger);
  background: rgba(239,68,68,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* === Empty State === */
.empty-state {
  text-align: center; padding: 4rem 2rem; color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.6; }
.empty-state h4 { font-family: var(--font-body); color: var(--text-secondary); }

/* === List Group (category filter) === */
.list-group-item {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  transition: all var(--transition);
}
.list-group-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.list-group-item.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  font-weight: 600;
  border-color: transparent;
}

/* === Skeleton Loading === */
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Utility === */
.text-accent { color: var(--accent) !important; }
.text-muted { color: var(--text-muted) !important; }
.bg-accent { background: var(--accent) !important; color: #FFFFFF !important; }

/* === Responsive === */

/* -- Tablet (≤1024px) -- */
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
  }
  .chart-container { height: 340px; }
}

/* -- Small Tablet (≤768px) -- */
@media (max-width: 768px) {
  body { padding-top: 64px; }
  .stat-value { font-size: 1.75rem; }
  .section-title { font-size: 1.5rem; }
  .bento-card.large { grid-column: span 1; }
  .bento-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .search-input { width: 120px; font-size: 0.8rem; }
  .search-input:focus { width: 150px; }
  .product-card .product-img-wrap { aspect-ratio: 1/1; }
  .product-card .product-title { font-size: 0.95rem; }
  .product-card .product-price { font-size: 1.05rem; }

  /* Navbar compact */
  .navbar { padding: 0.4rem 0; min-height: 52px; }
  .navbar-brand { font-size: 1.2rem; }
  .navbar .btn-accent { padding: 0.3rem 0.8rem; font-size: 0.75rem; }
  .nav-link { font-size: 0.825rem; padding: 0.4rem 0.6rem !important; }

  /* Tables - horizontal scroll */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Cards stack */
  .row.g-4 > [class*="col-"] { margin-bottom: 0.5rem; }

  /* Footer */
  .site-footer { padding: 2rem 0 1rem; text-align: center; }
  .site-footer h6 { margin-top: 1rem; }

  /* Action button groups */
  .d-flex.gap-2 { flex-wrap: wrap; }
  .d-flex.gap-2 .btn { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

  /* Single column for forms */
  .col-md-5, .col-md-6, .col-lg-4, .col-lg-6 {
    width: 100%;
  }
}

/* -- Mobile (≤480px) -- */
@media (max-width: 480px) {
  html { font-size: 15px; }

  body { padding-top: 56px; }

  .navbar-brand { font-size: 1.1rem; }
  .brand-icon { width: 26px; height: 26px; font-size: 0.85rem; }
  .navbar { padding: 0.3rem 0; min-height: 46px; }

  .section-title { font-size: 1.35rem; }
  .section-subtitle { font-size: 0.85rem; }

  .stat-value { font-size: 1.5rem; }
  .stat-card { padding: 1rem; }

  .search-input { width: 100px; }
  .search-input:focus { width: 130px; }

  /* Compact product cards — 2 per row */
  .product-card .card-body { padding: 0.85rem; }
  .product-card .product-title { font-size: 0.85rem; }
  .product-card .product-price { font-size: 0.95rem; }
  .product-card .product-category { font-size: 0.68rem; }

  /* Buttons reduce */
  .btn { padding: 0.45rem 1rem; font-size: 0.825rem; }
  .btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }

  /* Charts smaller */
  .chart-container { height: 280px; }

  /* Breadcrumb hide on mobile */
  .breadcrumb { font-size: 0.8rem; }

  /* Form elements full width */
  .form-control, .form-select { font-size: 0.85rem; padding: 0.5rem 0.7rem; }

  /* Page padding reduced */
  .container.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
  .container.py-5 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }

  /* Bento grid single column */
  .bento-grid { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Table font size */
  .table th, .table td { font-size: 0.78rem; padding: 0.45rem 0.55rem; }
}
