/*
 * GAIA Pilgrimage Pro - Design System
 * 
 * ⚠️  CRITICAL: DO NOT MODIFY WITHOUT EXPLICIT PERMISSION
 * 
 * This file contains the official GAIA color palette, typography,
 * and design tokens. Any changes to colors, fonts, or spacing
 * must be approved to maintain brand consistency.
 * 
 * For development guidelines, see: DEVELOPMENT_GUIDELINES.md
 */

:root {
  /* Primitive Color Tokens */
  --color-white: rgba(255, 255, 255, 1);
  --color-black: rgba(0, 0, 0, 1);
  --color-cream-50: rgba(252, 252, 249, 1);
  --color-cream-100: rgba(255, 255, 253, 1);
  --color-gray-200: rgba(245, 245, 245, 1);
  --color-gray-300: rgba(167, 169, 169, 1);
  --color-gray-400: rgba(119, 124, 124, 1);
  --color-slate-500: rgba(98, 108, 113, 1);
  --color-brown-600: rgba(94, 82, 64, 1);
  --color-charcoal-700: rgba(31, 33, 33, 1);
  --color-charcoal-800: rgba(38, 40, 40, 1);
  --color-slate-900: rgba(19, 52, 59, 1);
  --color-teal-300: rgba(50, 184, 198, 1);
  --color-teal-400: rgba(45, 166, 178, 1);
  --color-teal-500: rgba(33, 128, 141, 1);
  --color-teal-600: rgba(29, 116, 128, 1);
  --color-teal-700: rgba(26, 104, 115, 1);
  --color-teal-800: rgba(41, 150, 161, 1);
  --color-red-400: rgba(255, 84, 89, 1);
  --color-red-500: rgba(192, 21, 47, 1);
  --color-orange-400: rgba(230, 129, 97, 1);
  --color-orange-500: rgba(168, 75, 47, 1);

  /* RGB versions for opacity control */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;
  --color-slate-500-rgb: 98, 108, 113;
  --color-red-500-rgb: 192, 21, 47;
  --color-red-400-rgb: 255, 84, 89;
  --color-orange-500-rgb: 168, 75, 47;
  --color-orange-400-rgb: 230, 129, 97;

  /* Background color tokens (Light Mode) */
  --color-bg-1: rgba(59, 130, 246, 0.08); /* Light blue */
  --color-bg-2: rgba(245, 158, 11, 0.08); /* Light yellow */
  --color-bg-3: rgba(34, 197, 94, 0.08); /* Light green */
  --color-bg-4: rgba(239, 68, 68, 0.08); /* Light red */
  --color-bg-5: rgba(147, 51, 234, 0.08); /* Light purple */
  --color-bg-6: rgba(249, 115, 22, 0.08); /* Light orange */
  --color-bg-7: rgba(236, 72, 153, 0.08); /* Light pink */
  --color-bg-8: rgba(6, 182, 212, 0.08); /* Light cyan */

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
  --color-select-caret: rgba(var(--color-slate-900-rgb), 0.8);

  /* Common style patterns */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for opacity control */
  --color-success-rgb: 33, 128, 141;
  --color-error-rgb: 192, 21, 47;
  --color-warning-rgb: 168, 75, 47;
  --color-info-rgb: 98, 108, 113;

  /* Typography */
  --font-family-base: "FKGroteskNeue", "Geist", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 550;
  --font-weight-bold: 600;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.01em;

  /* Spacing */
  --space-0: 0;
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-base: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
    0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
  :root {
    /* RGB versions for opacity control (Dark Mode) */
    --color-gray-400-rgb: 119, 124, 124;
    --color-teal-300-rgb: 50, 184, 198;
    --color-gray-300-rgb: 167, 169, 169;
    --color-gray-200-rgb: 245, 245, 245;

    /* Background color tokens (Dark Mode) */
    --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
    --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
    --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
    --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
    --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
    --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
    --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
    --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

    /* Semantic Color Tokens (Dark Mode) */
    --color-background: var(--color-charcoal-700);
    --color-surface: var(--color-charcoal-800);
    --color-text: var(--color-gray-200);
    --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
    --color-primary: var(--color-teal-300);
    --color-primary-hover: var(--color-teal-400);
    --color-primary-active: var(--color-teal-800);
    --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
    --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
    --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
    --color-border: rgba(var(--color-gray-400-rgb), 0.3);
    --color-error: var(--color-red-400);
    --color-success: var(--color-teal-300);
    --color-warning: var(--color-orange-400);
    --color-info: var(--color-gray-300);
    --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
    --color-btn-primary-text: var(--color-slate-900);
    --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
    --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
    --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    --button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

    /* Common style patterns - updated for dark mode */
    --focus-ring: 0 0 0 3px var(--color-focus-ring);
    --focus-outline: 2px solid var(--color-primary);
    --status-bg-opacity: 0.15;
    --status-border-opacity: 0.25;
    --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    /* RGB versions for dark mode */
    --color-success-rgb: var(--color-teal-300-rgb);
    --color-error-rgb: var(--color-red-400-rgb);
    --color-warning-rgb: var(--color-orange-400-rgb);
    --color-info-rgb: var(--color-gray-300-rgb);
  }
}

