/* ============================================
   MyNum Design Tokens — 2026 Design System
   ============================================ */

:root {
  /* === Primary Gradient === */
  --color-primary: #667eea;
  --color-primary-dark: #764ba2;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-primary-hover: linear-gradient(135deg, #7b8ff0 0%, #8a5db5 100%);

  /* === Accent Colors === */
  --color-accent-gold: #f59e0b;
  --color-accent-gold-dark: #d97706;
  --color-accent-warm: #fda085;
  --gradient-gold: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);

  /* === Semantic Colors === */
  --color-success: #059669;
  --color-success-light: #d1fae5;
  --color-error: #dc2626;
  --color-error-light: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-info: #3b82f6;

  /* === Background Colors === */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-tertiary: #f1f5f9;
  --color-bg-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --color-bg-card: #ffffff;
  --color-bg-card-hover: #f8fafc;
  --color-bg-input: #ffffff;
  --color-bg-nav: rgba(255, 255, 255, 0.95);
  --color-bg-footer: #1e293b;

  /* === Text Colors === */
  --color-text-primary: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;
  --color-text-link: #667eea;

  /* === Border Colors === */
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-border-hover: rgba(102, 126, 234, 0.3);
  --color-border-focus: #667eea;

  /* === Shadow System === */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 20px 60px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.15);

  /* === Typography === */
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'DM Mono', 'Fira Code', 'Courier New', monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;
  --font-size-hero: clamp(2.5rem, 6vw, 4rem);

  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* === Spacing === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* === Border Radius === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 50px;
  --radius-circle: 50%;

  /* === Transitions === */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* === Z-Index Scale === */
  --z-dropdown: 100;
  --z-sticky: 500;
  --z-nav: 1000;
  --z-modal: 2000;
  --z-toast: 3000;
}

/* ============================================
   Dark Mode
   ============================================ */
[data-theme="dark"] {
  --color-bg-primary: #0f172a;
  --color-bg-secondary: #1e293b;
  --color-bg-tertiary: #334155;
  --color-bg-card: #1e293b;
  --color-bg-card-hover: #334155;
  --color-bg-input: #1e293b;
  --color-bg-nav: rgba(15, 23, 42, 0.95);
  --color-bg-footer: #0f172a;

  --color-text-primary: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-link: #818cf8;

  --color-border: #334155;
  --color-border-light: #1e293b;
  --color-border-hover: rgba(129, 140, 248, 0.4);
  --color-border-focus: #818cf8;

  --shadow-sm: 0 1px 3px 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 20px 60px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.2);

  --color-success-light: rgba(5, 150, 105, 0.2);
  --color-error-light: rgba(220, 38, 38, 0.2);
  --color-warning-light: rgba(245, 158, 11, 0.2);
}

/* ============================================
   Base Resets using tokens
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  line-height: var(--leading-normal);
  /* Safety net against accidental horizontal scroll on mobile (e.g. a card
     whose border/padding pushes it a few px past the viewport). */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
}

/* ============================================
   Dark Mode — Force Override Hardcoded Colors
   Fixes dark text on dark background problem
   ============================================ */
[data-theme="dark"] {
  /* Override ALL inline hardcoded dark text colors */
  color: var(--color-text-primary);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] a,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] label,
[data-theme="dark"] div {
  color: inherit;
}

/* Specific overrides for hardcoded colors used across pages */
[data-theme="dark"] [style*="color: #2d3748"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color: #1a1a2e"],
[data-theme="dark"] [style*="color: #4a5568"],
[data-theme="dark"] [style*="color: #2d3436"],
[data-theme="dark"] [style*="color: #1a202c"],
[data-theme="dark"] [style*="color: rgb(45"],
[data-theme="dark"] [style*="color: rgb(26"],
[data-theme="dark"] [style*="color: rgb(30"] {
  color: #f1f5f9 !important;
}

[data-theme="dark"] [style*="color: #718096"],
[data-theme="dark"] [style*="color: #64748b"],
[data-theme="dark"] [style*="color: #94a3b8"],
[data-theme="dark"] [style*="color: #4a5568"],
[data-theme="dark"] [style*="color: #a0aec0"] {
  color: #94a3b8 !important;
}

/* Fix backgrounds that become invisible in dark mode */
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background-color: #fff"] {
  background: var(--color-bg-secondary) !important;
}

