/* ============================================
   SIM Tracker - Design System & Styles
   Dark Theme with Glassmorphism
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Colors */
  --bg-primary: #0f0f23;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.07);
  --bg-input-focus: rgba(255, 255, 255, 0.1);
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  --text-inverse: #0f0f23;

  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-primary-hover: linear-gradient(135deg, #7a8ff0 0%, #8a5fb8 100%);
  --gradient-bg: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #0f0f23 100%);
  --gradient-accent-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent-2: linear-gradient(135deg, #00d68f 0%, #00b887 100%);
  --gradient-accent-3: linear-gradient(135deg, #0095ff 0%, #0077cc 100%);
  --gradient-accent-4: linear-gradient(135deg, #ffaa00 0%, #ff8800 100%);

  --color-success: #00d68f;
  --color-warning: #ffaa00;
  --color-danger: #ff3d71;
  --color-info: #0095ff;
  --color-purple: #764ba2;

  --color-red: #ff3d71;
  --color-orange: #ffaa00;
  --color-yellow: #ffd93d;
  --color-green: #00d68f;

  /* Border */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  --border-radius-full: 50%;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
  --shadow-glow-success: 0 0 20px rgba(0, 214, 143, 0.3);
  --shadow-glow-danger: 0 0 20px rgba(255, 61, 113, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(20px);
}

/* ============================================
   LIGHT MODE OVERRIDES
   ============================================ */
body.light-mode {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8ecf1;
  --bg-card: rgba(0, 0, 0, 0.03);
  --bg-card-hover: rgba(0, 0, 0, 0.06);
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-input-focus: rgba(0, 0, 0, 0.07);
  --bg-overlay: rgba(0, 0, 0, 0.4);

  --text-primary: #1a1a2e;
  --text-secondary: #555570;
  --text-muted: #8888a0;
  --text-inverse: #ffffff;

  --gradient-bg: linear-gradient(135deg, #f0f2f5 0%, #e8ecf1 50%, #f0f2f5 100%);

  --border-color: rgba(0, 0, 0, 0.1);
  --border-color-hover: rgba(0, 0, 0, 0.18);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.15);

  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
}

body.light-mode .sidebar {
  background: linear-gradient(180deg, #1e2a4a 0%, #1a1a2e 100%);
}

body.light-mode .sidebar .nav-item,
body.light-mode .sidebar .sidebar-title,
body.light-mode .sidebar .user-name,
body.light-mode .sidebar .user-role,
body.light-mode .sidebar .btn-logout,
body.light-mode .sidebar .theme-toggle {
  color: #e8e8f0;
}

body.light-mode .sidebar .nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.light-mode .sidebar .nav-item.active {
  background: rgba(102, 126, 234, 0.25);
  color: #ffffff;
}

body.light-mode thead th {
  background: rgba(0, 0, 0, 0.03);
  color: #555570;
}

body.light-mode tbody tr:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.light-mode tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

body.light-mode tbody td {
  color: var(--text-primary);
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

/* Light Mode Badges (Darker text for better contrast) */
body.light-mode .badge-red {
  color: #d32f2f;
  background: rgba(211, 47, 47, 0.15);
}

body.light-mode .badge-orange {
  color: #e65100;
  background: rgba(230, 81, 0, 0.12);
}

body.light-mode .badge-yellow {
  color: #f57f17;
  background: rgba(245, 127, 23, 0.12);
}

body.light-mode .badge-green {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.15);
}

body.light-mode .form-select,
body.light-mode .form-input {
  background: rgba(0, 0, 0, 0.04);
  color: #1a1a2e;
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .summary-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.light-mode .chart-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.light-mode .dash-table tbody tr.total-row {
  background: rgba(102, 126, 234, 0.06);
}

body.light-mode .tag{
  background-color: var(--color-info);
}

/* ============================================
   THEME TOGGLE SWITCH
   ============================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  user-select: none;
  color: var(--text-secondary);
  font-size: 14px;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toggle-track {
  width: 38px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  position: relative;
  transition: background 0.3s;
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  background: #667eea;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.light-mode .toggle-track {
  background: rgba(102, 126, 234, 0.3);
}

body.light-mode .toggle-thumb {
  transform: translateX(18px);
  background: #ffa726;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-info);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #40afff;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* --- Loading Spinner --- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #667eea;
  border-radius: var(--border-radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-width: 2px;
  vertical-align: middle;
  margin-right: var(--space-sm);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 35, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity var(--transition-base);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0, 149, 255, 0.08) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% {
    background:
      radial-gradient(ellipse at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
      radial-gradient(ellipse at 50% 80%, rgba(0, 149, 255, 0.08) 0%, transparent 50%);
  }
  50% {
    background:
      radial-gradient(ellipse at 30% 40%, rgba(102, 126, 234, 0.2) 0%, transparent 50%),
      radial-gradient(ellipse at 70% 30%, rgba(118, 75, 162, 0.2) 0%, transparent 50%),
      radial-gradient(ellipse at 40% 70%, rgba(0, 149, 255, 0.12) 0%, transparent 50%);
  }
  100% {
    background:
      radial-gradient(ellipse at 40% 60%, rgba(102, 126, 234, 0.18) 0%, transparent 50%),
      radial-gradient(ellipse at 60% 10%, rgba(118, 75, 162, 0.18) 0%, transparent 50%),
      radial-gradient(ellipse at 60% 90%, rgba(0, 149, 255, 0.1) 0%, transparent 50%);
  }
}

.login-particles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-particles .particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  animation: floatParticle linear infinite;
}

.login-particles .particle:nth-child(1) { left: 10%; animation-duration: 15s; animation-delay: 0s; width: 3px; height: 3px; }
.login-particles .particle:nth-child(2) { left: 20%; animation-duration: 20s; animation-delay: 2s; width: 5px; height: 5px; background: rgba(118, 75, 162, 0.3); }
.login-particles .particle:nth-child(3) { left: 35%; animation-duration: 18s; animation-delay: 4s; width: 3px; height: 3px; }
.login-particles .particle:nth-child(4) { left: 50%; animation-duration: 22s; animation-delay: 1s; width: 4px; height: 4px; background: rgba(0, 149, 255, 0.3); }
.login-particles .particle:nth-child(5) { left: 65%; animation-duration: 16s; animation-delay: 3s; width: 6px; height: 6px; background: rgba(102, 126, 234, 0.2); }
.login-particles .particle:nth-child(6) { left: 75%; animation-duration: 19s; animation-delay: 5s; width: 3px; height: 3px; background: rgba(118, 75, 162, 0.25); }
.login-particles .particle:nth-child(7) { left: 85%; animation-duration: 14s; animation-delay: 2s; width: 4px; height: 4px; }
.login-particles .particle:nth-child(8) { left: 45%; animation-duration: 21s; animation-delay: 6s; width: 5px; height: 5px; background: rgba(0, 214, 143, 0.2); }

@keyframes floatParticle {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; transform: translateY(90vh) scale(1); }
  90% { opacity: 1; }
  100% { transform: translateY(-10vh) scale(0.5); opacity: 0; }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: var(--space-2xl);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-xl);
  animation: cardSlideUp 0.6s var(--transition-spring) forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes cardSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card .logo-section {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-card .logo-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
  font-size: 1.5rem;
  color: white;
  box-shadow: var(--shadow-glow);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.login-card .app-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.login-card .app-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.login-form .form-group {
  margin-bottom: var(--space-lg);
}

.login-form .input-wrapper {
  position: relative;
}

.login-form .input-icon {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  pointer-events: none;
}

.login-form .input-wrapper:focus-within .input-icon {
  color: #667eea;
}

#togglePassword {
  left: auto;
  right: var(--space-md);
  cursor: pointer;
  pointer-events: auto;
}

#togglePassword:hover {
  color: #667eea;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  transition: all var(--transition-fast);
  outline: none;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  background: var(--bg-input-focus);
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.login-form input::placeholder {
  color: var(--text-muted);
}

.login-error {
  background: rgba(255, 61, 113, 0.1);
  border: 1px solid rgba(255, 61, 113, 0.3);
  color: var(--color-danger);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-md);
  display: none;
  animation: shakeError 0.4s ease;
}

.login-error.show {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  outline: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-full {
  width: 100%;
}

.btn-success {
  background: var(--gradient-accent-2);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 214, 143, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 214, 143, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ff3d71 0%, #db2955 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 61, 113, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 61, 113, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading .btn-text {
  visibility: hidden;
}

.btn.loading::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* --- Export Buttons --- */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn-export:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-export:active {
  transform: translateY(0);
}

.btn-export .fa-file-excel {
  color: #00d68f;
}

.btn-export .fa-print {
  color: #667eea;
}

.btn-export.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-export.loading::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.export-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* --- Utility --- */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base);
  overflow: hidden;
}

.sidebar-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-lg);
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.sidebar-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 500;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: var(--text-primary);
  background: rgba(102, 126, 234, 0.1);
  border-left-color: #667eea;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: var(--font-size-md);
}

.nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-sm) var(--space-lg);
}

.sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-sm);
  font-weight: 700;
  flex-shrink: 0;
}

.user-details {
  overflow: hidden;
}

.user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 61, 113, 0.1);
  border: 1px solid rgba(255, 61, 113, 0.2);
  border-radius: var(--border-radius-sm);
  color: var(--color-danger);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-logout:hover {
  background: rgba(255, 61, 113, 0.2);
  border-color: rgba(255, 61, 113, 0.4);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 101;
  width: 44px;
  height: 44px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--bg-card-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-lg);
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

.content-section {
  display: none;
  animation: fadeInSection 0.3s ease forwards;
}

.content-section.active {
  display: block;
}

@keyframes fadeInSection {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* ============================================
   SUMMARY CARDS
   ============================================ */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.summary-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.summary-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.summary-card:nth-child(1)::before { background: var(--gradient-accent-1); }
.summary-card:nth-child(2)::before { background: var(--gradient-accent-3); }
.summary-card:nth-child(3)::before { background: var(--gradient-accent-2); }
.summary-card:nth-child(4)::before { background: var(--gradient-accent-4); }

.summary-card .card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
}

.summary-card:nth-child(1) .card-icon { background: rgba(102, 126, 234, 0.15); color: #667eea; }
.summary-card:nth-child(2) .card-icon { background: rgba(0, 149, 255, 0.15); color: #0095ff; }
.summary-card:nth-child(3) .card-icon { background: rgba(0, 214, 143, 0.15); color: #00d68f; }
.summary-card:nth-child(4) .card-icon { background: rgba(255, 170, 0, 0.15); color: #ffaa00; }

.summary-card .card-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.summary-card .card-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.summary-card .card-subtext-list .card-label{
  font-size: var(--font-size-xs);
  font-weight: 300;
  color: #0077cc;
}

.summary-card .card-subtext-list .card-value{
  font-size: var(--font-size-sm);
  font-weight: 500;
}

/* ============================================
   MAP SECTION
   ============================================ */

.map-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.map-container {
  width: 100%;
  height: calc(100vh - 320px);
  min-height: 400px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Leaflet overrides for dark theme */
.leaflet-container {
  background: var(--bg-primary) !important;
  font-family: var(--font-family) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-radius: var(--border-radius-md) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
  font-size: 20px !important;
}

.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-card-hover) !important;
}

.leaflet-control-attribution {
  background: rgba(15, 15, 35, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* Popup content styles */
.popup-content {
  padding: var(--space-sm);
  min-width: 220px;
}

.popup-content .popup-title {
  font-weight: 700;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.popup-content .popup-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: var(--font-size-xs);
}

.popup-content .popup-row .label {
  color: var(--text-secondary);
}

.popup-content .popup-row .value {
  color: var(--text-primary);
  font-weight: 600;
}

.popup-progress {
  margin-top: var(--space-sm);
}

/* Dark Tooltip for marker hover */
.dark-tooltip {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-family: var(--font-family) !important;
  font-size: 12px !important;
  box-shadow: var(--shadow-md) !important;
  white-space: nowrap;
}

.dark-tooltip::before {
  border-top-color: var(--bg-secondary) !important;
}

/* Permanent marker label (station ID next to dot) */
.marker-label-tooltip {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-primary, #333) !important;
  font-family: var(--font-family, 'Inter', sans-serif) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  padding: 0 !important;
  white-space: nowrap;
  pointer-events: none;
}
.marker-label-tooltip::before {
  display: none !important;
}

/* Make circle markers show pointer cursor */
.leaflet-interactive {
  cursor: pointer !important;
}

/* Map Legend - Interactive */
.map-legend {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  padding: var(--space-md) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-md) !important;
  backdrop-filter: var(--glass-blur);
  min-width: 180px;
}

.map-legend .legend-title {
  font-weight: 700;
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 4px;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-fast);
  user-select: none;
}

.map-legend .legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.map-legend .legend-item.active {
  color: var(--text-primary);
}

.map-legend .legend-item:not(.active) {
  opacity: 0.45;
}

.map-legend .legend-item:not(.active) .legend-color {
  filter: grayscale(1);
}

.map-legend .legend-item:not(.active) .legend-label {
  text-decoration: line-through;
}

.map-legend .legend-toggle {
  font-size: 13px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  color: #667eea;
}

.map-legend .legend-item:not(.active) .legend-toggle {
  color: var(--text-muted);
}

.map-legend .legend-color {
  width: 14px;
  height: 14px;
  border-radius: var(--border-radius-full);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.1);
  transition: filter var(--transition-fast);
}

.map-legend .legend-label {
  flex: 1;
  transition: all var(--transition-fast);
}

.map-legend .legend-count {
  font-weight: 700;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 28px;
  text-align: center;
  color: var(--text-secondary);
}

.map-legend .legend-total {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

/* Station Search */
.station-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.station-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.station-search-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.station-search-clear:hover {
  color: var(--text-primary);
}

.station-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  backdrop-filter: var(--glass-blur);
}

.station-search-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-fast);
}

