/* ═══════════════════════════════════════════════════════════════════════════
   MUA MATIÈRE — DESIGN SYSTEM v3
   Glass dark editorial. Inspired by NeoVision, Bottega Veneta, Glassmorphism.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Inter:wght@200;300;400;500;600&display=swap');

/* ── TOKENS ────────────────────────────────────────────────────────────────── */
:root {
  /* Colours */
  --black:       #070708;
  --ink:         #0C0C0E;
  --glass:       rgba(18, 18, 22, 0.82);
  --glass-light: rgba(255, 255, 255, 0.04);
  --glass-mid:   rgba(255, 255, 255, 0.07);
  --surface:     #131316;
  --surface-2:   #1A1A1F;
  --rule:        rgba(255, 255, 255, 0.08);
  --rule-solid:  #1E1E24;
  --muted:       #2A2A32;
  --mid:         #5A5A6A;
  --soft:        #9A9AAA;
  --paper:       #F4F2EE;
  --white:       #F8F6F2;
  --chrome:      rgba(255,255,255,0.12);
  --chrome-edge: rgba(255,255,255,0.18);
  --amber:       #C4943A;
  --red:         #C05A5A;
  --green:       #5A9A6E;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Glass effects */
  --glass-bg:      rgba(14, 14, 18, 0.85);
  --glass-border:  rgba(255, 255, 255, 0.09);
  --glass-shine:   inset 0 1px 0 rgba(255,255,255,0.10), inset 0 -1px 0 rgba(0,0,0,0.3);
  --glass-shadow:  0 8px 32px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.05);
  --glass-glow:    0 0 0 1px rgba(255,255,255,0.06);

  /* Spacing */
  --page-px: 20px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Easing */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

/* ── RESET & BASE ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px; scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--black);
}
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }
::selection { background: var(--white); color: var(--black); }
::-webkit-scrollbar { width: 2px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 1px; }

/* ── DISPLAY TYPOGRAPHY ────────────────────────────────────────────────────── */
.t-display {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--white);
}
.t-display-xl { font-size: clamp(52px, 12vw, 96px); }
.t-display-lg { font-size: clamp(36px, 8vw, 64px); }
.t-display-md { font-size: clamp(28px, 6vw, 44px); }
.t-display-sm { font-size: 24px; }
.t-display em  { font-style: italic; color: var(--soft); }

.t-label {
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--mid);
}
.t-body { font-size: 14px; font-weight: 300; color: var(--soft); line-height: 1.75; }
.t-meta { font-size: 11px; font-weight: 300; color: var(--mid); }
.t-price {
  font-family: var(--font-display); font-weight: 300;
  font-size: 22px; letter-spacing: -0.01em; color: var(--white);
}

/* ── GLASS SURFACES ────────────────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), var(--glass-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.glass-subtle {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 4px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 2px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.glass-card:hover {
  border-color: rgba(255,255,255,0.14);
  box-shadow: var(--glass-shine), 0 8px 32px rgba(0,0,0,0.5);
}

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 11px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase;
  padding: 14px 28px; cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap; border-radius: 0;
}
.btn--primary {
  background: var(--white); color: var(--black);
  border: 1px solid var(--white);
  box-shadow: 0 0 0 0 rgba(248,246,242,0);
}
.btn--primary:hover {
  background: var(--paper);
  box-shadow: 0 4px 20px rgba(248,246,242,0.15);
}
.btn--primary:active { transform: scale(0.98); }
.btn--primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--ghost {
  background: transparent; color: var(--white);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine);
  backdrop-filter: blur(8px);
}
.btn--ghost:hover { border-color: rgba(255,255,255,0.2); }
.btn--ghost:active { transform: scale(0.98); }

.btn--glass {
  background: var(--glass-bg);
  color: var(--soft);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn--glass:hover { color: var(--white); border-color: rgba(255,255,255,0.16); }

.btn--full { width: 100%; }
.btn--sm { padding: 10px 18px; font-size: 10px; letter-spacing: 0.18em; }

/* ── INPUTS ────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label {
  font-size: 9px; font-weight: 500; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--mid);
}
.field__input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--white);
  font-family: var(--font-body); font-size: 14px; font-weight: 300;
  padding: 13px 16px;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  border-radius: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.field__input:focus {
  border-color: rgba(255,255,255,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 0 3px rgba(255,255,255,0.04);
}
.field__input::placeholder { color: var(--muted); }
.field__input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--surface) inset;
  -webkit-text-fill-color: var(--white);
}
select.field__input { cursor: pointer; }
.field--error .field__input { border-color: var(--red); }
.field__error { font-size: 11px; color: var(--red); display: none; }
.field--error .field__error { display: block; }

/* ── CHIP SELECTORS ────────────────────────────────────────────────────────── */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--mid);
  font-family: var(--font-body); font-size: 12px; font-weight: 400;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.chip.selected {
  background: var(--white); color: var(--black);
  border-color: var(--white);
  box-shadow: 0 2px 12px rgba(248,246,242,0.15);
}
.chip:active { transform: scale(0.97); }

/* ── PAGE HEADER (app pages) ───────────────────────────────────────────────── */
.page-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(7,7,8,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding-top: var(--safe-top);
}
.page-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 var(--page-px);
}
.page-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: 20px; letter-spacing: 0.06em; color: var(--white);
}

