/*
 * MatchMovie - iOS App Design System
 * Matching exact colors from iOS app (DesignSystem.swift)
 * Optimized for performance and accessibility
 */

/* ============================================
   CSS Variables - iOS App Color Scheme
   ============================================ */
:root {
  /* iOS App Colors - Exact Match from DesignSystem.swift */
  --primary: #10B981; /* Professional emerald green */
  --secondary: #6B38FB; /* Rich purple */
  --accent: #00E5FF; /* Bright cyan for highlights */

  /* Background colors */
  --background-dark: #121212; /* Near black */
  --background-medium: #1E1E24; /* Dark charcoal */
  --background-primary: #121212;
  --background-secondary: #1E1E24;
  --background-tertiary: #222228;
  --background-elevated: #222228;

  /* Text colors */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  --text-muted: rgba(255, 255, 255, 0.5);

  /* State colors */
  --error: #FF4C54; /* Vibrant red */
  --success: #4AE3B5; /* Mint green */
  --warning: #FFCC33; /* Bright amber */

  /* Card and UI elements */
  --card-background: rgba(34, 34, 40, 0.9); /* #222228 with transparency */
  --card-background-alt: #2A2A32; /* Slightly lighter */
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: rgba(0, 0, 0, 0.5);

  /* Overlay */
  --overlay: rgba(0, 0, 0, 0.3);
  --separator: rgba(255, 255, 255, 0.1);

  /* iOS Spacing Scale (4pt grid) */
  --spacing-2xs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 20px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
  --spacing-3xl: 40px;
  --spacing-4xl: 48px;
  --spacing-5xl: 64px;

  /* Typography Scale */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --font-system-rounded: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "SF Pro Text", system-ui, sans-serif;

  /* Font Sizes */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;
  --text-4xl: 34px;
  --text-5xl: 40px;
  --text-6xl: 48px;
  --text-7xl: 56px;

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Font Weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-primary: 0 6px 20px rgba(16, 185, 129, 0.25);

  /* Animations - 60fps optimized */
  --ease-ios: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-spring: cubic-bezier(0.5, 1.5, 0.6, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 400;
  --z-popover: 500;

  /* Backdrop Blur */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 24px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  font-size: 16px;
  line-height: var(--leading-normal);
}

body {
  font-family: var(--font-system);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--background-dark) 0%, var(--background-medium) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin: 0;
}

h1 {
  font-size: clamp(var(--text-5xl), 6vw, var(--text-7xl));
  font-weight: var(--weight-heavy);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(var(--text-4xl), 4vw, var(--text-5xl));
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(var(--text-2xl), 3vw, var(--text-3xl));
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--duration-fast) var(--ease-ios);
}

a:hover {
  opacity: 0.8;
}

a:active {
  opacity: 0.6;
}

strong {
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ============================================
   Header & Navigation
   ============================================ */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  background: rgba(18, 18, 18, 0.85);
  backdrop-filter: saturate(180%) blur(var(--blur-lg));
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur-lg));
  border-bottom: 1px solid var(--separator);
  transition: all var(--duration-normal) var(--ease-ios);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-decoration: none;
  z-index: var(--z-fixed);
}

.logo-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  z-index: var(--z-fixed);
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--duration-normal) var(--ease-ios);
  border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Navigation Menu */
nav ul {
  list-style: none;
  display: flex;
  gap: var(--spacing-2xl);
  align-items: center;
  margin: 0;
}

nav ul li {
  margin: 0;
}

nav a {
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  padding: var(--spacing-xs) 0;
  position: relative;
  transition: color var(--duration-fast) var(--ease-ios);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--duration-normal) var(--ease-ios);
  border-radius: 2px;
}

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

nav a:hover::after {
  transform: scaleX(1);
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  nav ul {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 60px);
    flex-direction: column;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(var(--blur-lg));
    padding: var(--spacing-2xl) var(--spacing-xl);
    gap: var(--spacing-lg);
    align-items: flex-start;
    transition: right var(--duration-slow) var(--ease-ios);
    border-left: 1px solid var(--separator);
    box-shadow: var(--shadow-xl);
  }

  nav ul.active {
    right: 0;
  }

  nav ul li {
    width: 100%;
  }

  nav a {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--text-lg);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-ios);
  }

  nav a:hover {
    background: var(--card-background);
  }

  nav a::after {
    display: none;
  }
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(60px + var(--spacing-5xl)) var(--spacing-xl) var(--spacing-5xl);
  background:
    radial-gradient(circle at 30% 20%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(107, 56, 251, 0.15) 0%, transparent 50%),
    linear-gradient(180deg, var(--background-dark) 0%, var(--background-medium) 100%);
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: 780px;
  position: relative;
  z-index: var(--z-base);
  animation: fadeInUp var(--duration-slow) var(--ease-ios);
}

