/* ==========================================================================
   Parcalucra Admin Dashboard - UI Kit & Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens (CSS Variables)
   -------------------------------------------------------------------------- */
:root {
  /* Color Palette - Light Mode (Matches main site) */
  --color-primary: #1d4ed8;
  --color-primary-hover: #1e40af;
  --color-primary-light: #dbeafe;
  --color-secondary: #0f172a;
  --color-secondary-hover: #1e293b;
  --color-accent: #ef4444;
  
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-danger: #ef4444;
  --color-danger-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;
  
  --color-bg-base: #f8fafc;
  --color-bg-surface: #ffffff;
  --color-bg-card: #ffffff;
  --color-bg-hover: #f1f5f9;
  
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  
  --color-text-primary: #0f172a;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Font */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;

  /* Dimensions */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #1e3a5f;
  --color-secondary: #1e293b;
  --color-secondary-hover: #334155;
  
  --color-success-light: rgba(16,185,129,0.15);
  --color-warning-light: rgba(245,158,11,0.15);
  --color-danger-light: rgba(239,68,68,0.15);
  --color-info-light: rgba(59,130,246,0.15);
  
  --color-bg-base: #0f172a;
  --color-bg-surface: #1e293b;
  --color-bg-card: #1e293b;
  --color-bg-hover: #334155;
  
  --color-border: #334155;
  --color-border-hover: #475569;
  
  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-inverse: #ffffff;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
}

/* --------------------------------------------------------------------------
   2. Base & Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a { text-decoration: none; color: inherit; transition: color var(--transition-fast); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; border: none; outline: none; background: none; }
button { cursor: pointer; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

::selection {
  background-color: var(--color-primary);
  color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
.text-display { font-size: 2.5rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.025em; }
h1, .text-h1 { font-size: 1.875rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2, .text-h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
h3, .text-h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
h4, .text-h4 { font-size: 1rem; font-weight: 600; line-height: 1.5; }
.text-body { font-size: 0.875rem; color: var(--color-text-secondary); }
.text-small { font-size: 0.8125rem; color: var(--color-text-secondary); }
.text-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); }
.text-caption { font-size: 0.75rem; color: var(--color-text-muted); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-color-primary { color: var(--color-text-primary) !important; }
.text-color-secondary { color: var(--color-text-secondary) !important; }
.text-color-muted { color: var(--color-text-muted) !important; }
.text-color-success { color: var(--color-success) !important; }
.text-color-warning { color: var(--color-warning) !important; }
.text-color-danger { color: var(--color-danger) !important; }
.text-color-info { color: var(--color-info) !important; }
.text-color-brand { color: var(--color-primary) !important; }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal), transform var(--transition-normal);
  z-index: 40;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .badge { display: none; }

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: 1.125rem;
  overflow: hidden;
  white-space: nowrap;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-search {
  padding: var(--space-3) var(--space-4);
}

.sidebar-search .search-input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  background-color: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}

.sidebar-search .search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.sidebar-search .search-wrapper {
  position: relative;
}

.sidebar-search .search-wrapper svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group {
  margin-bottom: var(--space-3);
}

.nav-label {
  padding: var(--space-3) var(--space-3) var(--space-1) var(--space-3);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.nav-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item i, .nav-item svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-footer .nav-item { color: var(--color-danger); }
.sidebar-footer .nav-item:hover { background-color: var(--color-danger-light); }

/* Mobile sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 39;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---- Top Navbar ---- */
.top-navbar {
  height: var(--header-height);
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: 30;
  flex-shrink: 0;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}
.hamburger-btn:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.page-title-area h1 { font-size: 1.25rem; font-weight: 700; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .separator { margin: 0 2px; }

/* Global search in navbar */
.navbar-search {
  position: relative;
  width: 280px;
}
.navbar-search > svg, .navbar-search > i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.navbar-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background-color: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}
.navbar-search input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  background-color: var(--color-bg-surface);
}
.navbar-search input::placeholder { color: var(--color-text-muted); }
.navbar-search .search-shortcut {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--color-bg-hover);
  border: 1px solid var(--color-border);
  font-size: 0.625rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Navbar icon button */
.navbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}
.navbar-icon-btn:hover {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.navbar-icon-btn svg { width: 20px; height: 20px; }
.navbar-icon-btn .notification-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background-color: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--color-bg-surface);
}

/* User profile in navbar */
.navbar-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.navbar-profile:hover { background-color: var(--color-bg-hover); }
.navbar-profile .user-info { text-align: right; }
.navbar-profile .user-name { font-size: 0.8125rem; font-weight: 600; line-height: 1.2; }
.navbar-profile .user-role { font-size: 0.6875rem; color: var(--color-text-muted); line-height: 1.2; }

/* ---- Page Content ---- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.content-wrapper {
  max-width: 1440px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn svg, .btn i { width: 16px; height: 16px; flex-shrink: 0; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; }
.btn-sm svg, .btn-sm i { width: 14px; height: 14px; }
.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-full); }
.btn-icon.btn-sm { width: 32px; height: 32px; }

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: var(--color-text-primary);
  border-color: #e2e8f0;
}
.btn-secondary:hover:not(:disabled) {
  background-color: #cbd5e1;
  border-color: #cbd5e1;
}

[data-theme="dark"] .btn-secondary {
  background-color: #334155;
  color: #f1f5f9;
  border-color: #334155;
}
[data-theme="dark"] .btn-secondary:hover:not(:disabled) {
  background-color: #475569;
  border-color: #475569;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-text-primary);
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--color-bg-hover);
  border-color: var(--color-border-hover);
}

.btn-outline-primary {
  background-color: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-outline-primary:hover:not(:disabled) {
  background-color: var(--color-primary);
  color: white;
}

.btn-outline-danger {
  background-color: transparent;
  border-color: var(--color-danger);
  color: var(--color-danger);
}
.btn-outline-danger:hover:not(:disabled) {
  background-color: var(--color-danger);
  color: white;
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
}

.btn-success {
  background-color: var(--color-success);
  color: white;
  border-color: var(--color-success);
}
.btn-success:hover:not(:disabled) {
  background-color: #059669;
  border-color: #059669;
}

/* --------------------------------------------------------------------------
   6. Alerts & Notifications
   -------------------------------------------------------------------------- */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--color-success);
}
.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--color-danger);
}
.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--color-warning);
}
.alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
  color: var(--color-info);
}

/* --------------------------------------------------------------------------
   7. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}
.badge svg, .badge i { width: 12px; height: 12px; }

.badge-success { background-color: var(--color-success-light); color: var(--color-success); }
.badge-warning { background-color: var(--color-warning-light); color: var(--color-warning); }
.badge-danger  { background-color: var(--color-danger-light); color: var(--color-danger); }
.badge-info    { background-color: var(--color-info-light); color: var(--color-info); }
.badge-neutral { background-color: var(--color-bg-hover); color: var(--color-text-secondary); }
.badge-primary { background-color: var(--color-primary-light); color: var(--color-primary); }

/* --------------------------------------------------------------------------
   7. Forms & Inputs
   -------------------------------------------------------------------------- */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.form-control {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  background-color: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
  background-color: var(--color-bg-surface);
}
.form-control::placeholder { color: var(--color-text-muted); }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

textarea.form-control {
  border-radius: var(--radius-lg);
  resize: vertical;
  min-height: 80px;
}

.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon-wrapper svg,
.input-icon-wrapper i {
  position: absolute;
  left: 1rem;
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.input-icon-wrapper .form-control {
  padding-left: 2.75rem;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle .slider {
  position: absolute;
  inset: 0;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
}
.toggle .slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}
.toggle input:checked + .slider {
  background-color: var(--color-primary);
}
.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* --------------------------------------------------------------------------
   8. Cards
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  transition: box-shadow var(--transition-normal);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-body { padding: var(--space-5); flex: 1; }
.card-body.compact { padding: var(--space-4); }

.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg-base);
}

