/* ============================================================
   CK Kuts Loyalty — UI mobile-first
   Palette : noir + or + camo subtle
   ============================================================ */

:root {
  --bg: #FCFBF8;
  --bg-card: #FFFFFF;
  --ink: #0A0A0A;
  --ink-soft: rgba(10, 10, 10, 0.62);
  --accent: #B8870B;
  --accent-deep: #7A6021;
  --accent-soft: rgba(184, 135, 11, 0.10);
  --accent-glow: rgba(184, 135, 11, 0.28);
  --line: rgba(10, 10, 10, 0.10);
  --error: #C2371F;
  --success: #16a34a;
  --radius: 14px;
  --radius-sm: 8px;
  --space: 16px;
  --shadow-card:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 18px 40px -10px rgba(10, 10, 10, 0.18),
    0 4px 14px rgba(184, 135, 11, 0.12);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: light;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(184, 135, 11, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(184, 135, 11, 0.06), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Shell ------------------------------------------------------ */
.card-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px var(--space) 32px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.card-shell__head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 8px 0 24px;
}
.card-shell__back {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 22px;
  border-radius: 50%;
  transition: background 0.18s, color 0.18s;
}
.card-shell__back:hover { background: rgba(10,10,10,0.05); color: var(--ink); }
.card-shell__title {
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Screens (swap) -------------------------------------------- */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 24px;
  animation: slideUp 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}
.screen.is-active { display: flex; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Brand pill (lookup screen) -------------------------------- */
.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  align-self: center;
}
.brand-pill img {
  width: 36px; height: auto;
  display: block;
  border-radius: 8px;
}
.brand-pill__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-pill__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.brand-pill__tag {
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.screen__title {
  margin: 8px 0 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

/* Lookup form ------------------------------------------------ */
.lookup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.lookup-form input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.lookup-form input::placeholder { color: rgba(10, 10, 10, 0.32); }
.lookup-form input:focus {
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.btn-primary {
  position: relative;
  height: 56px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #0A0A0A;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.12s, background 0.18s, box-shadow 0.18s;
  box-shadow: 0 6px 18px rgba(184, 135, 11, 0.32);
}
.btn-primary:hover { background: #d4a01a; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary__loader {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(10,10,10,0.3);
  border-top-color: #0A0A0A;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-primary.is-loading .btn-primary__label { opacity: 0; }
.btn-primary.is-loading .btn-primary__loader { display: block; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }

.lookup-error {
  margin: 0;
  padding: 12px 16px;
  background: rgba(194, 55, 31, 0.06);
  border: 1px solid rgba(194, 55, 31, 0.25);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.88rem;
  text-align: center;
}
.lookup-hint {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

/* Card display ---------------------------------------------- */
.card-display {
  position: relative;
  padding: 22px 22px 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, #FFFFFF 0%, #FAF7F0 70%);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
}
.card-display::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(184, 135, 11, 0.42);
  border-radius: calc(var(--radius) - 6px);
  pointer-events: none;
  z-index: 1;
}
/* watermark camo subtil */
.card-display::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(184, 135, 11, 0.10) 0, transparent 12%),
    radial-gradient(circle at 80% 14%, rgba(184, 135, 11, 0.08) 0, transparent 15%),
    radial-gradient(circle at 40% 80%, rgba(184, 135, 11, 0.08) 0, transparent 14%),
    radial-gradient(circle at 88% 76%, rgba(184, 135, 11, 0.06) 0, transparent 12%);
  z-index: 0;
  pointer-events: none;
}
.card-display > * { position: relative; z-index: 2; }

.card-display__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-display__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}
.card-display__brand img {
  width: 32px; height: auto;
  border-radius: 6px;
}
.card-display__authentic {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Badge de palier ------------------------------------------- */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  border: 1px solid rgba(184, 135, 11, 0.3);
  border-radius: 999px;
  padding: 4px 10px;
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}
.tier-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: livePulse 2s ease infinite;
  flex-shrink: 0;
}
.tier-name {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.tier-badge.is-vip { background: rgba(184, 135, 11, 0.16); border-color: var(--accent); }
.tier-badge.is-unlocked {
  background: linear-gradient(135deg, rgba(184,135,11,.2), rgba(212,168,39,.15));
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-soft);
  animation: badgeGlow 2s ease infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,135,11,.5); }
  50% { box-shadow: 0 0 0 4px rgba(184,135,11,0); }
}
@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(184,135,11,.2); }
  50% { box-shadow: 0 0 18px rgba(184,135,11,.4); }
}

