/* ============================================================
   Market Yatra — Design System
   Tokens · Reset · Typography · Utilities · Dark Mode
   ============================================================ */

/* ─── Google Fonts ───────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;700&display=swap');

@font-face {
  font-family: 'Talina';
  src: local('Talina'), 
       url('../fonts/Talina.woff2') format('woff2'), 
       url('../fonts/Talina.woff') format('woff'), 
       url('../fonts/Talina.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ─── Design Tokens ─────────────────────────── */
:root {
  /* Core Brand */
  --clr-primary:        #1F7A63;
  --clr-primary-dark:   #145A4A;
  --clr-primary-mid:    #196B56;
  --clr-primary-light:  #E0F2EC;
  --clr-primary-glow:   rgba(31,122,99,0.18);
  --clr-primary-ultra:  rgba(31,122,99,0.06);
  --clr-accent:         #1F7A63;
  --clr-accent-light:   #28936F;
  --clr-accent-rgb:     31, 122, 99;
  --clr-purple:         #7C5FD4;
  --clr-purple-light:   #EEE9FB;

  /* Background layers */
  --clr-bg:             #F4F8F6;
  --clr-surface:        #FFFFFF;
  --clr-surface-2:      #F9FBFA;
  --clr-surface-3:      #EAF2EE;
  --clr-surface-glass:  rgba(255,255,255,0.72);
  --clr-glass-border:   rgba(255,255,255,0.45);
  --clr-border:         #DDE8E3;
  --clr-border-strong:  #C8D9D2;

  /* Text */
  --clr-text-primary:   #1A2E27;
  --clr-text-secondary: #4A6B5E;
  --clr-text-muted:     #8AADA0;
  --clr-text-on-dark:   #FFFFFF;
  --clr-text-on-accent: #FFFFFF;

  /* Gold / Premium */
  --clr-gold:           #E6B85C;
  --clr-gold-light:     #FFF5E0;
  --clr-gold-dark:      #B8882A;
  --clr-gold-glow:      rgba(230,184,92,0.22);

  /* Semantic */
  --clr-success:        #1EBE72;
  --clr-success-bg:     #E2F9EE;
  --clr-warning:        #B8882A;
  --clr-warning-bg:     #FFF5E0;
  --clr-error:          #E03E44;
  --clr-error-bg:       #FDECEA;
  --clr-error-glow:     rgba(224,62,68,0.15);
  --clr-info:           #3A9ED6;
  --clr-info-bg:        #E8F4FC;
  --clr-info-glow:      rgba(58,158,214,0.15);
  --clr-coral:          #FF6B4A;
  --clr-coral-light:    #FFF0EC;

  /* Elevation */
  --shadow-xs:    0 1px 3px rgba(0,0,0,0.04);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:    0 20px 50px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.08);
  --shadow-card:  0 2px 8px rgba(31,122,99,0.06), 0 8px 24px rgba(0,0,0,0.05);
  --shadow-hover: 0 6px 20px rgba(31,122,99,0.14), 0 14px 36px rgba(0,0,0,0.08);
  --shadow-float: 0 24px 64px rgba(0,0,0,0.16);
  --shadow-glow:  0 0 32px rgba(31,122,99,0.20);
  --shadow-glow-lg: 0 0 40px rgba(31,122,99,0.4);

  /* Gradients */
  --grad-primary:  linear-gradient(135deg, #145A4A 0%, #1F7A63 55%, #28936F 100%);
  --grad-gold:     linear-gradient(135deg, #E6B85C 0%, #F5D07A 50%, #C49A3C 100%);
  --grad-surface:  linear-gradient(160deg, #FFFFFF 0%, #F4F8F6 100%);
  --grad-mesh:     radial-gradient(ellipse at 20% 20%, rgba(31,122,99,0.08) 0%, transparent 60%),
                   radial-gradient(ellipse at 80% 80%, rgba(230,184,92,0.06) 0%, transparent 60%),
                   radial-gradient(ellipse at 60% 10%, rgba(58,158,214,0.05) 0%, transparent 50%);

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-card: 20px;
  --radius-btn:  12px;
  --radius-pill: 999px;

  /* Spacing (4px base) */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-6: 24px;  --sp-8: 32px;
  --sp-12: 48px; --sp-16: 64px; --sp-24: 96px;
  --sp-32: 128px;

  /* Typography */
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
  --font-brand:   'Talina', var(--font-heading);

  --text-xs:  clamp(0.65rem, 2vw, 0.75rem);
  --text-sm:  clamp(0.75rem, 2vw, 0.875rem);
  --text-base: clamp(0.85rem, 2.5vw, 1rem);
  --text-lg:  clamp(1rem, 3vw, 1.25rem);
  --text-xl:  clamp(1.125rem, 3.5vw, 1.5rem);
  --text-2xl: clamp(1.25rem, 4.5vw, 2rem);
  --text-3xl: clamp(1.5rem, 5vw, 3rem);
  --text-4xl: clamp(2rem, 7vw, 4rem);

  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.25s ease;
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-std:  250ms;
  --duration-slow: 400ms;
  --duration-emphasis: 600ms;

  /* Z-index scale */
  --z-dropdown:  100;
  --z-sticky:    200;
  --z-overlay:   300;
  --z-modal:     400;
  --z-toast:     500;
  --z-tooltip:   600;

  /* Layout */
  --sidebar-width: 256px;
  --sidebar-collapsed: 72px;
  --topbar-height: 68px;
  --navbar-height: 68px;
  --bottom-nav-height: 64px;
}

/* ─── Dark Mode Tokens ──────────────────────── */
[data-theme='dark'], html.dark {
  --clr-bg:             #0A1612;
  --clr-surface:        #111F1A;
  --clr-surface-2:      #162820;
  --clr-surface-3:      #0D1E18;
  --clr-surface-glass:  rgba(17,31,26,0.80);
  --clr-glass-border:   rgba(255,255,255,0.08);
  --clr-border:         #1E3328;
  --clr-border-strong:  #243D30;
  --clr-text-primary:   #FFFFFF;
  --clr-text-secondary: #A5C7BC;
  --clr-text-muted:     #5C8A7B;
  --clr-primary-light:  rgba(31,122,99,0.18);
  --clr-primary-ultra:  rgba(31,122,99,0.08);
  --clr-gold-light:     rgba(230,184,92,0.12);
  --clr-success-bg:     rgba(30,190,114,0.12);
  --clr-warning-bg:     rgba(230,184,92,0.12);
  --clr-error-bg:       rgba(224,62,68,0.12);
  --clr-info-bg:        rgba(58,158,214,0.12);
  --clr-purple-light:   rgba(124,95,212,0.12);
  --clr-coral-light:    rgba(255,107,74,0.12);
  --shadow-card:        0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.2);
  --shadow-hover:       0 6px 20px rgba(31,122,99,0.18), 0 14px 36px rgba(0,0,0,0.3);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
  --shadow-md:   0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.5);
  --shadow-xl:   0 20px 50px rgba(0,0,0,.6);
  --grad-surface: linear-gradient(160deg, #111F1A 0%, #0A1612 100%);
  --grad-mesh:    radial-gradient(ellipse at 20% 20%, rgba(31,122,99,0.12) 0%, transparent 60%),
                  radial-gradient(ellipse at 80% 80%, rgba(230,184,92,0.06) 0%, transparent 60%);
}

/* ─── CSS Reset ─────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--clr-text-primary);
  background: var(--clr-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color var(--duration-std) ease,
              color var(--duration-std) ease;
}

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

a {
  color: var(--clr-accent);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
a:hover { color: var(--clr-accent-light); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--clr-text-primary);
}
h1 { font-size: var(--text-3xl); font-weight: 700; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; }

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

::selection {
  background: rgba(var(--clr-accent-rgb), 0.2);
  color: var(--clr-text-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Scrollbar Styling ─────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--clr-text-muted);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--clr-text-secondary); }

/* ─── Typography Utilities ──────────────────── */
.font-heading { font-family: var(--font-heading); }
.font-body    { font-family: var(--font-body); }
.font-mono    { font-family: var(--font-mono); }

.text-xs   { font-size: var(--text-xs)   !important; }
.text-sm   { font-size: var(--text-sm)   !important; }
.text-base { font-size: var(--text-base) !important; }
.text-lg   { font-size: var(--text-lg)   !important; }
.text-xl   { font-size: var(--text-xl)   !important; }
.text-2xl  { font-size: var(--text-2xl)  !important; }
.text-3xl  { font-size: var(--text-3xl)  !important; }
.text-4xl  { font-size: var(--text-4xl)  !important; }

.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

.text-primary-c   { color: var(--clr-text-primary) !important; }
.text-secondary-c { color: var(--clr-text-secondary) !important; }
.text-muted-c     { color: var(--clr-text-muted) !important; }
.text-accent      { color: var(--clr-accent) !important; }
.text-success-c   { color: var(--clr-success) !important; }
.text-error-c     { color: var(--clr-error) !important; }

/* ─── Spacing Utilities ─────────────────────── */
.gap-1  { gap: var(--sp-1)  !important; }
.gap-2  { gap: var(--sp-2)  !important; }
.gap-3  { gap: var(--sp-3)  !important; }
.gap-4  { gap: var(--sp-4)  !important; }
.gap-6  { gap: var(--sp-6)  !important; }
.gap-8  { gap: var(--sp-8)  !important; }

/* ─── Layout Utilities ──────────────────────── */
.container-narrow { max-width: 680px; margin: 0 auto; padding: 0 var(--sp-4); }
.container-wide   { max-width: 1400px; margin: 0 auto; padding: 0 var(--sp-4); }

/* Card Grid — responsive */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 480px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(4, 1fr); } }