/* Stat Card */
.stat-card .card-body {
  padding: var(--space-5);
}
.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.success { background-color: var(--color-success-light); color: var(--color-success); }
.stat-icon.info    { background-color: var(--color-info-light); color: var(--color-info); }
.stat-icon.warning { background-color: var(--color-warning-light); color: var(--color-warning); }
.stat-icon.primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.danger  { background-color: var(--color-danger-light); color: var(--color-danger); }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: var(--space-2);
  letter-spacing: -0.02em;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
  font-size: 0.75rem;
  font-weight: 500;
}
.stat-change.up { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }
.stat-change svg { width: 14px; height: 14px; }

/* Mini chart bars */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
  margin-top: var(--space-3);
}
.mini-bars .bar {
  flex: 1;
  border-radius: 2px;
  background-color: var(--color-primary-light);
  transition: height var(--transition-normal);
}
.mini-bars .bar.active {
  background-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   9. Tables
   -------------------------------------------------------------------------- */
.table-container { width: 100%; overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th {
  padding: var(--space-3) var(--space-4);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-bg-base);
  white-space: nowrap;
}
.table td {
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr { transition: background-color var(--transition-fast); }
.table tbody tr:hover { background-color: var(--color-bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.sort-header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

.sort-header-link:hover {
  color: var(--color-primary);
  background-color: var(--color-bg-hover);
}

.sort-header-link .sort-text {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.2;
}

.sort-header-link .sort-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background-color: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  line-height: 1;
}

.sort-header-link .sort-badge svg,
.sort-header-link .sort-badge i {
  width: 11px;
  height: 11px;
  stroke-width: 2.25;
  display: block;
}

/* Hover State */
.sort-header-link:hover .sort-badge {
  background-color: rgba(37, 99, 235, 0.12);
  color: var(--color-primary);
  transform: scale(1.08);
}

/* Active State */
.sort-header-link.active {
  color: var(--color-primary);
  font-weight: 700;
}

.sort-header-link.active .sort-badge {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
  transform: scale(1.05);
}

.sort-header-link.active .sort-badge svg,
.sort-header-link.active .sort-badge i {
  stroke-width: 2.75;
}

/* Dark mode adjustments for sort-badge */
[data-theme="dark"] .sort-header-link .sort-badge {
  background-color: rgba(255, 255, 255, 0.08);
  color: #64748b;
}
[data-theme="dark"] .sort-header-link:hover .sort-badge {
  background-color: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}
[data-theme="dark"] .sort-header-link.active .sort-badge {
  background-color: var(--color-primary);
  color: #ffffff;
}

/* Column Customizer Styles */
.dropdown-menu.col-customizer-menu {
  width: 290px;
  max-width: calc(100vw - 32px);
  padding: 1.125rem 1.125rem !important;
  z-index: 1050;
  box-shadow: 0 14px 35px -8px rgba(0, 0, 0, 0.18), 0 8px 16px -6px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
  left: 0 !important;
  right: auto !important;
}

.col-customizer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--color-border);
}

.col-customizer-footer {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.dropdown-menu-left {
  left: 0 !important;
  right: auto !important;
}

.dropdown-menu-right {
  right: 0 !important;
  left: auto !important;
}

.col-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.col-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
  margin: 0;
}

.col-toggle-item:hover {
  background-color: var(--color-bg-hover);
}

.col-toggle-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  white-space: nowrap;
}

.col-toggle-label i,
.col-toggle-label svg {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.col-toggle-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  margin: 0;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   10. Avatars
   -------------------------------------------------------------------------- */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.125rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.5rem; }

.avatar-group {
  display: flex;
}
.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--color-bg-surface);
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* Online indicator */
.avatar-wrapper {
  position: relative;
  display: inline-flex;
}
.online-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  background-color: var(--color-success);
  border-radius: 50%;
  border: 2px solid var(--color-bg-surface);
}

/* --------------------------------------------------------------------------
   11. Dropdown
   -------------------------------------------------------------------------- */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-1) 0;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transition: all var(--transition-fast);
}
.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem var(--space-4);
  font-size: 0.8125rem;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.dropdown-item svg { width: 16px; height: 16px; color: var(--color-text-muted); }
