/* =========================================================================
   RT SHOP — Design System "Velvet Magic" v3 (LIGHT, FLAT)
   Inspiration: Honor MagicOS light, accent rouge, AUCUN gradient.
   Continuous corners, soft shadows, glass légère.
   ========================================================================= */

:root {
  /* === Surfaces (light) === */
  --bg:           #FBF7F8;
  --bg-soft:      #F5EFEF;
  --surface:      #FFFFFF;
  --surface-2:    #F7F2F3;
  --surface-3:    #EFE5E7;

  /* === Borders === */
  --border:       rgba(0,0,0,0.06);
  --border-hi:    rgba(0,0,0,0.10);
  --border-warm:  rgba(239,68,68,0.18);

  /* === Text === */
  --text:         #1A0F11;
  --text-muted:   #6B5559;
  --text-dim:     #94878A;

  /* === Brand : RED === */
  --accent:       #DC2626;
  --accent-hover: #B91C1C;
  --accent-deep:  #7F1D1D;
  --accent-glow:  rgba(220,38,38,0.20);
  --accent-soft:  rgba(220,38,38,0.10);

  /* === Couleurs flat secondaires (au lieu de gradients) === */
  --copper:       #C9612D;
  --aubergine:    #6B2A4A;
  --cream:        #FFF4E6;

  /* === Semantic === */
  --success:      #15803D;
  --warning:      #B45309;
  --error:        #B91C1C;

  /* === WhatsApp === */
  --wa:           #25D366;
  --wa-dark:      #128C7E;

  /* === Spacing — 4pt grid === */
  --s1:  4px; --s2:  8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 28px; --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px;

  /* === Radii — Honor continuous corners === */
  --r-sm:    10px;
  --r-md:    18px;
  --r-lg:    24px;
  --r-xl:    32px;
  --r-2xl:   40px;
  --r-3xl:   48px;
  --r-pill:  999px;

  /* === Shadows — light Honor === */
  --sh-1:    0 2px 8px rgba(0,0,0,0.04);
  --sh-2:    0 8px 24px rgba(0,0,0,0.06), 0 1px 0 rgba(255,255,255,0.6) inset;
  --sh-3:    0 16px 40px rgba(0,0,0,0.08), 0 1px 0 rgba(255,255,255,0.7) inset;
  --sh-glow: 0 0 0 1px var(--accent-glow), 0 8px 24px var(--accent-glow);
  --sh-warm: 0 12px 32px rgba(220,38,38,0.10);

  /* === Easings === */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-magic:  cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:    180ms;
  --t-base:    320ms;
  --t-slow:    520ms;

  /* === Typography === */
  --font-sans:    'Geist', 'SF Pro Display', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    'Geist Mono', 'SF Mono', Consolas, ui-monospace, monospace;
  --font-arabic:  'IBM Plex Sans Arabic', 'Geist', sans-serif;

  --t-display-xl: clamp(32px, 10vw, 42px);
  --t-display:    clamp(26px, 7vw, 30px);
  --t-h1:         24px;
  --t-h2:         20px;
  --t-h3:         18px;
  --t-body-lg:    16px;
  --t-body:       14px;
  --t-caption:    12px;
  --t-micro:      11px;

  /* === Layout === */
  --capsule-h:     34px;
  --tab-bar-h:     68px;
  --header-h:      56px;
  --safe-top:      env(safe-area-inset-top, 0);
  --safe-bottom:   env(safe-area-inset-bottom, 0);
}

/* === Dark mode opt-in (inverse) === */
:root[data-theme="dark"] {
  --bg:           #0B0808;
  --bg-soft:      #120D0E;
  --surface:      #1A1416;
  --surface-2:    #221A1C;
  --surface-3:    #2C2225;
  --border:       rgba(255,255,255,0.07);
  --border-hi:    rgba(255,255,255,0.13);
  --text:         #FAF7F8;
  --text-muted:   #A8A0A2;
  --text-dim:     #74696C;
  --accent:       #EF4444;
  --accent-hover: #F87171;
  --sh-1:    0 2px 8px rgba(0,0,0,0.35);
  --sh-2:    0 8px 24px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.04) inset;
  --sh-3:    0 16px 40px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.07) inset;
  --sh-warm: 0 12px 32px rgba(239,68,68,0.18);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--t-body-lg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}
html[dir="rtl"] body { font-family: var(--font-arabic); }
body { padding: 0 0 calc(var(--tab-bar-h) + var(--safe-bottom) + var(--s5)); }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; outline: none; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }

/* === Typography === */
.t-display-xl { font-size: var(--t-display-xl); font-weight: 700; line-height: 1.05; letter-spacing: -0.025em; }
.t-display    { font-size: var(--t-display);    font-weight: 700; line-height: 1.1;  letter-spacing: -0.02em; }
.t-h1         { font-size: var(--t-h1);         font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; }
.t-h2         { font-size: var(--t-h2);         font-weight: 600; line-height: 1.3;  letter-spacing: -0.01em; }
.t-h3         { font-size: var(--t-h3);         font-weight: 600; line-height: 1.35; }
.t-body-lg    { font-size: var(--t-body-lg);    font-weight: 400; line-height: 1.5; }
.t-body       { font-size: var(--t-body);       font-weight: 400; line-height: 1.55; }
.t-caption    { font-size: var(--t-caption);    font-weight: 500; line-height: 1.4;  color: var(--text-muted); }
.t-micro      { font-size: var(--t-micro);      font-weight: 600; line-height: 1.3;  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-accent{ color: var(--accent); }
.text-copper{ color: var(--copper); }
.text-ok    { color: var(--success); }

/* === Price === */
.price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; font-weight: 600; }
.price-lg { font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; }
.price-md { font-size: 18px; line-height: 1.2; }