/* ─── Visual Utilities ──────────────────────── */
.glass {
  background: var(--clr-surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--clr-border);
}

.gradient-text {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-bg-brand {
  background: var(--grad-primary);
}

.gradient-bg-accent {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent-light));
}

/* ─── Animation Utilities ───────────────────── */
.transition-all {
  transition: all var(--duration-std) var(--ease-out-expo);
}
.transition-fast {
  transition: all var(--duration-fast) ease;
}

/* Fade in up */
.animate-fade-up {
  animation: myt-fade-up var(--duration-slow) var(--ease-out-expo) forwards;
  opacity: 0;
}
.animate-fade-up.delay-1 { animation-delay: 100ms; }
.animate-fade-up.delay-2 { animation-delay: 200ms; }
.animate-fade-up.delay-3 { animation-delay: 300ms; }
.animate-fade-up.delay-4 { animation-delay: 400ms; }

@keyframes myt-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Pulse */
@keyframes myt-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.05); opacity: 0.8; }
}

/* Shimmer / skeleton loading */
@keyframes myt-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Float */
@keyframes myt-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* Gradient shift (hero) */
@keyframes myt-gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Spin */
@keyframes myt-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Notification pulse dot */
@keyframes myt-badge-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--clr-accent-rgb), 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(var(--clr-accent-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--clr-accent-rgb), 0); }
}

/* Count up number */
@keyframes myt-count-pop {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── 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;
  }
}