.dropdown-item:hover { background-color: var(--color-bg-hover); }
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger svg { color: var(--color-danger); }

.dropdown-divider {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-1) 0;
}

.dropdown-header {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   12. Progress
   -------------------------------------------------------------------------- */
.progress-bar {
  height: 6px;
  background-color: var(--color-bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-value {
  height: 100%;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  transition: width var(--transition-slow);
}
.progress-value.success { background-color: var(--color-success); }
.progress-value.warning { background-color: var(--color-warning); }
.progress-value.danger  { background-color: var(--color-danger); }

/* --------------------------------------------------------------------------
   13. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: var(--space-4);
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-body {
  padding: var(--space-5) var(--space-6);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
  background-color: var(--color-bg-surface);
}

/* --------------------------------------------------------------------------
   14. Drawer
   -------------------------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.drawer-overlay.active { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background-color: var(--color-bg-surface);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  z-index: 101;
}
.drawer-overlay.active + .drawer,
.drawer.active { transform: translateX(0); }

.drawer-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.drawer-body { padding: var(--space-6); flex: 1; overflow-y: auto; }

/* --------------------------------------------------------------------------
   15. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  pointer-events: auto;
  animation: slideInRight var(--transition-normal) ease-out;
  transition: all var(--transition-normal);
}
.toast.removing {
  opacity: 0;
  transform: translateX(100%);
}
.toast .toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast .toast-message { flex: 1; font-size: 0.875rem; }
.toast .toast-close {
  width: 20px; height: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}
.toast .toast-close:hover { color: var(--color-text-primary); }

.toast.success { border-left: 3px solid var(--color-success); }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.error .toast-icon { color: var(--color-danger); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info { border-left: 3px solid var(--color-info); }
.toast.info .toast-icon { color: var(--color-info); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* --------------------------------------------------------------------------
   16. Tabs
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  gap: 0;
}
.tab {
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}
.tab:hover { color: var(--color-text-primary); }
.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-content { display: none; padding-top: var(--space-4); }
.tab-content.active { display: block; }

/* Pill tabs */
.tabs-pill {
  display: flex;
  gap: var(--space-1);
  background-color: var(--color-bg-hover);
  padding: 3px;
  border-radius: var(--radius-full);
  border-bottom: none;
}
.tabs-pill .tab {
  border-bottom: none;
  border-radius: var(--radius-full);
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
  margin-bottom: 0;
}
.tabs-pill .tab.active {
  background-color: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   17. Accordion
   -------------------------------------------------------------------------- */
.accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.accordion + .accordion { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; }
.accordion:first-child + .accordion ~ .accordion { border-radius: 0; }
.accordion:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }

.accordion-header {
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 500;
  background-color: var(--color-bg-surface);
  transition: background-color var(--transition-fast);
}
.accordion-header:hover { background-color: var(--color-bg-hover); }
.accordion-header svg {
  width: 18px; height: 18px;
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
}
.accordion.active .accordion-header svg { transform: rotate(180deg); }

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}
.accordion.active .accordion-body { max-height: 500px; }
.accordion-content {
  padding: 0 var(--space-5) var(--space-5);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   18. Tooltip
   -------------------------------------------------------------------------- */
.tooltip-wrapper { position: relative; display: inline-flex; }
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background-color: var(--color-secondary);
  color: white;
  font-size: 0.75rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
  z-index: 60;
  transition: all var(--transition-fast);
  pointer-events: none;
}
.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-secondary);
}
.tooltip-wrapper:hover .tooltip-text { visibility: visible; opacity: 1; }

/* --------------------------------------------------------------------------
   19. Timeline
   -------------------------------------------------------------------------- */
.timeline { position: relative; padding-left: var(--space-8); }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--color-border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-5);
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: calc(-1 * var(--space-8) + 4px);
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--color-bg-surface);
  background-color: var(--color-primary);
}
.timeline-dot.success { background-color: var(--color-success); }
.timeline-dot.warning { background-color: var(--color-warning); }
.timeline-dot.danger  { background-color: var(--color-danger); }
.timeline-dot.info    { background-color: var(--color-info); }