/* Data attribute for manual theme switching */
[data-color-scheme="dark"] {
  /* RGB versions for opacity control (dark mode) */
  --color-gray-400-rgb: 119, 124, 124;
  --color-teal-300-rgb: 50, 184, 198;
  --color-gray-300-rgb: 167, 169, 169;
  --color-gray-200-rgb: 245, 245, 245;

  /* Colorful background palette - Dark Mode */
  --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
  --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
  --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
  --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
  --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
  --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
  --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
  --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

  /* Semantic Color Tokens (Dark Mode) */
  --color-background: var(--color-charcoal-700);
  --color-surface: var(--color-charcoal-800);
  --color-text: var(--color-gray-200);
  --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
  --color-primary: var(--color-teal-300);
  --color-primary-hover: var(--color-teal-400);
  --color-primary-active: var(--color-teal-800);
  --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
  --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
  --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-error: var(--color-red-400);
  --color-success: var(--color-teal-300);
  --color-warning: var(--color-orange-400);
  --color-info: var(--color-gray-300);
  --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
  --color-btn-primary-text: var(--color-slate-900);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.15);
  --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

  /* Common style patterns - updated for dark mode */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: 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='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: 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='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for dark mode */
  --color-success-rgb: var(--color-teal-300-rgb);
  --color-error-rgb: var(--color-red-400-rgb);
  --color-warning-rgb: var(--color-orange-400-rgb);
  --color-info-rgb: var(--color-gray-300-rgb);
}

[data-color-scheme="light"] {
  /* RGB versions for opacity control (light mode) */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);

  /* RGB versions for light mode */
  --color-success-rgb: var(--color-teal-500-rgb);
  --color-error-rgb: var(--color-red-500-rgb);
  --color-warning-rgb: var(--color-orange-500-rgb);
  --color-info-rgb: var(--color-slate-500-rgb);
}

/* Base styles */
html {
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
}

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

p {
  margin: 0 0 var(--space-16) 0;
}

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

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

code,
pre {
  font-family: var(--font-family-mono);
  font-size: calc(var(--font-size-base) * 0.95);
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-4);
}

pre {
  padding: var(--space-16);
  margin: var(--space-16) 0;
  overflow: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  border: none;
  text-decoration: none;
  position: relative;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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

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

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

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}

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

.btn--secondary:active {
  background: var(--color-secondary-active);
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn--outline:hover {
  background: var(--color-secondary);
}

.btn--sm {
  padding: var(--space-4) var(--space-12);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-10) var(--space-20);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn--full-width {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form elements */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

textarea.form-control {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
}

select.form-control {
  padding: var(--space-8) var(--space-12);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-caret-light);
  background-repeat: no-repeat;
  background-position: right var(--space-12) center;
  background-size: 16px;
  padding-right: var(--space-32);
}

/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
  select.form-control {
    background-image: var(--select-caret-dark);
  }
}

/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
  background-image: var(--select-caret-dark);
}

[data-color-scheme="light"] select.form-control {
  background-image: var(--select-caret-light);
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: var(--focus-outline);
}

.form-label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--space-16);
}

/* Card component */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}

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

.card__body {
  padding: var(--space-16);
}

.card__header,
.card__footer {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

/* Status indicators - simplified with CSS variables */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.status--success {
  background-color: rgba(
    var(--color-success-rgb, 33, 128, 141),
    var(--status-bg-opacity)
  );
  color: var(--color-success);
  border: 1px solid
    rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}

.status--error {
  background-color: rgba(
    var(--color-error-rgb, 192, 21, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-error);
  border: 1px solid
    rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}

.status--warning {
  background-color: rgba(
    var(--color-warning-rgb, 168, 75, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-warning);
  border: 1px solid
    rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}

.status--info {
  background-color: rgba(
    var(--color-info-rgb, 98, 108, 113),
    var(--status-bg-opacity)
  );
  color: var(--color-info);
  border: 1px solid
    rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}

/* Container layout */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-16);
  padding-left: var(--space-16);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
  }
}
@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Utility classes */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-4 {
  gap: var(--space-4);
}
.gap-8 {
  gap: var(--space-8);
}
.gap-16 {
  gap: var(--space-16);
}

.m-0 {
  margin: 0;
}
.mt-8 {
  margin-top: var(--space-8);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mx-8 {
  margin-left: var(--space-8);
  margin-right: var(--space-8);
}
.my-8 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.p-0 {
  padding: 0;
}
.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}
.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}
.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}
.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

.block {
  display: block;
}
.hidden {
  display: none;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
  border: 1px solid var(--color-border-secondary);
}

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2')
    format('woff2');
}