[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background: #f7fafc"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background: #f5f7fa"],
[data-theme="dark"] [style*="background: linear-gradient(135deg, #f5f7fa"],
[data-theme="dark"] [style*="background: linear-gradient(135deg, #f8fafc"] {
  background: var(--color-bg-tertiary) !important;
}

/* Fix section backgrounds */
[data-theme="dark"] section[style*="background: white"],
[data-theme="dark"] section[style*="background: var(--color-bg-primary, white)"] {
  background: var(--color-bg-primary) !important;
}

/* Fix borders */
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border-color: #e2e8f0"],
[data-theme="dark"] [style*="border: 2px solid #e2e8f0"] {
  border-color: var(--color-border) !important;
}

/* Fix input fields */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--color-bg-input) !important;
  color: var(--color-text-primary) !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--color-text-muted) !important;
}

/* Fix cards and containers */
[data-theme="dark"] .service-card,
[data-theme="dark"] .order-card,
[data-theme="dark"] .faq-card,
[data-theme="dark"] .testimonial-card,
[data-theme="dark"] .quick-form {
  background: var(--color-bg-card) !important;
  border-color: var(--color-border) !important;
  color: var(--color-text-primary) !important;
}

/* Fix nav in dark mode */
[data-theme="dark"] .navigation,
[data-theme="dark"] nav[style*="background: rgba(255, 255, 255"] {
  background: var(--color-bg-nav) !important;
  border-color: var(--color-border) !important;
}

[data-theme="dark"] .nav-link,
[data-theme="dark"] .nav-button {
  color: var(--color-text-primary) !important;
}

/* Fix footer */
[data-theme="dark"] footer {
  background: var(--color-bg-footer) !important;
}

/* Fix gradient text — keep it visible */
[data-theme="dark"] [style*="-webkit-text-fill-color: transparent"] {
  -webkit-text-fill-color: transparent !important;
}

/* Fix checkboxes and labels */
[data-theme="dark"] .checkbox-label,
[data-theme="dark"] .checkbox-container label,
[data-theme="dark"] .checkbox-group label {
  color: var(--color-text-secondary) !important;
}

/* Fix GDPR/consent sections */
[data-theme="dark"] .gdpr-section {
  background: var(--color-bg-tertiary) !important;
  border-color: var(--color-border) !important;
}
[data-theme="dark"] .gdpr-section .gdpr-title {
  color: var(--color-text-primary) !important;
}
[data-theme="dark"] .gdpr-section label {
  color: var(--color-text-secondary) !important;
}
[data-theme="dark"] input[type="checkbox"] {
  accent-color: var(--color-primary);
}

/* Fix helper/note text */
[data-theme="dark"] .form-note,
[data-theme="dark"] .helper-text,
[data-theme="dark"] .supporting-text {
  color: var(--color-text-muted) !important;
}