.timeline-content .timeline-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
}
.timeline-content .timeline-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   20. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}
.page-item, a.page-item {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  padding: 0 var(--space-2);
}
.page-item:hover, a.page-item:hover { background-color: var(--color-bg-hover); color: var(--color-text-primary); }
.page-item.active {
  background-color: var(--color-primary);
  color: white;
  pointer-events: none;
}
.page-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.page-item svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   21. Quick Actions
   -------------------------------------------------------------------------- */
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.quick-action-card:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action-card .action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-action-card .action-icon svg { width: 22px; height: 22px; }
.quick-action-card span { font-size: 0.8125rem; font-weight: 500; color: var(--color-text-secondary); }
.quick-action-card, a.quick-action-card { text-decoration: none; }

/* Stat card alert variant (low stock, etc.) */
.stat-card-alert {
  border-color: var(--color-danger);
  animation: pulse-border 2s ease-in-out infinite;
}
@keyframes pulse-border {
  0%, 100% { border-color: var(--color-danger); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50% { border-color: var(--color-danger); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1); }
}

/* Order status legend */
.order-status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  justify-content: center;
}

/* Text link utility */
.text-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8125rem;
  transition: color var(--transition-fast);
}
.text-link:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* Table responsive */
.table-responsive { width: 100%; overflow-x: auto; }

/* --------------------------------------------------------------------------
   22. CSS Charts
   -------------------------------------------------------------------------- */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 200px;
  padding: var(--space-4) 0;
}
.chart-bar {
  flex: 1;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(to top, var(--color-primary) 0%, #60a5fa 100%);
  transition: height var(--transition-slow), opacity var(--transition-fast);
  position: relative;
  cursor: pointer;
  min-height: 4px;
}
.chart-bar:hover { opacity: 0.8; }

.chart-bar-label {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* Donut chart */
.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-chart .donut-inner {
  position: absolute;
  width: 72px;
  height: 72px;
  background-color: var(--color-bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.donut-chart .donut-value { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.donut-chart .donut-label { font-size: 0.625rem; color: var(--color-text-muted); margin-top: 2px; }

/* --------------------------------------------------------------------------
   23. Loading & Empty States
   -------------------------------------------------------------------------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner { animation: spin 1s linear infinite; }

.skeleton {
  background: linear-gradient(90deg, var(--color-bg-hover) 25%, var(--color-bg-base) 50%, var(--color-bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
}
.empty-state .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--color-bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.empty-state .empty-icon svg { width: 32px; height: 32px; color: var(--color-text-muted); }
.empty-state h3 { margin-bottom: var(--space-2); }
.empty-state p { color: var(--color-text-secondary); max-width: 360px; margin-bottom: var(--space-5); font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   24. Utility Classes
   -------------------------------------------------------------------------- */
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.ml-auto { margin-left: auto; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cursor-pointer { cursor: pointer; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }

/* Background helpers */
.bg-primary { background-color: var(--color-primary); color: white; }
.bg-success { background-color: var(--color-success); color: white; }
.bg-warning { background-color: var(--color-warning); color: white; }
.bg-danger  { background-color: var(--color-danger); color: white; }
.bg-info    { background-color: var(--color-info); color: white; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* --------------------------------------------------------------------------
   25. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-span-2 { grid-column: span 1; }
  .navbar-search { width: 200px; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    transform: translateX(-100%);
    z-index: 40;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  
  .hamburger-btn { display: flex; }
  
  .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-6 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  
  .page-content { padding: var(--space-4); }
  
  .navbar-search { display: none; }
  .navbar-profile .user-info { display: none; }
  
  .welcome-actions { display: none; }
  
  .drawer { width: 100vw; }
}

@media (max-width: 480px) {
  .top-navbar { padding: 0 var(--space-3); }
  .page-content { padding: var(--space-3); }
}

/* --------------------------------------------------------------------------
   26. Global Search Dropdown & Omnisearch
   -------------------------------------------------------------------------- */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 520px;
  max-width: 90vw;
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow: hidden;
}

.search-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 1s linear infinite;
}

.search-dropdown-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--color-bg-hover);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-primary);
  text-decoration: none;
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.search-result-item:hover, .search-result-item.selected {
  background-color: var(--color-bg-hover);
}

.search-result-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background-color: var(--color-bg-base);
  border-radius: var(--radius-md);
  margin-right: var(--space-3);
  flex-shrink: 0;
}

.search-result-item i, .search-result-item svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.search-result-item:hover i, .search-result-item.selected i,
.search-result-item:hover svg, .search-result-item.selected svg {
  color: var(--color-primary);
}

.search-result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search-result-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
  margin-bottom: 2px;
}

.search-result-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --------------------------------------------------------------------------
   27. Responsive Grid & Form Utilities (Admin POS & Multi-Column Layouts)
   -------------------------------------------------------------------------- */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: calc(-1 * var(--space-3));
  margin-left: calc(-1 * var(--space-3));
}
.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: var(--space-3);
  padding-left: var(--space-3);
}
.col-12 { flex: 0 0 auto; width: 100%; }
.col-6 { flex: 0 0 auto; width: 50%; }
.col-4 { flex: 0 0 auto; width: 33.333333%; }
.col-3 { flex: 0 0 auto; width: 25%; }