/* END PERPLEXITY DESIGN SYSTEM */
/* Application-specific styles */
body {
  margin: 0;
  padding: 0;
  background-color: var(--color-background);
  color: var(--color-text);
}

/* Header User Info */
.header-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.user-display {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.user-icon {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.user-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.2;
}

.user-role {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  display: inline-block;
  line-height: 1;
}

.api-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-6);
  background: var(--color-success-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-success-border);
}

/* User Menu Dropdown */
.user-menu-dropdown {
  position: relative;
}

.user-menu-btn {
  background: var(--color-secondary);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-6);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all 0.2s ease;
}

.user-menu-btn:hover {
  background: var(--color-hover);
  border-color: var(--color-primary);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  margin-top: var(--space-4);
  z-index: 300;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  padding: var(--space-8) var(--space-12);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background: var(--color-hover);
}

.dropdown-item.danger {
  color: var(--color-red-500);
}

.dropdown-item.danger:hover {
  background: rgba(var(--color-red-500-rgb), 0.1);
}

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

.api-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  white-space: nowrap;
  margin-left: var(--space-8);
}

/* Sidebar Language Selector */
.sidebar-header {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-8);
}

.language-selector-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.language-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.language-selector-sidebar select {
  width: 100%;
  padding: var(--space-6) var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
}

/* Header User Info */
.header-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.user-display {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
}

.user-icon {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.user-name {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.2;
}

.user-role {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  display: inline-block;
  line-height: 1;
}

.api-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-6);
  background: var(--color-success-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-success-border);
}

/* Logout Button Styling */
#logout-btn {
  padding: var(--space-6) var(--space-12);
  border: 1px solid var(--color-red-400);
  background: transparent;
  color: var(--color-red-500);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transition: all 0.2s ease;
  position: relative;
  z-index: 10;
  white-space: nowrap;
}

#logout-btn:hover {
  background: var(--color-red-500);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(var(--color-red-500-rgb), 0.3);
}

#logout-btn:active {
  transform: scale(0.98);
}

#logout-btn:focus {
  outline: 2px solid var(--color-red-400);
  outline-offset: 2px;
}

/* Header Styles */
.header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-16) var(--space-24);
  max-width: 1400px;
  margin: 0 auto;
}

.header-brand h1 {
  font-size: var(--font-size-2xl);
  color: var(--color-primary);
  margin: 0;
}

.header-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.header-controls select {
  min-width: 150px;
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-1);
  border-right: 1px solid var(--color-border);
  padding: var(--space-16) 0;
  width: 100%;
  gap: var(--space-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-16);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  width: 100%;
  justify-content: flex-start;
}

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

.nav-item.active {
  background-color: var(--color-primary);
  color: var(--color-btn-primary-text);
}

.nav-item.hidden {
  display: none !important;
}

.nav-icon {
  font-size: var(--font-size-lg);
}

/* Sidebar */
.sidebar {
  width: 280px;
  height: calc(100vh - 100px);
  position: fixed;
  left: 0;
  top: 100px;
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
}

/* Main Content */
.main-content {
  margin-left: 280px;
  margin-top: 100px;
  max-width: calc(100vw - 280px);
  padding: var(--space-24);
  min-height: calc(100vh - 100px);
}

.module {
  display: none;
}

.module.active {
  display: block;
}

.module-header {
  margin-bottom: var(--space-32);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-16);
}

.module-header h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-8);
}

.module-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--font-size-lg);
}

.analytics-controls {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-24);
  margin-bottom: var(--space-32);
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  display: flex;
  align-items: center;
  gap: var(--space-16);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-standard);
}

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

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

.card-number {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.card-label {
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-4);
}

.card-detail {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Analytics Dashboard */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}

.analytics-section {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  box-shadow: var(--shadow-sm);
}

.analytics-section h3 {
  margin-bottom: var(--space-16);
  color: var(--color-text);
  font-size: var(--font-size-xl);
}

.analytics-section.full-width {
  grid-column: 1 / -1;
}

.chart-container {
  margin-bottom: var(--space-16);
  background: var(--color-background);
  border-radius: var(--radius-md);
  padding: var(--space-12);
}

.metrics-summary {
  display: flex;
  justify-content: space-around;
  padding-top: var(--space-16);
  border-top: 1px solid var(--color-border);
}

.metric-item {
  text-align: center;
}

.metric-value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  display: block;
}

.metric-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.revenue-summary {
  display: flex;
  justify-content: space-around;
  padding-top: var(--space-16);
  border-top: 1px solid var(--color-border);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-16);
}

.kpi-card {
  background: var(--color-bg-2);
  border-radius: var(--radius-md);
  padding: var(--space-16);
  text-align: center;
}

.kpi-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  display: block;
  margin-bottom: var(--space-4);
}

.kpi-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.safety-stats {
  display: flex;
  justify-content: space-around;
  margin-top: var(--space-16);
}

.safety-stat {
  text-align: center;
  padding: var(--space-12);
  border-radius: var(--radius-md);
  min-width: 100px;
}