/* Fix select option dropdowns (browser native) */
[data-theme="dark"] select option {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* Fix box shadows for dark mode depth */
[data-theme="dark"] [style*="box-shadow: 0"] {
  box-shadow: var(--shadow-card) !important;
}

/* ============================================
   Scroll Animation Classes
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}
.reveal-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.stagger-children.visible > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.08s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.16s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.24s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.32s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.40s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.48s; opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(8) { transition-delay: 0.56s; opacity: 1; transform: translateY(0); }

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-left, .reveal-right, .reveal-scale,
  .stagger-children > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

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

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

/* ============================================
   Dark Mode Toggle Button
   ============================================ */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--color-text-secondary);
  transition: all var(--transition-base);
}
.theme-toggle:hover {
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .icon-moon { display: inline; }

/* ============================================
   Native CSS Scroll Animations (2026)
   Progressive enhancement — falls back to JS
   ============================================ */
@supports (animation-timeline: view()) {
  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    transition: none;
  }
  .reveal {
    animation: revealUp linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  .reveal-left {
    animation: revealLeft linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  .reveal-right {
    animation: revealRight linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  .reveal-scale {
    animation: revealScale linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  @keyframes revealUp {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @keyframes revealLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes revealRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
  }
  @keyframes revealScale {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
  }
}

/* ============================================
   Scroll Progress Bar
   ============================================ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: var(--gradient-primary);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
}
@supports (animation-timeline: scroll()) {
  .scroll-progress {
    animation: progressGrow linear;
    animation-timeline: scroll();
  }
  @keyframes progressGrow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

/* ============================================
   Mobile Bottom Navigation
   ============================================ */
.bottom-nav {
  display: none;
}
@media (max-width: 767px) {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--color-bg-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--color-border);
    z-index: var(--z-nav);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }
  [data-theme="dark"] .bottom-nav {
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    font-size: 10px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    gap: 2px;
    transition: color var(--transition-fast);
  }
  .bottom-nav a.active,
  .bottom-nav a:hover {
    color: var(--color-primary);
  }
  .bottom-nav svg {
    width: 22px;
    height: 22px;
  }
  /* Add bottom padding to body so content isn't hidden by nav */
  body { padding-bottom: 64px; }
}

/* ============================================
   Card Hover Effects (unified)
   ============================================ */
.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
/* Gradient border reveal on hover */
.card-glow {
  position: relative;
  overflow: hidden;
}
.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
}
.card-glow:hover::before {
  opacity: 1;
}
/* Inner background to show the glow as border */
.card-glow::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  background: var(--color-bg-card);
  z-index: -1;
}

/* ============================================
   Testimonial Auto-Scroll Ticker
   ============================================ */
.testimonial-ticker {
  overflow: hidden;
  position: relative;
  width: 100%;
}
.testimonial-ticker::before,
.testimonial-ticker::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}
.testimonial-ticker::before {
  left: 0;
  background: linear-gradient(to right, var(--color-bg-secondary), transparent);
}
.testimonial-ticker::after {
  right: 0;
  background: linear-gradient(to left, var(--color-bg-secondary), transparent);
}
.testimonial-track {
  display: flex;
  gap: 24px;
  width: max-content;
  animation: tickerScroll 40s linear infinite;
}
.testimonial-track:hover {
  animation-play-state: paused;
}
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.testimonial-card {
  flex-shrink: 0;
  width: 360px;
  padding: 28px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}
@media (max-width: 767px) {
  .testimonial-card { width: 300px; padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .testimonial-track {
    animation: none;
    flex-wrap: wrap;
    width: auto;
    justify-content: center;
  }
}

/* ============================================
   Tablet Breakpoint (768-1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
  .services-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ============================================
   Sticky Order Summary (Payment Page)
   ============================================ */
@media (min-width: 768px) {
  .order-summary-sticky {
    position: sticky;
    top: 100px;
    z-index: 10;
  }
}
@media (max-width: 767px) {
  .order-summary-mobile-bar {
    position: sticky;
    top: 64px;
    z-index: 50;
    background: var(--color-bg-nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
  }
}

/* ============================================
   Footer 4-column responsive
   ============================================ */
@media (max-width: 767px) {
  footer [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 24px !important;
  }
}
@media (max-width: 480px) {
  footer [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

/* About section cards responsive */
@media (max-width: 767px) {
  #about [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}

/* Daily promo section responsive */
@media (max-width: 767px) {
  section [style*="grid-template-columns: 1fr 1fr"][style*="gap: 48px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
}