.card-display__hello {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.card-display__progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-display__count {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.card-display__count-slash {
  margin: 0 4px;
  color: var(--accent);
  font-weight: 400;
}
#card-total { color: var(--ink-soft); font-weight: 500; }
.card-display__hint {
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  font-weight: 500;
  text-align: right;
  flex: 1;
}

/* Stamps grid ------------------------------------------------ */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 18px 0;
  border-top: 1px dashed rgba(184, 135, 11, 0.35);
  border-bottom: 1px dashed rgba(184, 135, 11, 0.35);
}
.stamp {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(10, 10, 10, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: rgba(10, 10, 10, 0.32);
  background: rgba(10, 10, 10, 0.02);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.stamp.is-filled {
  background: linear-gradient(145deg, #c9980e, #d4a827, #b8870b);
  border: 1.5px solid var(--accent);
  border-style: solid;
  color: #FFFFFF;
  box-shadow: 0 3px 10px var(--accent-glow);
  animation: pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.stamp svg { width: 13px; height: 13px; pointer-events: none; fill: rgba(184,135,11,.28); }
.stamp.is-filled svg { fill: rgba(255,255,255,.92); }
.stamp.is-milestone:not(.is-filled) {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.stamp.is-milestone.is-filled {
  background: linear-gradient(145deg, #c9980e, #e8c44a);
  box-shadow: 0 0 0 2px var(--accent-soft), 0 2px 8px var(--accent-glow);
}
.stamp.is-gift {
  background: linear-gradient(145deg, #0f0f0f, #1c1c1c);
  border: 1.5px solid rgba(184,135,11,.3);
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.stamp.is-gift svg { fill: var(--accent); }
.stamp.is-gift.is-filled {
  background: linear-gradient(145deg, var(--accent-deep), var(--accent), #d4a827);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(184,135,11,.25), 0 4px 20px var(--accent-glow);
  animation: giftGlow 1.5s ease infinite alternate;
}
.stamp.is-gift.is-filled svg { fill: #fff; }
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes giftGlow {
  from { box-shadow: 0 0 0 3px rgba(184,135,11,.2), 0 4px 16px rgba(184,135,11,.3); }
  to   { box-shadow: 0 0 0 6px rgba(184,135,11,.08), 0 4px 24px rgba(184,135,11,.5); }
}

/* Compte à rebours -------------------------------------------- */
.cdr-wrap {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(184,135,11,.05);
  border: 1px solid rgba(184,135,11,.14);
  border-radius: 12px; padding: 12px 14px; margin: 16px 0;
  transition: all 0.5s ease;
}
.cdr-wrap.is-done {
  background: rgba(184,135,11,.12);
  border-color: rgba(184,135,11,.35);
  box-shadow: 0 0 20px rgba(184,135,11,.12);
}
.cdr-copy { font-size: 0.72rem; color: var(--ink-soft); line-height: 1.4; }
.cdr-copy strong { color: var(--ink); font-weight: 700; }
.cdr-big {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 600;
  letter-spacing: -0.02em; color: var(--accent); line-height: 1;
  text-align: right;
}
.cdr-big.is-urgent { color: var(--accent-deep); }
.cdr-unit {
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); text-align: right; margin-top: 2px;
}

/* Barre de progression ------------------------------------------ */
.prog-track {
  height: 4px; background: var(--line); border-radius: 99px;
  overflow: hidden; margin-bottom: 4px; position: relative;
}
.prog-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent), #e8c44a);
  border-radius: 99px; transition: width 0.7s ease;
}

/* Bandeau récompense (statique) --------------------------------- */
.reward-banner {
  background: linear-gradient(135deg, #0c0c0c 0%, #1e1a14 100%);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 11px;
  border: 1px solid rgba(184,135,11,.2);
}
.reward-banner-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: rgba(184,135,11,.15); border: 1px solid rgba(184,135,11,.28);
  display: flex; align-items: center; justify-content: center;
}
.reward-banner-icon svg { width: 15px; height: 15px; fill: var(--accent); }
.reward-banner-title {
  font-family: var(--font-display); font-weight: 500; font-size: 0.78rem;
  color: #F4EFE6; line-height: 1.3;
}
.reward-banner-title b { color: #e8c44a; font-weight: 700; }
.reward-banner-sub { font-size: 0.62rem; color: rgba(244,239,230,.4); letter-spacing: 0.02em; margin-top: 1px; }

/* Parrainage — repris du niveau de design du prototype ----------- */
.referral-row {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 9px 12px; border-radius: 12px;
  background: var(--accent-soft); border: 1px dashed rgba(184,135,11,.3);
}
.referral-row-icon { width: 20px; height: 20px; color: var(--accent-deep); flex-shrink: 0; }
.referral-row-icon svg { width: 100%; height: 100%; fill: currentColor; }
.referral-row-copy { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.referral-row-label { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.referral-row-val { font-size: 0.78rem; font-weight: 700; color: var(--accent-deep); }

.card-display__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.card-display__reward {
  color: var(--accent);
  font-weight: 600;
}
.card-display__since {
  color: var(--ink-soft);
  font-size: 0.7rem;
  text-align: right;
}

/* Actions --------------------------------------------------- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-secondary {
  height: 52px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.btn-secondary:hover { border-color: var(--accent); background: #FFFCF3; box-shadow: 0 4px 14px rgba(184, 135, 11, 0.12); }

.btn-ghost {
  height: 44px;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color 0.18s;
}
.btn-ghost:hover { color: var(--accent); }

/* Récompenses passées --------------------------------------- */
.rewards-history {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
}
.rewards-history summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
}
.rewards-history ul {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rewards-history li {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* Carte pleine (10/10) — animation célébration */
.card-display.is-complete {
  animation: completePulse 1.6s ease-in-out infinite;
}
@keyframes completePulse {
  0%, 100% { box-shadow: var(--shadow-card), 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: var(--shadow-card), 0 0 0 8px transparent; }
}
.card-display.is-complete .card-display__hint {
  color: var(--success);
}

@media (min-width: 600px) {
  .card-shell { padding-top: 40px; }
  .card-shell__head { padding-bottom: 40px; }
}