.safety-stat--safe {
  background-color: rgba(var(--color-success-rgb), 0.1);
}

.safety-stat--alert {
  background-color: rgba(var(--color-warning-rgb), 0.1);
}

.safety-stat--emergency {
  background-color: rgba(var(--color-error-rgb), 0.1);
}

.stat-number {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  display: block;
  margin-bottom: var(--space-4);
}

.safety-stat--safe .stat-number {
  color: var(--color-success);
}

.safety-stat--alert .stat-number {
  color: var(--color-warning);
}

.safety-stat--emergency .stat-number {
  color: var(--color-error);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Bulk Operations */
.bulk-ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}

.bulk-section {
  display: flex;
  flex-direction: column;
}

.bulk-section.full-width {
  grid-column: 1 / -1;
}

.upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-32);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
  margin-bottom: var(--space-16);
}

.upload-area:hover {
  border-color: var(--color-primary);
  background-color: var(--color-bg-1);
}

.upload-area.dragover {
  border-color: var(--color-primary);
  background-color: var(--color-bg-1);
}

.upload-placeholder {
  pointer-events: none;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: var(--space-16);
  opacity: 0.6;
}

.upload-text p {
  margin: var(--space-4) 0;
}

.bulk-controls {
  display: flex;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

.import-progress {
  margin-bottom: var(--space-16);
}

.progress-bar {
  background-color: var(--color-secondary);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin-bottom: var(--space-8);
}

.progress-fill {
  background-color: var(--color-primary);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-standard);
  width: 0%;
}

.progress-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-align: center;
}

.import-results {
  background: var(--color-bg-3);
  border-radius: var(--radius-md);
  padding: var(--space-16);
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: var(--space-16);
}

.result-stat {
  text-align: center;
}

.result-number {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  display: block;
  margin-bottom: var(--space-4);
}

.result-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.export-options {
  margin-bottom: var(--space-16);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin-top: var(--space-8);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-size: var(--font-size-sm);
}

.export-format {
  margin-bottom: var(--space-16);
}

.import-history {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-16);
  background: var(--color-bg-1);
  border-radius: var(--radius-md);
}

.history-file {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-4);
}

.history-details {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.history-timestamp {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

/* User Management */
.user-mgmt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-24);
}

.users-section,
.roles-section {
  display: flex;
  flex-direction: column;
}

.audit-section {
  grid-column: 1 / -1;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-16);
  background: var(--color-bg-1);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-card-border-inner);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
}

