/**
 * Dubai Travel Agent - Design System
 * Foundation: Colors, Typography, Spacing, Shadows
 * WCAG 2.1 AA Compliant
 */

:root {
  /* ============================================================================
     COLORS - Semantic tokens, not hex values
     ============================================================================ */

  /* Primary Brand */
  --color-primary: #D4AF37;           /* Gold accent - luxury, premium */
  --color-primary-dark: #B8942F;      /* Darker gold for hover/active */
  --color-primary-light: #E8C855;     /* Lighter gold for backgrounds */

  /* Neutral - Dark theme (professional, travel-focused) */
  --color-bg-primary: #ffffff;        /* Main background */
  --color-bg-secondary: #f8f9fa;      /* Card backgrounds, sections */
  --color-bg-tertiary: #011E47;       /* Dark header/footer */
  --color-bg-quaternary: #1a3a52;     /* Hover states on dark */

  /* Text - Semantic hierarchy */
  --color-text-primary: #1a1a1a;      /* Main text, 4.5:1 contrast */
  --color-text-secondary: #666666;    /* Secondary text, 4.5:1 contrast */
  --color-text-tertiary: #999999;     /* Helper text, 3:1 contrast */
  --color-text-light: #ffffff;        /* Text on dark backgrounds */
  --color-text-muted: #cccccc;        /* Muted text on dark */

  /* Semantic Colors */
  --color-success: #28a745;           /* Confirmations, approved */
  --color-success-light: #d4edda;
  --color-warning: #ffc107;           /* Alerts, cautions */
  --color-warning-light: #fff3cd;
  --color-danger: #dc3545;            /* Errors, destructive */
  --color-danger-light: #f8d7da;
  --color-info: #17a2b8;              /* Information */
  --color-info-light: #d1ecf1;

  /* Borders */
  --color-border: #e0e0e0;            /* Light border */
  --color-border-dark: #d0d0d0;       /* Darker border */
  --color-border-muted: #f0f0f0;      /* Very light border */

  /* ============================================================================
     TYPOGRAPHY - Font family, sizes, weights, line-heights
     ============================================================================ */

  --font-heading: 'Playfair Display', serif;
  --font-body: 'Poppins', sans-serif;

  /* Font Sizes - Consistent scale (1rem = 16px) */
  --font-size-xs: 0.75rem;            /* 12px - small labels */
  --font-size-sm: 0.875rem;           /* 14px - body secondary */
  --font-size-base: 1rem;             /* 16px - body primary */
  --font-size-lg: 1.125rem;           /* 18px - larger body */
  --font-size-xl: 1.5rem;             /* 24px - section headings */
  --font-size-2xl: 2rem;              /* 32px - page headings */
  --font-size-3xl: 2.5rem;            /* 40px - hero headings */
  --font-size-4xl: 3rem;              /* 48px - large hero */

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Line Heights */
  --line-height-tight: 1.2;           /* Headings */
  --line-height-snug: 1.375;          /* Subheadings */
  --line-height-normal: 1.5;          /* Body text */
  --line-height-relaxed: 1.625;       /* Long-form text */

  /* Letter Spacing */
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.05em;
  --letter-spacing-wider: 0.1em;

  /* ============================================================================
     SPACING - Consistent scale (0.5rem = 8px increments)
     ============================================================================ */

  --space-0: 0;
  --space-1: 0.25rem;                 /* 4px */
  --space-2: 0.5rem;                  /* 8px */
  --space-3: 0.75rem;                 /* 12px */
  --space-4: 1rem;                    /* 16px */
  --space-5: 1.25rem;                 /* 20px */
  --space-6: 1.5rem;                  /* 24px */
  --space-8: 2rem;                    /* 32px */
  --space-10: 2.5rem;                 /* 40px */
  --space-12: 3rem;                   /* 48px */
  --space-16: 4rem;                   /* 64px */
  --space-20: 5rem;                   /* 80px */
  --space-24: 6rem;                   /* 96px */

  /* ============================================================================
     LAYOUT - Max widths, grid gaps
     ============================================================================ */

  --max-width-container: 1200px;
  --max-width-narrow: 640px;
  --max-width-wide: 1400px;

  --gap-col: var(--space-4);          /* Column gap */
  --gap-section: var(--space-12);     /* Section vertical spacing */
  --gap-card: var(--space-6);         /* Card padding */

  /* ============================================================================
     SHADOWS - Subtle, hierarchical
     ============================================================================ */

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-elevation: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);

  /* ============================================================================
     BORDERS - Radius, width
     ============================================================================ */

  --radius-sm: 0.25rem;               /* 4px - minimal rounding */
  --radius-md: 0.5rem;                /* 8px - default rounding */
  --radius-lg: 0.75rem;               /* 12px - cards, buttons */
  --radius-xl: 1rem;                  /* 16px - modals, hero sections */
  --radius-full: 9999px;              /* Pill-shaped */

  --border-width: 1px;

  /* ============================================================================
     TRANSITIONS - Timing, easing
     ============================================================================ */

  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;

  --easing-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --easing-ease-out: cubic-bezier(0, 0, 0.2, 1);
  --easing-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  /* ============================================================================
     Z-INDEX - Hierarchical stacking
     ============================================================================ */

  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================================================
   BASE STYLES - Reset and establish baseline
   ============================================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  margin: 0;
  padding: 0;
}