/* ── BOTTOM NAV ────────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: rgba(7,7,8,0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
}
.bottom-nav__inner {
  display: flex; align-items: stretch;
  height: 56px;
}
.bottom-nav__item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--mid);
  font-size: 9px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.bottom-nav__item.active { color: var(--white); }
.bottom-nav__item.active::before {
  content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
  background: var(--white);
}
.bottom-nav__icon { font-size: 16px; line-height: 1; }

/* ── ROW LISTS ─────────────────────────────────────────────────────────────── */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.list-row:first-child { border-top: 1px solid rgba(255,255,255,0.06); }
.list-row:hover, .list-row:active { background: rgba(255,255,255,0.04); }
.list-row__name { font-size: 13px; color: var(--white); margin-bottom: 3px; }
.list-row__meta { font-size: 10px; color: var(--mid); }
.list-row__arrow { color: var(--muted); font-size: 16px; flex-shrink: 0; }
.list-row__price {
  font-family: var(--font-display); font-size: 18px;
  color: var(--soft); flex-shrink: 0;
}

/* ── STAT GRID ─────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.stat-block {
  background: var(--ink); padding: 18px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.stat-block__val {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(28px, 7vw, 44px); line-height: 1;
  color: var(--white); letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.stat-block__label {
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--mid);
}

/* ── SECTION LABELS ────────────────────────────────────────────────────────── */
.section-eyebrow {
  font-size: 9px; font-weight: 500; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--mid); margin-bottom: 16px;
}
.section-rule {
  height: 1px; background: rgba(255,255,255,0.07); margin: 0;
}

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(72px + var(--safe-bottom));
  left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--white); color: var(--black);
  font-family: var(--font-body); font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; padding: 11px 20px;
  white-space: nowrap; opacity: 0;
  transition: all 0.25s var(--ease);
  pointer-events: none; z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── SPINNER ───────────────────────────────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 56px 24px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.01);
}
.empty-state__icon {
  font-family: var(--font-display); font-size: 48px;
  color: var(--muted); margin-bottom: 16px; line-height: 1;
}
.empty-state__title {
  font-family: var(--font-display); font-size: 28px; font-weight: 300;
  color: var(--white); margin-bottom: 10px;
}
.empty-state__body { font-size: 13px; color: var(--mid); line-height: 1.7; margin-bottom: 28px; }

/* ── BADGE ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 8px; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 3px 8px;
  border: 1px solid; border-radius: 0;
}
.badge--amber { color: var(--amber); border-color: var(--amber); }
.badge--red { color: var(--red); border-color: var(--red); }
.badge--dim { color: var(--mid); border-color: var(--muted); }
.badge--type {
  color: var(--mid); border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

/* ── SHEET / MODAL ─────────────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }
.sheet {
  width: 100%; max-width: 500px; max-height: 92dvh;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  box-shadow: var(--glass-shine), 0 -8px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s var(--ease);
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet__header { padding: 20px 20px 0; }
.sheet__title {
  font-family: var(--font-display); font-weight: 300;
  font-size: 28px; color: var(--white); letter-spacing: -0.01em;
}
.sheet__body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.sheet__footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(7,7,8,0.6);
}

/* ── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  width: 100%; max-width: 400px; max-height: 90dvh; overflow-y: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 24px 60px rgba(0,0,0,0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: scale(0.97) translateY(8px);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal__title {
  font-family: var(--font-display); font-weight: 300; font-size: 28px;
  color: var(--white); padding: 24px 24px 0; letter-spacing: -0.01em;
}
.modal__form { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 18px; }

/* ── FAB ───────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(68px + var(--safe-bottom));
  right: 20px; z-index: 50;
  width: 52px; height: 52px;
  background: var(--white);
  color: var(--black);
  border: none; border-radius: 0;
  font-size: 22px; font-weight: 300;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.fab:hover { box-shadow: 0 8px 32px rgba(248,246,242,0.2); }
.fab:active { transform: scale(0.95); }

/* ── SEARCH INPUT ──────────────────────────────────────────────────────────── */
.search-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--white);
  font-family: var(--font-body); font-size: 14px; font-weight: 300;
  padding: 12px 16px; outline: none; -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.search-input:focus {
  border-color: rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.search-input::placeholder { color: var(--muted); }

.search-results {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: none;
  max-height: 240px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.search-result {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: rgba(255,255,255,0.05); }
.search-result__name { font-size: 13px; color: var(--white); margin-bottom: 3px; }
.search-result__brand { font-size: 10px; color: var(--mid); }

/* ── TABS ──────────────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(7,7,8,0.6);
  backdrop-filter: blur(12px);
}
.tab-btn {
  flex: 1; padding: 12px 8px;
  font-family: var(--font-body); font-size: 9px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--mid); background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn.active { color: var(--white); border-bottom-color: var(--white); }

/* ── PROGRESS BAR ──────────────────────────────────────────────────────────── */
.progress-bar {
  height: 1px; background: rgba(255,255,255,0.08);
  position: relative; overflow: hidden;
}
.progress-bar__fill {
  height: 100%; background: var(--white);
  transition: width 0.4s var(--ease);
}

/* ── ANIMATIONS ────────────────────────────────────────────────────────────── */
@keyframes fadeUp   { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn   { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp  { from { transform:translateY(100%); } to { transform:translateY(0); } }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.06); }
  50%       { box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 0 20px rgba(255,255,255,0.04); }
}

.animate-fade-up { animation: fadeUp 0.5s var(--ease) both; }
.animate-fade-in { animation: fadeIn 0.4s ease both; }

/* Stagger children */
.stagger > * { animation: fadeUp 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(n+6) { animation-delay: 0.30s; }

/* ── UTILITY ───────────────────────────────────────────────────────────────── */
.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;
}
.divider { height: 1px; background: rgba(255,255,255,0.07); margin: 24px 0; }
.text-white { color: var(--white); }
.text-mid   { color: var(--mid); }
.text-soft  { color: var(--soft); }
.text-amber { color: var(--amber); }
.text-red   { color: var(--red); }

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