/**
 * Design System CSS Variables
 * iOS-inspired liquid glass morphism
 * Mobile-first, accessible, RTL-ready
 */

:root {
  /* ========================================
     COLORS - Dark Mode (Pure Black)
     ======================================== */

  /* Background */
  --bg-primary: #000000;           /* Pure black */
  --bg-secondary: #0a0a0a;         /* Near black */
  --bg-tertiary: #1a1a1a;          /* Dark gray */

  /* Liquid Glass Morphism */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-hover: rgba(255, 255, 255, 0.2);

  --liquid-glass-bg: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );

  /* Brand Colors (iOS Standard) */
  --brand-primary: #007AFF;        /* iOS blue */
  --brand-secondary: #5856D6;      /* iOS purple */
  --brand-success: #34C759;        /* iOS green */
  --brand-warning: #FF9500;        /* iOS orange */
  --brand-error: #FF3B30;          /* iOS red */

  /* State Colors */
  --state-idle: #8E8E93;           /* iOS gray */
  --state-listening: var(--brand-primary);
  --state-speaking: var(--brand-success);
  --state-thinking: var(--brand-warning);

  /* Text Colors */
  --text-primary: #FFFFFF;         /* Pure white */
  --text-secondary: #AEAEB2;       /* iOS light gray */
  --text-tertiary: #636366;        /* iOS mid gray */
  --text-disabled: #48484A;        /* iOS dark gray */

  /* ========================================
     TYPOGRAPHY - iOS Standard
     ======================================== */

  --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-family-arabic: 'SF Arabic', 'Geeza Pro', 'Arabic UI Text', 'Noto Sans Arabic', sans-serif;

  /* Display (Hero) */
  --text-display: 48px;
  --text-display-weight: 700;
  --text-display-line: 1.1;
  --text-display-spacing: -0.02em;

  /* Title 1 (Page Titles) */
  --text-title-1: 34px;
  --text-title-1-weight: 700;
  --text-title-1-line: 1.2;
  --text-title-1-spacing: -0.015em;

  /* Title 2 (Section Titles) */
  --text-title-2: 28px;
  --text-title-2-weight: 600;
  --text-title-2-line: 1.25;
  --text-title-2-spacing: -0.01em;

  /* Title 3 (Subsections) */
  --text-title-3: 22px;
  --text-title-3-weight: 600;
  --text-title-3-line: 1.3;
  --text-title-3-spacing: 0;

  /* Headline (Cards, Headers) */
  --text-headline: 17px;
  --text-headline-weight: 600;
  --text-headline-line: 1.35;
  --text-headline-spacing: 0;

  /* Body (Primary Text) */
  --text-body: 17px;
  --text-body-weight: 400;
  --text-body-line: 1.47;
  --text-body-spacing: 0;

  /* Callout (Emphasized Body) */
  --text-callout: 16px;
  --text-callout-weight: 400;
  --text-callout-line: 1.38;
  --text-callout-spacing: 0;

  /* Subheadline (Secondary Text) */
  --text-subheadline: 15px;
  --text-subheadline-weight: 400;
  --text-subheadline-line: 1.4;
  --text-subheadline-spacing: 0;

  /* Footnote (Tertiary Text) */
  --text-footnote: 13px;
  --text-footnote-weight: 400;
  --text-footnote-line: 1.38;
  --text-footnote-spacing: 0;

  /* Caption 1 (Small Labels) */
  --text-caption-1: 12px;
  --text-caption-1-weight: 400;
  --text-caption-1-line: 1.33;
  --text-caption-1-spacing: 0;

  /* Caption 2 (Smallest Text) */
  --text-caption-2: 11px;
  --text-caption-2-weight: 400;
  --text-caption-2-line: 1.27;
  --text-caption-2-spacing: 0;

  /* ========================================
     SPACING - iOS Standard (4px increments)
     ======================================== */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ========================================
     SHADOWS - Multi-layer depth
     ======================================== */

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);

  --shadow-md:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.3);

  --shadow-lg:
    0 4px 8px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.2);

  --shadow-xl:
    0 8px 16px rgba(0, 0, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.3);

  --shadow-2xl:
    0 16px 32px rgba(0, 0, 0, 0.6),
    0 8px 16px rgba(0, 0, 0, 0.5),
    0 4px 8px rgba(0, 0, 0, 0.4);

  /* ========================================
     BORDER RADIUS - iOS Standard
     ======================================== */

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* ========================================
     ANIMATION - iOS Easing
     ======================================== */

  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  --duration-instant: 0.1s;
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;

  /* ========================================
     Z-INDEX - Layering
     ======================================== */

  --z-background: -1;
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-fixed: 1200;
  --z-modal-backdrop: 1300;
  --z-modal: 1400;
  --z-popover: 1500;
  --z-tooltip: 1600;
  --z-notification: 2000;
}

/* ========================================
   BASE STYLES
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-body);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-line);
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
}

/* Arabic language support */
[lang="ar"],
[lang="ar"] * {
  font-family: var(--font-family-arabic);
}

/* ========================================
   TOUCH TARGETS - iOS Standard (44px min)
   ======================================== */

button,
a,
input,
select,
textarea,
[role="button"],
[role="link"],
[tabindex]:not([tabindex="-1"]) {
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}

/* ========================================
   FOCUS STYLES - Accessibility
   ======================================== */

:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================
   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: 0;
}

/* ========================================
   RTL SUPPORT
   ======================================== */

[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] body {
  text-align: start;
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-secondary: #d0d0d0;
    --text-tertiary: #a0a0a0;
  }

  button,
  input,
  select,
  textarea {
    border-width: 2px;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@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;
  }
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Mobile: 320px - 767px (default) */

/* Tablet: 768px - 1023px */
@media (min-width: 768px) {
  html {
    font-size: 17px;
  }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  html {
    font-size: 18px;
  }
}

/* ========================================
   SAFE AREA INSETS - iOS Notch/Island
   ======================================== */

@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.no-scroll {
  overflow: hidden;
}

.text-center {
  text-align: center;
}

.text-start {
  text-align: start;
}

.text-end {
  text-align: end;
}