.station-search-item:last-child {
  border-bottom: none;
}

.station-search-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.station-search-item .item-id {
  font-weight: 600;
  color: var(--text-primary);
}

.station-search-item .item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.station-search-item .item-pct {
  font-size: 12px;
  font-weight: 500;
}

/* ---- Pagination ---- */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0 6px;
}

.page-btn:hover:not(.disabled):not(.active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.page-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.page-dots {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  padding: 0 4px;
  user-select: none;
}

.last-updated {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* MarkerCluster overrides */
.marker-cluster-small {
  background-color: rgba(0, 214, 143, 0.3) !important;
}
.marker-cluster-small div {
  background-color: rgba(0, 214, 143, 0.6) !important;
  color: white !important;
  font-weight: 600 !important;
  font-family: var(--font-family) !important;
}
.marker-cluster-medium {
  background-color: rgba(255, 170, 0, 0.3) !important;
}
.marker-cluster-medium div {
  background-color: rgba(255, 170, 0, 0.6) !important;
  color: white !important;
  font-weight: 600 !important;
  font-family: var(--font-family) !important;
}
.marker-cluster-large {
  background-color: rgba(102, 126, 234, 0.3) !important;
}
.marker-cluster-large div {
  background-color: rgba(102, 126, 234, 0.6) !important;
  color: white !important;
  font-weight: 600 !important;
  font-family: var(--font-family) !important;
}

/* ============================================
   FORM CONTROLS
   ============================================ */

.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus {
  background: var(--bg-input-focus);
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a0a0b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.search-input-wrapper {
  position: relative;
  max-width: 300px;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  pointer-events: none;
}

.search-input-wrapper .form-input {
  padding-left: 36px;
}

#formAreaSearchInput{
  margin-bottom: 10px;
}
/* ============================================
   TABLES
   ============================================ */

.table-container {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.table-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-fast);
  user-select: none;
}

thead th:hover {
  color: var(--text-primary);
}

thead th.sort-asc::after {
  content: ' ▲';
  font-size: 10px;
}

thead th.sort-desc::after {
  content: ' ▼';
  font-size: 10px;
}

tbody td {
  padding: 12px 16px;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

tbody tr:nth-child(even):hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar .progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar-lg {
  height: 12px;
}

.progress-text {
  font-size: var(--font-size-xs);
  font-weight: 700;
  margin-top: var(--space-xs);
}

/* ============================================
   BADGES & TAGS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge-red {
  background: rgba(255, 61, 113, 0.15);
  color: var(--color-red);
}

.badge-orange {
  background: rgba(255, 170, 0, 0.15);
  color: var(--color-orange);
}

.badge-yellow {
  background: rgba(255, 217, 61, 0.15);
  color: var(--color-yellow);
}

.badge-green {
  background: rgba(0, 214, 143, 0.15);
  color: var(--color-green);
}

.badge-info {
  background: rgba(0, 149, 255, 0.15);
  color: var(--color-info);
}

.badge-purple {
  background: rgba(118, 75, 162, 0.15);
  color: var(--color-purple);
}

.badge-green {
  background: rgba(0, 214, 143, 0.15);
  color: #00d68f;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 20px;
  font-size: var(--font-size-xs);
  /* color: #667eea; */
  color: white;
  font-weight: 500;
  margin: 2px;
  white-space: nowrap;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 250px;
}

.tag-removable {
  cursor: default;
}

.tag-remove {
  background: none;
  border: none;
  /* color: #667eea; */
  color: rgb(255, 1, 1);
  cursor: pointer;
  padding: 0 2px;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.tag-remove:hover {
  opacity: 1;
  color: var(--color-danger);
}

.selected-region-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  max-height: 120px;
  overflow-y: auto;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: var(--space-md);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--font-size-lg);
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Region checkboxes in modal */
.region-checklist {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: var(--space-sm);
  background: var(--bg-input);
}

.region-check-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-sm);
  border-radius: 4px;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.region-check-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.region-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #667eea;
  cursor: pointer;
}