.hero h1 {
  margin-bottom: var(--spacing-xl);
}

.hero p {
  font-size: clamp(var(--text-lg), 2vw, var(--text-xl));
  margin-bottom: var(--spacing-3xl);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================
   Buttons
   ============================================ */
.cta-buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-2xl);
  font-family: var(--font-system);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-ios);
  min-height: 52px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
  color: var(--background-dark);
  box-shadow: var(--shadow-primary);
  font-weight: var(--weight-bold);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-primary);
  opacity: 1;
}

.btn-secondary {
  background: var(--card-background);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.1);
  opacity: 1;
}

.btn-secondary:active {
  transform: scale(0.98);
  opacity: 1;
}

/* ============================================
   Sections
   ============================================ */
.section {
  padding: var(--spacing-5xl) var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
}

.section-alt {
  background: rgba(30, 30, 36, 0.5);
  margin: 0;
  max-width: 100%;
  padding: var(--spacing-5xl) var(--spacing-xl);
}

.section h2 {
  text-align: center;
  margin-bottom: var(--spacing-3xl);
}

/* ============================================
   Feature Cards
   ============================================ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--spacing-xl);
  margin-top: var(--spacing-3xl);
}

.feature-card {
  background: var(--card-background);
  padding: var(--spacing-2xl);
  border-radius: var(--radius-xl);
  border: 1px solid var(--card-border);
  transition: all var(--duration-normal) var(--ease-ios);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-ios);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--spacing-lg);
  display: block;
}

.feature-card h3 {
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.feature-card p {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ============================================
   Legal Content
   ============================================ */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: calc(60px + var(--spacing-3xl)) var(--spacing-xl) var(--spacing-5xl);
}

.legal-content h1 {
  margin-bottom: var(--spacing-lg);
}

.legal-content h2 {
  margin-top: var(--spacing-4xl);
  margin-bottom: var(--spacing-lg);
  font-size: var(--text-3xl);
  color: var(--primary);
}

.legal-content h3 {
  margin-top: var(--spacing-2xl);
  margin-bottom: var(--spacing-md);
  font-size: var(--text-xl);
}

.legal-content p,
.legal-content li {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--spacing-md);
}

.legal-content ul,
.legal-content ol {
  margin-left: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

.legal-content li {
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-xs);
}

.last-updated {
  background: var(--card-background);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--primary);
  margin-bottom: var(--spacing-2xl);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.info-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin: var(--spacing-xl) 0;
}

.info-box p {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--text-base);
}

/* ============================================
   Footer
   ============================================ */
footer {
  background: var(--background-medium);
  padding: var(--spacing-4xl) var(--spacing-xl) var(--spacing-2xl);
  border-top: 1px solid var(--separator);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-2xl);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-xl);
}

.footer-links a {
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  transition: color var(--duration-fast) var(--ease-ios);
}

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

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

.copyright p {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--spacing-sm);
}

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

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 667px) {
  :root {
    font-size: 15px;
  }

  .hero {
    padding: calc(60px + var(--spacing-3xl)) var(--spacing-md) var(--spacing-3xl);
  }

  .cta-buttons {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .section {
    padding: var(--spacing-3xl) var(--spacing-md);
  }

  .section-alt {
    padding: var(--spacing-3xl) var(--spacing-md);
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .footer-links {
    flex-direction: column;
    gap: var(--spacing-md);
  }
}

@media (min-width: 668px) and (max-width: 1023px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   Accessibility
   ============================================ */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* ============================================
   Print Styles
   ============================================ */
@media print {
  header,
  footer,
  .cta-buttons,
  nav,
  .menu-toggle {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .legal-content {
    padding-top: var(--spacing-md);
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* ============================================
   Performance Optimizations
   ============================================ */
.hero,
.feature-card,
.btn,
header {
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

::selection {
  background: var(--primary);
  color: var(--background-dark);
}

::-moz-selection {
  background: var(--primary);
  color: var(--background-dark);
}

  .action-box {
      margin: 1.5rem 0;
      padding: 1.5rem;
      background: rgba(16, 185, 129, 0.1);
      border-radius: 12px;
      text-align: center;
  }

  .btn {
      display: inline-block;
      padding: 0.875rem 1.75rem;
      border-radius: 12px;
      font-weight: 600;
      text-decoration: none;
      transition: all 0.3s ease;
  }

  .btn-primary {
      background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
      color: white;
  }

  .btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
  }

  .btn-secondary {
      background: transparent;
      border: 2px solid var(--primary);
      color: var(--primary);
  }

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