/* ============================================================================
   TYPOGRAPHY - Heading and text hierarchy
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin: 0;
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-3xl);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--font-size-2xl);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-6);
  margin-top: var(--space-8);
}

h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-4);
  margin-top: var(--space-6);
}

h4, h5, h6 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
  margin-top: var(--space-4);
}

/* First heading on page should be h1 */
main h1:first-child {
  margin-top: 0;
}

p {
  margin: 0 0 var(--space-4) 0;
  color: var(--color-text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

small, .text-small {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

/* ============================================================================
   LINKS - Semantic, accessible
   ============================================================================ */

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

a:focus-visible {
  outline-color: var(--color-primary);
}

a:visited {
  color: var(--color-primary-dark);
}

/* ============================================================================
   BUTTONS - Semantic, accessible, interactive
   ============================================================================ */

.btn {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Primary Button */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-light);
}

/* Tertiary/Ghost Button */
.btn-ghost {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

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

/* ============================================================================
   FORMS - Labels, inputs, validation
   ============================================================================ */

label {
  display: block;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

input[type="date"] {
  /* Support date picker styling */
}

input::placeholder {
  color: var(--color-text-tertiary);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================================================
   TABLES - Pricing, comparison
   ============================================================================ */

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

thead {
  background-color: var(--color-bg-secondary);
  border-bottom: 2px solid var(--color-border);
}

th {
  padding: var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
}

td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-muted);
  color: var(--color-text-secondary);
}

tbody tr:hover {
  background-color: var(--color-bg-secondary);
}

/* Responsive table on mobile */
@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ============================================================================
   LISTS - Reset defaults, semantic styling
   ============================================================================ */

ul, ol {
  margin: var(--space-4) 0;
  padding-left: var(--space-6);
  color: var(--color-text-secondary);
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--line-height-relaxed);
}

/* Remove bullets for nav lists */
nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  margin: 0;
}

/* ============================================================================
   UTILITIES - Common patterns
   ============================================================================ */

.container {
  max-width: var(--max-width-container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

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

.text-muted {
  color: var(--color-text-tertiary);
}

.text-light {
  color: var(--color-text-light);
}

.bg-light {
  background-color: var(--color-bg-secondary);
}

.bg-dark {
  background-color: var(--color-bg-tertiary);
}

.border {
  border: 1px solid var(--color-border);
}

.rounded {
  border-radius: var(--radius-md);
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-center {
  align-items: center;
  justify-content: center;
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* ============================================================================
   ACCESSIBILITY - Skip links, screen reader only
   ============================================================================ */

.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;
}

.sr-only-focusable:focus,
.sr-only-focusable:focus-within {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================================================
   FOCUS MANAGEMENT - Visible focus indicators
   ============================================================================ */

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

/* Ensure focus visible on buttons */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
