/* ============================================
   Jardin Waiter - Material Design with Warm Palette
   ============================================ */

/* ============================================
   1. CSS Custom Properties (Variables)
   ============================================ */
:root {
  /* Background Colors - Warm Cream */
  --bg-primary: #FEF7ED;
  --bg-secondary: #F5EDE4;
  --bg-surface: #FFFBF5;
  --bg-elevated: #FFFFFF;

  /* Primary Brand Colors - Terracotta */
  --primary-50: #FFF5F0;
  --primary-100: #FFDACF;
  --primary-200: #FFBDA8;
  --primary-300: #F9A080;
  --primary-400: #E08860;
  --primary-500: #C65D35;
  --primary-600: #A84D2C;
  --primary-700: #8B3F24;
  --primary-800: #6E321D;
  --primary-900: #522516;

  /* Accent Colors - Gold */
  --accent-50: #FFF8E6;
  --accent-100: #FFF0D6;
  --accent-200: #FFE4A8;
  --accent-300: #FFD67C;
  --accent-400: #F5C254;
  --accent-500: #D4A24C;
  --accent-600: #B8892D;
  --accent-700: #9A7020;
  --accent-800: #7D5A18;
  --accent-900: #614510;

  /* Neutral Colors - Warm Gray */
  --neutral-0: #FFFBF5;
  --neutral-50: #FEF7ED;
  --neutral-100: #F5EDE4;
  --neutral-200: #E8DDD2;
  --neutral-300: #D4C8BC;
  --neutral-400: #A89A8C;
  --neutral-500: #79747E;
  --neutral-600: #5C554D;
  --neutral-700: #49454F;
  --neutral-800: #322E29;
  --neutral-900: #1C1B1F;

  /* Semantic Colors - Material */
  --success-light: #E8F5E9;
  --success-main: #4CAF50;
  --success-dark: #388E3C;

  --warning-light: #FFF3E0;
  --warning-main: #FF9800;
  --warning-dark: #F57C00;

  --danger-light: #FFEBEE;
  --danger-main: #E53935;
  --danger-dark: #C62828;

  --info-light: #E3F2FD;
  --info-main: #2196F3;
  --info-dark: #1976D2;

  /* Surface Colors */
  --surface-bg: var(--bg-primary);
  --surface-card: var(--bg-surface);
  --surface-elevated: var(--bg-elevated);

  /* Sidebar - Light theme */
  --sidebar-bg: var(--bg-surface);
  --sidebar-text: var(--neutral-700);
  --sidebar-accent: var(--primary-500);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;

  /* Border & Shadow */
  --border-color: #E0D6CC;
  --border-width: 1px;

  /* Border Radius - Material */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Font Families */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-black: 800;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.01em;

  /* Material Shadows (with blur) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ============================================
   2. Dark Mode Variables
   ============================================ */
[data-theme="dark"] {
  --bg-primary: #1C1917;
  --bg-secondary: #292524;
  --bg-surface: #1C1917;
  --bg-elevated: #292524;

  --neutral-0: #1C1917;
  --neutral-50: #292524;
  --neutral-100: #3D3835;
  --neutral-200: #524B46;
  --neutral-300: #6B6460;
  --neutral-400: #8B847F;
  --neutral-500: #A8A29E;
  --neutral-600: #CAC5C1;
  --neutral-700: #E7E5E4;
  --neutral-800: #F5F5F4;
  --neutral-900: #FAFAF9;

  --primary-500: #FFB59D;
  --primary-600: #E8936B;
  --primary-100: rgba(255, 181, 157, 0.15);

  --accent-500: #F0BC4C;
  --accent-600: #D4A24C;
  --accent-100: rgba(240, 188, 76, 0.15);

  --success-main: #81C784;
  --success-light: rgba(129, 199, 132, 0.15);
  --success-dark: #66BB6A;

  --warning-main: #FFB74D;
  --warning-light: rgba(255, 183, 77, 0.15);
  --warning-dark: #FFA726;

  --danger-main: #EF5350;
  --danger-light: rgba(239, 83, 80, 0.15);
  --danger-dark: #E53935;

  --surface-bg: var(--bg-primary);
  --surface-card: var(--bg-elevated);
  --surface-elevated: var(--bg-elevated);

  --border-color: #3D3835;

  --sidebar-bg: var(--bg-elevated);
  --sidebar-text: var(--neutral-600);
  --sidebar-accent: var(--primary-500);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3), 0 4px 6px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.3), 0 10px 10px rgba(0, 0, 0, 0.2);
}