.user-email {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.user-last-login {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.user-actions {
  display: flex;
  gap: var(--space-8);
}

.role-badge {
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

.role-badge--admin {
  background-color: rgba(var(--color-error-rgb), 0.15);
  color: var(--color-error);
}

.role-badge--agency {
  background-color: rgba(var(--color-primary-rgb, var(--color-teal-500-rgb)), 0.15);
  color: var(--color-primary);
}

.role-badge--leader {
  background-color: rgba(var(--color-warning-rgb), 0.15);
  color: var(--color-warning);
}

.role-badge--viewer {
  background-color: rgba(var(--color-info-rgb), 0.15);
  color: var(--color-info);
}

.role-matrix {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.role-item {
  padding: var(--space-16);
  background: var(--color-bg-2);
  border-radius: var(--radius-md);
}

.role-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-12);
}

.role-header h4 {
  margin: 0;
}

.role-permissions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.permission-tag {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.audit-log {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.audit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-12);
  background: var(--color-bg-1);
  border-radius: var(--radius-md);
}

.audit-user {
  font-weight: var(--font-weight-semibold);
}

.audit-action {
  flex: 1;
  margin-left: var(--space-16);
  color: var(--color-text-secondary);
}

.audit-timestamp {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Device Management Styles */
.device-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-24);
  gap: var(--space-16);
}

.control-group {
  display: flex;
  gap: var(--space-12);
}

.search-filter-group {
  display: flex;
  gap: var(--space-12);
}

.search-filter-group input,
.search-filter-group select {
  min-width: 150px;
}

.device-stats {
  display: flex;
  gap: var(--space-24);
  margin-bottom: var(--space-24);
  padding: var(--space-16);
  background-color: var(--color-bg-2);
  border-radius: var(--radius-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-number {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

/* Device Table */
.device-table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.device-table th {
  background-color: var(--color-bg-3);
  padding: var(--space-12) var(--space-16);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  border-bottom: 1px solid var(--color-border);
}

.device-table td {
  padding: var(--space-12) var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

.device-table tbody tr:hover {
  background-color: var(--color-bg-1);
}

.device-status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.device-status--active {
  background-color: rgba(var(--color-success-rgb), 0.15);
  color: var(--color-success);
}

.device-status--available {
  background-color: rgba(var(--color-info-rgb), 0.15);
  color: var(--color-info);
}

.device-status--maintenance {
  background-color: rgba(var(--color-warning-rgb), 0.15);
  color: var(--color-warning);
}

.device-status--low-battery {
  background-color: rgba(var(--color-error-rgb), 0.15);
  color: var(--color-error);
}

/* Battery Level Indicator */
.battery-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.battery-bar {
  width: 60px;
  height: 8px;
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.battery-fill {
  height: 100%;
  transition: width var(--duration-normal) var(--ease-standard);
}

.battery-fill--high {
  background-color: var(--color-success);
}

.battery-fill--medium {
  background-color: var(--color-warning);
}

.battery-fill--low {
  background-color: var(--color-error);
}

.battery-text {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  min-width: 32px;
}

/* Device Actions */
.device-actions {
  display: flex;
  gap: var(--space-8);
}

.action-btn {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-standard);
}

.action-btn--assign {
  background-color: var(--color-primary);
  color: var(--color-btn-primary-text);
}

.action-btn--assign:hover {
  background-color: var(--color-primary-hover);
}

.action-btn--maintenance {
  background-color: var(--color-warning);
  color: var(--color-white);
}

.action-btn--maintenance:hover {
  opacity: 0.8;
}

.action-btn--details {
  background-color: var(--color-secondary);
  color: var(--color-text);
}

.action-btn--details:hover {
  background-color: var(--color-secondary-hover);
}

/* Pilgrim Controls - Enhanced */
.pilgrim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-bottom: var(--space-32);
  padding: var(--space-20);
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.pilgrim-controls .btn {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-width: 150px;
  justify-content: center;
  font-weight: var(--font-weight-medium);
  transition: all var(--duration-normal) var(--ease-standard);
}

.pilgrim-controls .btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Enhanced button icons */
.pilgrim-controls .btn::before {
  font-size: var(--font-size-lg);
  margin-right: var(--space-4);
}

/* Responsive controls */
@media (max-width: 768px) {
  .pilgrim-controls {
    flex-direction: column;
  }
  
  .pilgrim-controls .btn {
    min-width: auto;
    width: 100%;
  }
}

/* Smart Filter & Search System */
.pilgrim-filters {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  margin-bottom: var(--space-32);
  box-shadow: var(--shadow-sm);
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
}

/* Search Container */
.search-container {
  position: relative;
  max-width: 400px;
}

.search-container .form-input {
  padding-right: var(--space-40);
  font-size: var(--font-size-base);
}

.search-icon {
  position: absolute;
  right: var(--space-12);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
  pointer-events: none;
}

/* Filter Buttons */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-16);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--duration-normal) var(--ease-standard);
  cursor: pointer;
}

.filter-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.filter-btn--active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.filter-btn--safe:hover,
.filter-btn--safe.filter-btn--active {
  background: var(--color-teal-500);
  border-color: var(--color-teal-500);
  color: white;
}

.filter-btn--warning:hover,
.filter-btn--warning.filter-btn--active {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: white;
}

.filter-btn--emergency:hover,
.filter-btn--emergency.filter-btn--active {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
  animation: pulse-border 2s infinite;
}

/* Region Filters */
.region-filters {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.region-filters .form-select {
  min-width: 200px;
}

.btn--sm {
  padding: var(--space-6) var(--space-12);
  font-size: var(--font-size-sm);
}

/* Pulse animation for emergency filter */
@keyframes pulse-border {
  0% { border-color: var(--color-error); }
  50% { border-color: rgba(239, 68, 68, 0.5); }
  100% { border-color: var(--color-error); }
}

/* Filter responsive design */
@media (max-width: 768px) {
  .filter-section {
    gap: var(--space-16);
  }
  
  .filter-buttons {
    justify-content: space-between;
  }
  
  .filter-btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  
  .region-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .region-filters .form-select {
    min-width: auto;
  }
}

.pilgrim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-24);
  margin-bottom: var(--space-32);
}

/* Enhanced Pilgrim Cards */
.pilgrim-card {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-standard);
  position: relative;
  overflow: hidden;
}

.pilgrim-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

/* Status indicator stripe */
.pilgrim-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--color-teal-500);
}

.pilgrim-card[data-status="warning"]::before {
  background: var(--color-warning);
}

.pilgrim-card[data-status="emergency"]::before {
  background: var(--color-error);
  animation: pulse 2s infinite;
}

.pilgrim-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-16);
  gap: var(--space-12);
}

.pilgrim-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  margin: 0;
  line-height: var(--line-height-tight);
}

/* Enhanced pilgrim card layout */
.pilgrim-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-16);
  gap: var(--space-12);
}

.pilgrim-card__name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  margin: 0;
  line-height: var(--line-height-tight);
}

.pilgrim-card__details {
  display: grid;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

.detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--color-card-border-inner);
}

.detail:last-child {
  border-bottom: none;
}

.detail__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.detail__value {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  text-align: right;
}