@media (min-width: 576px) {
  .col-sm-6 { flex: 0 0 auto; width: 50%; }
  .col-sm-12 { flex: 0 0 auto; width: 100%; }
  .text-sm-end { text-align: right !important; }
}

@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 auto; width: 25%; }
  .col-md-4 { flex: 0 0 auto; width: 33.333333%; }
  .col-md-6 { flex: 0 0 auto; width: 50%; }
  .col-md-8 { flex: 0 0 auto; width: 66.666667%; }
  .col-md-12 { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 992px) {
  .col-lg-3 { flex: 0 0 auto; width: 25%; }
  .col-lg-4 { flex: 0 0 auto; width: 33.333333%; }
  .col-lg-5 { flex: 0 0 auto; width: 41.666667%; }
  .col-lg-6 { flex: 0 0 auto; width: 50%; }
  .col-lg-7 { flex: 0 0 auto; width: 58.333333%; }
  .col-lg-8 { flex: 0 0 auto; width: 66.666667%; }
  .col-lg-12 { flex: 0 0 auto; width: 100%; }
}

/* Input Group Helpers */
.input-group {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
}
.input-group > .form-control {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.input-group-text {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  white-space: nowrap;
  background-color: var(--color-bg-hover);
  border: 1px solid var(--color-border);
  border-left: none;
  border-top-right-radius: var(--radius-full);
  border-bottom-right-radius: var(--radius-full);
}
.input-group-sm > .form-control {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}
.input-group-sm > .input-group-text {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

/* Text, Border, Spacing Utilities */
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-muted   { color: var(--color-text-muted) !important; }
.text-end     { text-align: right !important; }
.text-start   { text-align: left !important; }

.border { border: 1px solid var(--color-border) !important; }
.border-top { border-top: 1px solid var(--color-border) !important; }
.border-bottom { border-bottom: 1px solid var(--color-border) !important; }
.rounded { border-radius: var(--radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: var(--radius-full) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.p-1 { padding: var(--space-1) !important; }
.p-2 { padding: var(--space-2) !important; }
.p-3 { padding: var(--space-3) !important; }
.p-4 { padding: var(--space-4) !important; }
.p-5 { padding: var(--space-5) !important; }
.py-1 { padding-top: var(--space-1) !important; padding-bottom: var(--space-1) !important; }
.py-2 { padding-top: var(--space-2) !important; padding-bottom: var(--space-2) !important; }
.py-3 { padding-top: var(--space-3) !important; padding-bottom: var(--space-3) !important; }
.py-4 { padding-top: var(--space-4) !important; padding-bottom: var(--space-4) !important; }
.px-3 { padding-left: var(--space-3) !important; padding-right: var(--space-3) !important; }
.px-4 { padding-left: var(--space-4) !important; padding-right: var(--space-4) !important; }

.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.sticky-top { position: sticky; top: 80px; z-index: 10; }