/* ============================================
   3. Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--neutral-900);
  background-color: var(--surface-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--neutral-900);
  margin-top: 0;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
}

code, .code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--neutral-100);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--primary-700);
}

[data-theme="dark"] code {
  background: var(--neutral-100);
  color: var(--primary-500);
}

/* ============================================
   4. Layout - Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sidebar-accent);
}

.sidebar-brand-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-500);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand-text {
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--transition-slow);
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: var(--radius-full);
}

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

.sidebar .nav-item {
  margin-bottom: 0.25rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  margin: 0.25rem 0;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.sidebar .nav-link:hover {
  color: var(--primary-600);
  background: var(--primary-50);
}

.sidebar .nav-link.active {
  color: var(--primary-700);
  background: var(--primary-100);
  font-weight: var(--font-semibold);
}

.sidebar .nav-icon {
  font-size: 1.25rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav-text {
  white-space: nowrap;
  transition: all var(--transition-slow);
}

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

.sidebar-footer .nav-link {
  color: var(--neutral-500);
}

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

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 2rem;
  background: var(--surface-bg);
  transition: margin-left var(--transition-slow);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-header h2 {
  margin: 0;
  font-size: var(--text-2xl);
  color: var(--neutral-900);
}

/* ============================================
   5. Cards
   ============================================ */
.card {
  background: var(--surface-card);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--neutral-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card.primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
}

.stat-card.success {
  background: linear-gradient(135deg, var(--success-main) 0%, var(--success-dark) 100%);
}

.stat-card.warning {
  background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
}

.stat-card .card-body {
  position: relative;
  z-index: 1;
  color: white;
  padding: 1.5rem;
}

.stat-card.warning .card-body {
  color: var(--neutral-900);
}

.stat-card .stat-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3.5rem;
  opacity: 0.2;
  transition: all var(--transition-base);
}

.stat-card:hover .stat-icon {
  opacity: 0.3;
  transform: translateY(-50%) scale(1.05);
}

.stat-card .stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: 1;
  margin: 0;
}

/* Hover Lift Effect */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ============================================
   6. Tables
   ============================================ */
.table-card {
  background: var(--surface-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-lg);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-bottom: 0;
}

.table-modern thead th {
  background: var(--bg-secondary);
  color: var(--neutral-700);
  font-family: var(--font-primary);
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  text-align: left;
}

/* Explicit table background */
.table-modern tbody {
  background: var(--surface-card) !important;
}

.table-modern tbody tr {
  background: var(--surface-card) !important;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.table-modern tbody tr:last-child {
  border-bottom: none;
}

.table-modern tbody tr:hover {
  background-color: var(--primary-50) !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table-modern,
[data-theme="dark"] .table tbody,
[data-theme="dark"] .table-modern tbody {
  background: var(--surface-card) !important;
  --bs-table-bg: var(--surface-card) !important;
}

[data-theme="dark"] .table tbody tr,
[data-theme="dark"] .table-modern tbody tr {
  background: var(--surface-card) !important;
  --bs-table-bg: var(--surface-card) !important;
}

[data-theme="dark"] .table tbody td,
[data-theme="dark"] .table-modern tbody td {
  background: var(--surface-card) !important;
  color: var(--neutral-700);
}

[data-theme="dark"] .table-modern tbody tr:hover,
[data-theme="dark"] .table-modern tbody tr:hover td {
  background-color: var(--neutral-100) !important;
}

.table-modern tbody td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  color: var(--neutral-700);
}

.table-modern .cell-primary {
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
}

.table-modern .cell-muted {
  color: var(--neutral-500);
  font-size: var(--text-xs);
}

/* Duration Display */
.duration-display {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--neutral-900);
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
}

/* ============================================
   7. Badges & Status
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
}

.badge-status {
  padding-left: 0.625rem;
}

.badge-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-active,
.badge.bg-success {
  background: var(--success-light);
  color: var(--success-dark);
}

.badge-active::before {
  background: var(--success-main);
  animation: pulse 2s infinite;
}

.badge-completed,
.badge.bg-secondary {
  background: var(--neutral-100);
  color: var(--neutral-600);
}

.badge-completed::before {
  background: var(--neutral-500);
}

.badge-pending,
.badge.bg-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
}

.badge-pending::before {
  background: var(--warning-main);
}

.badge-inactive {
  background: var(--neutral-100);
  color: var(--neutral-500);
}

.badge-inactive::before {
  background: var(--neutral-400);
}

/* Live Indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success-dark);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--success-main);
  border-radius: 50%;
  position: relative;
}

.live-dot::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: var(--success-main);
  border-radius: 50%;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ============================================
   8. Forms
   ============================================ */
.form-control,
.form-select {
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--surface-card);
  color: var(--neutral-900);
  transition: all var(--transition-fast);
}

.form-control:hover,
.form-select:hover {
  border-color: var(--neutral-400);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(198, 93, 53, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--neutral-500);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--neutral-700);
  margin-bottom: 0.5rem;
}

.form-text {
  font-size: var(--text-xs);
  color: var(--neutral-500);
  margin-top: 0.375rem;
}

/* Form Check */
.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--surface-card);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--primary-500);
  border-color: var(--primary-500);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(198, 93, 53, 0.15);
}

/* Date Input */
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background: var(--neutral-100);
}

/* ============================================
   9. Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-primary);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}

.btn:active {
  box-shadow: var(--shadow-xs);
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary-500);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-600);
  color: white;
}

/* Gold Accent Button */
.btn-accent {
  background: var(--accent-500);
  color: var(--neutral-900);
}