.region-check-item label {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  cursor: pointer;
  flex: 1;
}

.check-all-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  font-weight: 600;
}

.check-all-selected-item{
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  font-weight: 600;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s var(--transition-spring) forwards;
  transform: translateX(100%);
  opacity: 0;
}

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.toast-message {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast.toast-success {
  border-left: 3px solid var(--color-success);
}
.toast.toast-success .toast-icon { color: var(--color-success); }

.toast.toast-error {
  border-left: 3px solid var(--color-danger);
}
.toast.toast-error .toast-icon { color: var(--color-danger); }

.toast.toast-info {
  border-left: 3px solid var(--color-info);
}
.toast.toast-info .toast-icon { color: var(--color-info); }

.toast.toast-warning {
  border-left: 3px solid var(--color-warning);
}
.toast.toast-warning .toast-icon { color: var(--color-warning); }

/* ============================================
   CHARTS SECTION
   ============================================ */

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
}

.chart-card .chart-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chart-card .chart-title i {
  color: #667eea;
}

.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  width: 100% !important;
}

/* ============================================
   UPLOAD SECTION
   ============================================ */

.upload-section {
  max-width: 640px;
}

.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-card);
  position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  box-shadow: var(--shadow-glow);
}

.upload-zone.dragover {
  transform: scale(1.01);
}