/* Enhanced status badges */
.pilgrim-status,
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.status--success {
  background: linear-gradient(135deg, var(--color-teal-500) 0%, var(--color-teal-600) 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.status--warning {
  background: linear-gradient(135deg, var(--color-warning) 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.status--error,
.status--emergency {
  background: linear-gradient(135deg, var(--color-error) 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
  animation: pulse-glow 2s infinite;
}

/* Battery status styling */
.battery--high {
  color: var(--color-teal-600);
  font-weight: var(--font-weight-semibold);
}

.battery--medium {
  color: var(--color-warning);
  font-weight: var(--font-weight-semibold);
}

.battery--low {
  color: var(--color-error);
  font-weight: var(--font-weight-semibold);
}

/* Pilgrim card actions */
.pilgrim-card__actions {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-16);
  padding-top: var(--space-16);
  border-top: 1px solid var(--color-card-border-inner);
}

.pilgrim-card__actions .btn {
  flex: 1;
  justify-content: center;
  min-height: 36px;
}

/* Responsive pilgrim cards */
@media (max-width: 768px) {
  .pilgrim-grid {
    grid-template-columns: 1fr;
    gap: var(--space-16);
  }
  
  .pilgrim-card {
    padding: var(--space-16);
  }
  
  .pilgrim-card__actions {
    flex-direction: column;
  }
  
  .pilgrim-card__actions .btn {
    width: 100%;
  }
}

/* Pulse animations */
@keyframes pulse-glow {
  0% { box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
  50% { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4); }
  100% { box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2); }
}

/* Enhanced Map Controls */
.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-20);
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--color-card-border);
}

.map-header h3 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-size-xl);
}

.map-stats {
  display: flex;
  gap: var(--space-16);
  align-items: center;
}

.map-stat {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  background: var(--color-background);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-card-border);
}

.map-controls-enhanced {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-16);
  margin-bottom: var(--space-20);
  padding: var(--space-16);
  background: var(--color-background);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
}

.map-controls-group {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.map-view-controls {
  display: flex;
  gap: var(--space-8);
  align-items: center;
}

.map-view-controls .form-select {
  min-width: 160px;
}

/* Enhanced Map Container */
.map-container {
  position: relative;
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-card-border);
  background: var(--color-surface);
}

.map-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-card-border);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-16);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Map Popup Enhancements */
.map-popup {
  padding: var(--space-12);
  min-width: 200px;
}

.map-popup h4 {
  margin: 0 0 var(--space-8) 0;
  color: var(--color-text);
  font-size: var(--font-size-base);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.map-popup p {
  margin: var(--space-4) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.map-popup .btn {
  margin-top: var(--space-8);
  width: 100%;
}

/* Map responsive design */
@media (max-width: 768px) {
  .map-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-12);
  }
  
  .map-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-8);
  }
  
  .map-controls-enhanced {
    flex-direction: column;
    align-items: stretch;
  }
  
  .map-controls-group {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .map-view-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .map-view-controls .form-select {
    min-width: auto;
    width: 100%;
  }
  
  .map-container {
    height: 350px;
  }
}

/* Map-Centric Dashboard Layout */
.map-centric-dashboard {
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
}

/* Compact Stats Bar */
.compact-stats-bar {
  display: flex;
  justify-content: space-around;
  padding: var(--space-12);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--color-card-border);
  gap: var(--space-8);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  padding: var(--space-8);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-standard);
}

.stat-item:hover {
  background: var(--color-background);
  transform: translateY(-1px);
}

.stat-item.safe:hover {
  background: rgba(16, 185, 129, 0.1);
}

.stat-item.warning:hover {
  background: rgba(245, 158, 11, 0.1);
}

.stat-item.emergency:hover {
  background: rgba(239, 68, 68, 0.1);
}

.stat-count {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.stat-item.safe .stat-count {
  color: var(--color-teal-600);
}

.stat-item.warning .stat-count {
  color: var(--color-warning);
}

.stat-item.emergency .stat-count {
  color: var(--color-error);
  animation: pulse 2s infinite;
}

.stat-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* Compact Controls */
.compact-controls {
  display: flex;
  gap: var(--space-16);
  padding: var(--space-12);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-card-border);
  flex-wrap: wrap;
  align-items: center;
}

.search-control {
  flex: 1;
  min-width: 200px;
}

.search-input {
  width: 100%;
  padding: var(--space-6) var(--space-12);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  background: var(--color-background);
  transition: all var(--duration-normal) var(--ease-standard);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.filter-controls, .map-controls {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}

.filter-btn, .control-btn {
  padding: var(--space-6) var(--space-12);
  border: 1px solid var(--color-card-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  white-space: nowrap;
}

.filter-btn:hover, .control-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.filter-btn.emergency.active,
.filter-btn.emergency:hover {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
}

.filter-btn.warning.active,
.filter-btn.warning:hover {
  background: var(--color-warning);
  border-color: var(--color-warning);
  color: white;
}

.filter-btn.battery.active,
.filter-btn.battery:hover {
  background: var(--color-brown-500);
  border-color: var(--color-brown-500);
  color: white;
}

/* Full-Screen Map Container */
.full-map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
}

.enhanced-map {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* Map Legend */
.map-legend {
  position: absolute;
  top: var(--space-16);
  right: var(--space-16);
  background: white;
  padding: var(--space-16);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: var(--font-size-xs);
  z-index: 1000;
  min-width: 140px;
}

.map-legend h5 {
  margin: 0 0 var(--space-8) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-6);
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}

.legend-marker.safe {
  background: var(--color-teal-500);
}

.legend-marker.warning {
  background: var(--color-warning);
}

.legend-marker.emergency {
  background: var(--color-error);
}

.legend-marker.low-battery {
  background: var(--color-brown-500);
}

/* Connection Status Overlay */
.connection-overlay {
  position: absolute;
  top: var(--space-16);
  left: var(--space-16);
  z-index: 1000;
}

.connection-status-compact {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  background: white;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-error);
  animation: pulse 2s infinite;
}