.btn-accent:hover {
  background: var(--accent-600);
  color: var(--neutral-900);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--neutral-700);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  color: var(--neutral-900);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary-600);
  border: 1px solid var(--primary-500);
  box-shadow: none;
}

.btn-outline-primary:hover {
  background: var(--primary-50);
  color: var(--primary-700);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--danger-main);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-dark);
  color: white;
}

.btn-outline-danger {
  background: transparent;
  color: var(--danger-main);
  border: 1px solid var(--danger-main);
  box-shadow: none;
}

.btn-outline-danger:hover {
  background: var(--danger-light);
  color: var(--danger-dark);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: var(--text-base);
}

/* Button Close */
.btn-close {
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.btn-close:hover {
  opacity: 1;
}

/* ============================================
   10. Alerts
   ============================================ */
.alert {
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-left: 4px solid;
  animation: slideInRight 0.2s ease;
}

.alert-success {
  background: var(--success-light);
  color: var(--success-dark);
  border-left-color: var(--success-main);
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger-dark);
  border-left-color: var(--danger-main);
}

.alert-warning {
  background: var(--warning-light);
  color: var(--warning-dark);
  border-left-color: var(--warning-main);
}

/* ============================================
   11. Modals
   ============================================ */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  background: var(--surface-card);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--neutral-900);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal.fade .modal-dialog {
  transform: translateY(-20px) scale(0.95);
  transition: transform var(--transition-slow);
}

.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* ============================================
   12. Animations
   ============================================ */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes ping {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  75%, 100% {
    transform: translate(-50%, -50%) scale(2.5);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slide-in {
  animation: slideInRight 0.3s ease forwards;
}

/* Stagger Children */
.stagger-children > * {
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   13. Mobile Header
   ============================================ */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-menu-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--neutral-900);
  transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

/* Theme Toggle */
.theme-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 1000;
  font-size: 1.25rem;
  color: var(--neutral-900);
}

.theme-toggle:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.05);
}

[data-theme="dark"] .theme-toggle .bi-sun-fill {
  display: none;
}

[data-theme="light"] .theme-toggle .bi-moon-fill,
:root:not([data-theme]) .theme-toggle .bi-moon-fill {
  display: none;
}

/* ============================================
   14. Responsive
   ============================================ */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: var(--shadow-xl);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .mobile-header {
    display: flex;
  }

  .page-content {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header .btn {
    width: 100%;
  }

  /* Stat Cards */
  .stat-card .stat-value {
    font-size: var(--text-2xl);
  }

  .stat-card .stat-icon {
    font-size: 2.5rem;
  }

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

  /* Modal */
  .modal-dialog {
    margin: 0.5rem;
  }

  /* Overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .sidebar.show ~ .sidebar-overlay {
    display: block;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar .sidebar-brand-text,
  .sidebar .sidebar-brand-title,
  .sidebar .nav-text {
    display: none;
  }

  .sidebar .sidebar-brand {
    justify-content: center;
    padding: 0 0.75rem 1.5rem;
  }

  .sidebar .sidebar-brand::before {
    content: "J";
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sidebar-accent);
  }

  .sidebar .nav-link {
    justify-content: center;
    padding: 1rem;
  }

  .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .sidebar:hover {
    width: var(--sidebar-width);
  }

  .sidebar:hover .sidebar-brand-text,
  .sidebar:hover .sidebar-brand-title,
  .sidebar:hover .nav-text {
    display: block;
  }

  .sidebar:hover .sidebar-brand::before {
    display: none;
  }

  .sidebar:hover .sidebar-brand {
    justify-content: center;
    padding: 0 1.5rem 1.5rem;
  }

  .sidebar:hover .nav-link {
    justify-content: flex-start;
    padding: 0.875rem 1rem;
  }
}

@media (min-width: 1400px) {
  .main-content {
    padding: 2.5rem 3rem;
  }
}

/* Touch Device Optimizations */
@media (hover: none) {
  .btn:hover,
  .card:hover,
  .stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .mobile-header,
  .theme-toggle {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* ============================================
   15. Login Page Specific
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 1rem;
}

[data-theme="dark"] .login-page {
  background: var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary-500);
  margin: 0;
  line-height: 1;
}

[data-theme="dark"] .login-title {
  color: var(--accent-500);
}

.login-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-brand-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-500);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: white;
  margin-bottom: 1rem;
}

.login-brand-text {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--neutral-900);
}

.login-form .form-control {
  padding: 1rem 1.25rem;
  font-size: var(--text-base);
}

.login-form .btn {
  padding: 1rem;
  font-size: var(--text-base);
  width: 100%;
  margin-top: 0.5rem;
}

/* ============================================
   16. Filter Card
   ============================================ */
.filter-card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.filter-card .row {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
}

/* ============================================
   17. Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--neutral-500);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: var(--text-base);
  margin: 0;
}