.upload-zone .upload-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
  transition: all var(--transition-base);
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
  color: #667eea;
  transform: translateY(-4px);
}

.upload-zone .upload-text {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.upload-zone .upload-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.upload-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-file-info {
  display: none;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-top: var(--space-md);
}

.upload-file-info.show {
  display: flex;
}

.upload-file-info .file-icon {
  font-size: var(--font-size-2xl);
  color: var(--color-success);
}

.upload-file-info .file-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.upload-file-info .file-size {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.upload-progress {
  margin-top: var(--space-md);
  display: none;
}

.upload-progress.show {
  display: block;
}

.upload-actions {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-md);
}

.upload-last-date {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ============================================
   CONFIRM DIALOG
   ============================================ */

.confirm-dialog .modal {
  max-width: 400px;
}

.confirm-dialog .confirm-message {
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: center;
  padding: var(--space-md) 0;
}

.confirm-dialog .confirm-icon {
  font-size: 3rem;
  color: var(--color-warning);
  text-align: center;
  margin-bottom: var(--space-md);
}

.confirm-dialog .modal-footer {
  justify-content: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-md);
    padding-top: calc(var(--space-md) + 60px);
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .summary-card {
    padding: var(--space-md);
  }

  .summary-card .card-value {
    font-size: var(--font-size-xl);
  }

  .map-container {
    height: calc(100vh - 380px);
    min-height: 300px;
  }

  .login-card {
    margin: var(--space-md);
    padding: var(--space-lg);
  }

  .toast-container {
    right: var(--space-md);
    left: var(--space-md);
  }

  .toast {
    min-width: auto;
  }

  .modal {
    margin: var(--space-sm);
    max-height: 90vh;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }

  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input-wrapper {
    max-width: 100%;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.hidden { display: none !important; }
.visible { display: block; }

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.3s ease forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Number counting animation helper */
.counting {
  transition: none;
}

/* ============================================
   DASHBOARD TABLES
   ============================================ */

.day-selector-container {
  display: flex;
  align-items: center;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.dash-table tbody td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.dash-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dash-table tbody tr.total-row {
  background: rgba(102, 126, 234, 0.08);
  border-top: 2px solid rgba(102, 126, 234, 0.3);
}

.dash-table tbody tr.total-row td {
  border-bottom: none;
}