.status-dot.online {
  background: var(--color-teal-500);
  animation: none;
}

/* Emergency Alert Overlay */
.emergency-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  max-width: 400px;
  width: 90%;
}

.emergency-alert {
  background: white;
  border: 2px solid var(--color-error);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: emergencyPulse 1s ease-in-out;
}

.alert-header {
  background: var(--color-error);
  color: white;
  padding: var(--space-12);
  font-weight: var(--font-weight-bold);
  text-align: center;
}

.alert-close {
  position: absolute;
  top: var(--space-8);
  right: var(--space-12);
  background: none;
  border: none;
  color: white;
  font-size: var(--font-size-xl);
  cursor: pointer;
  line-height: 1;
}

/* Quick Access Panel */
.quick-access-panel {
  position: absolute;
  bottom: var(--space-16);
  left: var(--space-16);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 300px;
  transition: all var(--duration-normal) var(--ease-standard);
  z-index: 1000;
}

.quick-access-panel.collapsed .quick-list {
  display: none;
}

.panel-toggle {
  width: 100%;
  padding: var(--space-8) var(--space-12);
  border: none;
  background: var(--color-teal-500);
  color: white;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--duration-normal) var(--ease-standard);
}

.panel-toggle:hover {
  background: var(--color-teal-600);
}

.quick-list {
  padding: var(--space-12);
  max-height: 300px;
  overflow-y: auto;
}

/* Enhanced Popup Styling */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg) !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.map-popup {
  min-width: 280px;
  font-family: var(--font-family-base);
}

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

.popup-header h4 {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.status-badge {
  font-size: var(--font-size-xs);
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.popup-header.aman .status-badge {
  background: var(--color-teal-500);
  color: white;
}

.popup-header.peringatan .status-badge {
  background: var(--color-warning);
  color: white;
}

.popup-header.darurat .status-badge {
  background: var(--color-error);
  color: white;
  animation: pulse 2s infinite;
}

.popup-body {
  padding: var(--space-12);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-8);
  font-size: var(--font-size-sm);
}

.info-row:last-child {
  margin-bottom: 0;
}

.info-row .label {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

.info-row .value {
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
  text-align: right;
}

.info-row .value.critical {
  color: var(--color-error);
  font-weight: var(--font-weight-bold);
}

.popup-actions {
  padding: var(--space-12);
  background: var(--color-background);
  border-top: 1px solid var(--color-card-border);
  display: flex;
  gap: var(--space-8);
}

.btn-popup {
  flex: 1;
  padding: var(--space-6) var(--space-12);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
}

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

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

.btn-popup.emergency {
  background: var(--color-error);
  color: white;
}

.btn-popup.emergency:hover {
  background: var(--color-error);
  transform: scale(1.02);
}

/* Animations */
@keyframes emergencyPulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .compact-controls {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-8);
  }
  
  .filter-controls, .map-controls {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .map-legend {
    top: auto;
    bottom: 100px;
    right: var(--space-12);
    font-size: var(--font-size-xs);
    padding: var(--space-12);
  }
  
  .quick-access-panel {
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);
    bottom: var(--space-12);
  }
  
  .emergency-alert {
    max-width: 90vw;
  }
  
  .map-popup {
    min-width: 260px;
  }
  
  .compact-stats-bar {
    gap: var(--space-4);
    padding: var(--space-8);
  }
  
  .stat-item {
    min-width: 60px;
    padding: var(--space-4);
  }
  
  .stat-count {
    font-size: var(--font-size-lg);
  }
  
  .stat-label {
    font-size: 0.6rem;
  }
}

.pilgrim-info p {
  margin: var(--space-4) 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Seat Block Styles */
.seat-block-list {
  display: grid;
  gap: var(--space-20);
}

.seat-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-16);
}

.seat-block-ref {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lg);
  color: var(--color-primary);
}

.seat-block-details p {
  margin: var(--space-8) 0;
}

/* Client Grid */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-20);
}

/* Payment Stats */
.payment-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-20);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-card h3 {
  font-size: var(--font-size-3xl);
  color: var(--color-primary);
  margin-bottom: var(--space-8);
}

