/* ==========================================================================
   Travel Insight - Global Design System & Variables (CSS3 / Vanilla CSS)
   WCAG 2.2 AA Compliant, Dark & Light Mode, Responsive (320px - 2560px)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette - Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-card: rgba(255, 255, 255, 0.7);
  --border-subtle: #e2e8f0;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --border-highlight: rgba(59, 130, 246, 0.3);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Brand Accents */
  --accent-primary: #2563eb;
  --primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-glow: rgba(37, 99, 235, 0.25);
  --accent-teal: #0d9488;
  --accent-teal-subtle: #f0fdfa;
  --accent-indigo: #6366f1;
  --accent-amber: #d97706;
  --accent-amber-subtle: #fffbeb;
  --accent-rose: #e11d48;
  --accent-rose-subtle: #fff1f2;
  --accent-emerald: #059669;
  --accent-emerald-subtle: #ecfdf5;

  /* Status Colors */
  --badge-alert-bg: #fee2e2;
  --badge-alert-text: #991b1b;
  --badge-alert-border: #f87171;
  --badge-safe-bg: #d1fae5;
  --badge-safe-text: #065f46;
  --badge-safe-border: #34d399;
  --badge-info-bg: #e0f2fe;
  --badge-info-text: #0369a1;
  --badge-info-border: #7dd3fc;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.06), 0 1px 3px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 14px 30px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -3px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 35px -5px rgba(37, 99, 235, 0.28);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Layout */
  --container-max-w: 1400px;
  --header-height: 72px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-elevated: #1a2234;
  --bg-glass: rgba(17, 24, 39, 0.88);
  --bg-glass-card: rgba(26, 34, 52, 0.75);
  --border-subtle: #2d3748;
  --border-color: #2d3748;
  --border-focus: #60a5fa;
  --border-highlight: rgba(96, 165, 250, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --accent-primary: #3b82f6;
  --primary: #3b82f6;
  --accent-primary-hover: #60a5fa;
  --accent-primary-glow: rgba(59, 130, 246, 0.35);

  --badge-alert-bg: rgba(185, 28, 28, 0.25);
  --badge-alert-text: #fca5a5;
  --badge-alert-border: rgba(248, 113, 113, 0.4);

  --badge-safe-bg: rgba(6, 95, 70, 0.25);
  --badge-safe-text: #6ee7b7;
  --badge-safe-border: rgba(52, 211, 153, 0.4);

  --badge-info-bg: rgba(14, 116, 144, 0.25);
  --badge-info-text: #7dd3fc;
  --badge-info-border: rgba(56, 189, 248, 0.4);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px -4px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 40px -5px rgba(59, 130, 246, 0.35);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
  scroll-padding-top: 140px;
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
    scroll-padding-top: 110px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px; /* Naturally emulates the ~80% scaling in 100% mobile view */
    scroll-padding-top: 100px;
  }
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  position: relative;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.15rem; }

p {
  color: var(--text-secondary);
}

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

a:hover {
  text-decoration: underline;
}

/* Keyboard Accessibility Focus Rings (WCAG 2.2 AA) */
:focus-visible {
  outline: 3px solid var(--border-focus) !important;
  outline-offset: 3px !important;
}

/* Button & interactive touch targets min 44px */
button, input, select, textarea, a.btn {
  min-height: 44px;
  font-family: inherit;
}

/* Global App Shell Container */
.app-container {
  width: 100%;
  max-width: var(--container-max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
  flex: 1;
}

@media (max-width: 640px) {
  .app-container {
    padding: 0 0.85rem;
  }
}

@media (max-width: 380px) {
  .app-container {
    padding: 0 0.65rem;
  }
}

/* Top App Bar */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background-color: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: all var(--transition-normal);
}

.top-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.brand-logo svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
  filter: drop-shadow(0 2px 4px var(--accent-primary-glow));
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-teal));
  color: #fff;
  text-transform: uppercase;
  margin-left: 0.25rem;
}

/* Main Navigation Tabs in Header */
.header-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 7px 15px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .nav-tab:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
  background: var(--bg-elevated);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.nav-tab .tab-text-short {
  display: none;
}
.nav-tab .tab-text-full {
  display: inline;
}

/* Responsive Navigation for Tablets & Mobile Screens */
@media (max-width: 768px) {
  .top-header {
    height: auto !important;
    padding: 0.5rem 0 0.55rem;
  }

  .top-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: 0.5rem;
  }

  .header-nav-tabs {
    order: 3;
    width: 100%;
    display: flex !important;
    justify-content: space-between;
    margin-top: 0.2rem;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    text-align: center;
    padding: 8px 8px;
    font-size: 0.82rem;
    min-height: 40px;
    border-radius: var(--radius-full);
  }
}

@media (max-width: 480px) {
  .nav-tab {
    font-size: 0.8rem;
    padding: 7px 6px;
    gap: 0.35rem;
  }

  .nav-tab .tab-text-full {
    display: none;
  }

  .nav-tab .tab-text-short {
    display: inline;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Header utility buttons */
.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Status Indicator Dot */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Responsive Header Enhancements */
@media (max-width: 768px) {
  .header-actions {
    gap: 0.35rem;
  }
  .brand-logo {
    font-size: 1.05rem;
    gap: 0.4rem;
  }
  .brand-logo svg {
    width: 24px;
    height: 24px;
  }
  .brand-badge {
    display: none;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }
}

@media (max-width: 640px) {
  .header-actions {
    gap: 0.25rem;
  }
  .status-pill {
    display: none;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }
  .brand-logo {
    font-size: 0.96rem;
  }
}

@media (max-width: 480px) {
  .status-pill {
    display: none;
  }
  .header-actions {
    gap: 0.2rem;
  }
  .brand-logo {
    font-size: 0.9rem;
    gap: 0.3rem;
  }
  .brand-logo svg {
    width: 22px;
    height: 22px;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.status-dot.pulse {
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* Site Footer */
.app-footer {
  margin-top: 4rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent-primary);
}