/* === Magic Capsule === */
.capsule {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%; transform: translateX(-50%);
  height: var(--capsule-h);
  min-width: 130px; max-width: 80%;
  padding: 0 var(--s4);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-pill);
  display: flex; align-items: center; gap: var(--s2);
  font-size: 12px; font-weight: 600;
  box-shadow: var(--sh-2);
  z-index: 200;
  color: var(--text);
}
:root[data-theme="dark"] .capsule { background: rgba(20,12,14,0.85); }
.capsule .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: capsule-pulse 1.6s var(--ease-magic) infinite;
}
@keyframes capsule-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.4); opacity: 0.7; }
}

/* === Buttons FLAT === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 52px; padding: 0 var(--s6);
  border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--t-body-lg);
  letter-spacing: -0.01em;
  transition: transform var(--t-base) var(--ease-spring), box-shadow var(--t-base), background var(--t-base);
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--sh-warm); }
.btn-primary:active { background: var(--accent-hover); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-hi); box-shadow: var(--sh-1); }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }

.btn-wa { background: var(--wa); color: #fff; box-shadow: 0 8px 24px rgba(37,211,102,0.30); }

.btn-glass {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-hi);
  color: var(--text);
}

.btn-copper { background: var(--copper); color: #fff; box-shadow: 0 8px 24px rgba(201,97,45,0.30); }

.btn-sm { height: 40px; padding: 0 var(--s4); font-size: var(--t-body); }
.btn-lg { height: 60px; padding: 0 var(--s7); font-size: 17px; }
.btn-block { width: 100%; }

/* === Cards FLAT === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--sh-1);
  transition: transform var(--t-base) var(--ease-out);
}
.card:active { transform: scale(0.99); }
.card-elevated { box-shadow: var(--sh-2); }
.card-glass {
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border-hi);
}
.card-warm {
  background: var(--surface);
  border: 1px solid var(--border-warm);
  box-shadow: var(--sh-warm);
}
.card-cream {
  background: var(--cream);
  border: 1px solid rgba(201,97,45,0.15);
}

/* === Inputs === */
.field { position: relative; margin-bottom: var(--s4); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 22px var(--s5) 10px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  font-size: var(--t-body-lg);
  color: var(--text);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.field input::placeholder, .field textarea::placeholder { color: transparent; }
.field label {
  position: absolute; left: var(--s5); top: 18px;
  color: var(--text-dim); pointer-events: none;
  font-size: var(--t-body-lg);
  transition: transform var(--t-base) var(--ease-magic), color var(--t-base);
  transform-origin: 0 0;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
  transform: translateY(-12px) scale(0.78);
  color: var(--accent);
}

/* === Badge === */
.badge {
  display: inline-flex; align-items: center; gap: var(--s1);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: var(--t-caption); font-weight: 600;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-copper { background: rgba(201,97,45,0.15); color: var(--copper); border-color: transparent; }
.badge-ok     { background: rgba(21,128,61,0.15); color: var(--success); border-color: transparent; }
.badge-warn   { background: rgba(180,83,9,0.15); color: var(--warning); border-color: transparent; }

/* === Skeleton === */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes skel-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* === Toast === */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-bar-h) + var(--safe-bottom) + var(--s5));
  transform: translate(-50%, 80px); opacity: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-pill);
  padding: var(--s3) var(--s5);
  box-shadow: var(--sh-3);
  font-size: var(--t-body); font-weight: 500;
  z-index: 99999; pointer-events: none;
  transition: transform var(--t-slow) var(--ease-spring), opacity var(--t-base);
  max-width: calc(100% - var(--s8));
  color: var(--text);
}
:root[data-theme="dark"] .toast { background: rgba(20,12,14,0.95); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--error); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* === Tab bar — Light Glass Honor === */
.tabbar {
  position: fixed; left: var(--s4); right: var(--s4);
  bottom: calc(var(--safe-bottom) + var(--s4));
  height: var(--tab-bar-h);
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-3xl);
  display: flex; align-items: center; justify-content: space-around;
  box-shadow: var(--sh-3);
  z-index: 100;
  transition: transform var(--t-base) var(--ease-spring);
}
:root[data-theme="dark"] .tabbar { background: rgba(26,20,22,0.78); }
.tabbar.collapsed { transform: translateY(85px) scale(0.84); }
.tab-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: var(--s2); color: var(--text-dim);
  font-size: var(--t-micro); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  transition: color var(--t-base);
  position: relative;
}
.tab-btn svg { width: 24px; height: 24px; transition: transform var(--t-base) var(--ease-spring); }
.tab-btn.active { color: var(--accent); }
.tab-btn.active svg { transform: scale(1.18); filter: drop-shadow(0 4px 12px var(--accent-glow)); }
.tab-btn.active::after {
  content: ""; position: absolute; bottom: -1px; width: 28px; height: 4px;
  background: var(--accent); border-radius: 999px;
  box-shadow: 0 0 14px var(--accent-glow);
}

/* === Hero studio FLAT (PDP) === */
.hero-studio {
  position: relative;
  border-radius: var(--r-xl);
  background: var(--bg-soft);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-1) inset;
}

/* === Bento grid === */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s3); padding: 0 var(--s4); }
.bento-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s4);
  position: relative; overflow: hidden;
  min-height: 110px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform var(--t-base) var(--ease-spring);
  box-shadow: var(--sh-1);
}
.bento-tile:active { transform: scale(0.97); }
.bento-tile.lg { grid-column: span 6; min-height: 180px; background: var(--accent); color: #fff; border-color: transparent; box-shadow: var(--sh-warm); }
.bento-tile.md { grid-column: span 3; }
.bento-tile.sm { grid-column: span 2; }
.bento-tile .icon { font-size: 30px; }

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