/* Enhanced Statistics Bar - Pilgrim Tracking */
.pilgrim-stats {
  margin-bottom: var(--space-32);
}

.stat-card--safe {
  border-left: 4px solid var(--color-teal-500);
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.stat-card--safe .card-icon {
  color: var(--color-teal-500);
}

.stat-card--safe .card-number {
  color: var(--color-teal-600);
}

.stat-card--warning {
  border-left: 4px solid var(--color-warning);
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.stat-card--warning .card-icon {
  color: var(--color-warning);
}

.stat-card--warning .card-number {
  color: var(--color-warning);
}

.stat-card--emergency {
  border-left: 4px solid var(--color-error);
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(239, 68, 68, 0.05) 100%);
  box-shadow: var(--shadow-md);
}

.stat-card--emergency .card-icon {
  color: var(--color-error);
  animation: pulse 2s infinite;
}

.stat-card--emergency .card-number {
  color: var(--color-error);
  font-weight: var(--font-weight-bold);
}

.stat-card--info {
  border-left: 4px solid var(--color-brown-500);
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(120, 113, 108, 0.05) 100%);
}

.stat-card--info .card-icon {
  color: var(--color-brown-500);
}

.stat-card--info .card-number {
  color: var(--color-brown-600);
}

/* Pulse animation for emergency cards */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* WhatsApp Styles */
.whatsapp-content {
  display: grid;
  gap: var(--space-20);
}

.message-templates {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
}

.message-templates ul {
  list-style: none;
  padding: 0;
  margin: var(--space-12) 0 0 0;
}

.message-templates li {
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--color-card-border-inner);
}

.message-templates li:last-child {
  border-bottom: none;
}

/* Alert Styles */
.dashboard-alerts {
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-20);
}

.dashboard-alerts h3 {
  margin-bottom: var(--space-16);
  color: var(--color-error);
}

.alert-items {
  display: grid;
  gap: var(--space-12);
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-12);
  background-color: rgba(var(--color-error-rgb), 0.08);
  border: 1px solid rgba(var(--color-error-rgb), 0.2);
  border-radius: var(--radius-md);
}

.alert-message {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.alert-icon {
  font-size: var(--font-size-lg);
}

.alert-time {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.alert-empty {
  text-align: center;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
}

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

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: var(--space-4);
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-20);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-12);
  padding: var(--space-20);
  border-top: 1px solid var(--color-border);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.full-width {
  grid-column: 1 / -1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-role-badge {
    position: relative;
    top: auto;
    right: auto;
    margin: var(--space-16);
  }
  
  .nav-menu {
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .nav-item {
    padding: var(--space-8) var(--space-12);
    font-size: var(--font-size-xs);
  }
  
  .nav-label {
    display: none;
  }
  
  .module-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .analytics-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .device-controls {
    flex-direction: column;
    gap: var(--space-12);
  }
  
  .search-filter-group {
    flex-wrap: wrap;
  }
  
  .device-table-container {
    overflow-x: auto;
  }
  
  .device-table {
    min-width: 800px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .bulk-ops-grid {
    grid-template-columns: 1fr;
  }
  
  .user-mgmt-grid {
    grid-template-columns: 1fr;
  }
  
  .bulk-controls {
    flex-direction: column;
  }
  
  .checkbox-group label {
    font-size: var(--font-size-sm);
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: var(--space-16);
  }
  
  .header-content {
    padding: var(--space-12) var(--space-16);
  }
  
  .header-brand h1 {
    font-size: var(--font-size-xl);
  }
  
  .header-controls {
    flex-direction: column;
    gap: var(--space-8);
  }
  
  .upload-area {
    padding: var(--space-24);
  }
  
  .upload-icon {
    font-size: 2rem;
  }
}

/* API Status Indicator Styles */
.api-status {
  margin-left: var(--space-8);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all 0.3s ease;
}

.api-status.status-mock {
  background-color: rgba(var(--color-orange-400-rgb), 0.1);
  color: var(--color-orange-500);
  border: 1px solid rgba(var(--color-orange-400-rgb), 0.3);
}

.api-status.status-live {
  background-color: rgba(34, 197, 94, 0.1);
  color: rgb(22, 163, 74);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.api-status.status-error {
  background-color: rgba(var(--color-red-400-rgb), 0.1);
  color: var(--color-red-500);
  border: 1px solid rgba(var(--color-red-400-rgb), 0.3);
}

/* Leaflet Map Customizations */
.mosque-icon {
  background: transparent !important;
  border: none !important;
  text-align: center;
  line-height: 30px;
  font-size: 18px;
}

.pilgrim-marker {
  background: transparent !important;
  border: none !important;
}

/* Map container adjustments */
#pilgrim-map {
  position: relative;
  z-index: 1;
}

.leaflet-popup-content {
  margin: 8px 12px !important;
  line-height: 1.4;
}

.leaflet-popup-content h4 {
  color: var(--color-text) !important;
  font-size: 14px !important;
}

.leaflet-control-attribution {
  font-size: 10px !important;
}
