/* ===== Reset léger ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* l'attribut hidden doit toujours l'emporter sur display:flex/block des overlays */
[hidden] { display: none !important; }

/* ===== Direction artistique : light mode pastel (réf ModelDesign.png) ===== */
:root {
  --fond: #eef0f4;
  --texte: #1b1b22;
  --texte-doux: #9293a0;
  --accent: #6c5ce7;
  --accent-clair: #8a7bf0;

  /* tons pastel par catégorie */
  --pastel-hauts: #fbe5ec;       /* rose */
  --pastel-bas: #ece6fb;         /* lavande */
  --pastel-vestes: #fcecdc;      /* pêche */
  --pastel-chaussures: #e2f3e9;  /* menthe */
  --pastel-accessoires: #e4edfc; /* bleu doux */

  --rayon: 26px;
  --rayon-petit: 18px;
  --espace: 16px;
  --hauteur-bouton: 96px; /* zone réservée au bouton fixe en bas */
  --ombre: 0 8px 24px rgba(27, 27, 34, 0.06);
}

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

html {
  -webkit-tap-highlight-color: transparent; /* pas de flash bleu au tap (iOS) */
  overscroll-behavior: none;                 /* pas de rebond élastique de la page */
}

body {
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior: none;
}

/* ============================================================
   ÉCRAN D'ACCUEIL / AUTH
   ============================================================ */
.auth {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--fond);
  overflow: hidden;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* sortie de l'écran auth -> on révèle l'app */
.auth.is-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

/* chaque panneau occupe tout l'écran et glisse horizontalement */
.auth-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 48px) 24px calc(env(safe-area-inset-bottom) + 28px);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}

/* panneau welcome */
.auth-panel--welcome {
  transform: translateX(0);
  justify-content: space-between;
}
.auth-panel--welcome.slide-out {
  transform: translateX(-22%);
  opacity: 0;
  pointer-events: none;
}

/* panneau email : caché à droite par défaut */
.auth-panel--email {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}
.auth-panel--email.is-active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* --- bloc de marque (haut du welcome) --- */
.auth-top {
  margin-top: 8vh;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--ombre);
  font-size: 2.2rem;
  margin-bottom: 22px;
}

.brand-titre {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.brand-sous {
  font-size: 1.05rem;
  color: var(--texte-doux);
  line-height: 1.5;
  max-width: 19em;
}

/* --- boutons d'auth --- */
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  border-radius: 16px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn-auth:active { transform: scale(0.98); }

.auth-icone {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-auth--google {
  background: #fff;
  color: var(--texte);
  box-shadow: var(--ombre);
}
.btn-auth--apple {
  background: #111114;
  color: #fff;
}
.btn-auth--email {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.35);
}

.auth-legal {
  margin-top: 6px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--texte-doux);
  line-height: 1.5;
}
.auth-legal a {
  color: var(--texte);
  text-decoration: underline;
}

/* --- panneau email --- */
.auth-retour {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 18px);
  left: 18px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--ombre);
  color: var(--texte);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-retour svg { width: 22px; height: 22px; }

.email-entete {
  margin-top: 9vh;
  margin-bottom: 28px;
}
.email-titre {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.email-sous {
  font-size: 1rem;
  color: var(--texte-doux);
}

.email-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.champ {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.champ-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-doux);
  padding-left: 4px;
}
.champ-input {
  height: 54px;
  padding: 0 18px;
  border-radius: 15px;
  border: 1.5px solid transparent;
  background: #fff;
  box-shadow: var(--ombre);
  font-size: 1rem;
  font-family: inherit;
  color: var(--texte);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.champ-input::placeholder { color: #c2c3cd; }
.champ-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
}

.btn-principal {
  height: 56px;
  margin-top: 8px;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.35);
  transition: transform 0.12s ease, background 0.2s ease;
}
.btn-principal:active { transform: scale(0.98); background: var(--accent-clair); }

.email-switch {
  margin-top: 22px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--texte-doux);
}
.lien-bouton {
  border: none;
  background: none;
  padding: 0 0 0 4px;
  font: inherit;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

/* ===== Animation d'entrée (stagger) ===== */
.anim {
  opacity: 0;
  transform: translateY(16px);
  animation: monteFade 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes monteFade {
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   APP : ARMOIRE
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 22px) var(--espace) 18px;
  background: var(--fond);
}

.app-salut {
  font-size: 0.95rem;
  color: var(--texte-doux);
  margin-bottom: 4px;
}

.app-header h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.armoire {
  display: flex;
  flex-direction: column;
  gap: var(--espace);
  padding: 4px var(--espace) 0;
  padding-bottom: calc(var(--hauteur-bouton) + env(safe-area-inset-bottom));
}

.categorie {
  border-radius: var(--rayon);
  padding: 20px;
  box-shadow: var(--ombre);
}

.categorie--hauts        { background: var(--pastel-hauts); }
.categorie--bas          { background: var(--pastel-bas); }
.categorie--vestes       { background: var(--pastel-vestes); }
.categorie--chaussures   { background: var(--pastel-chaussures); }
.categorie--accessoires  { background: var(--pastel-accessoires); }

.categorie-entete {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.categorie-icone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.categorie-titre {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.contenu-vide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 104px;
  border-radius: var(--rayon-petit);
  background: rgba(255, 255, 255, 0.55);
  color: var(--texte-doux);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* ===== Bouton fixe en bas (pilule violette) ===== */
.btn-scan {
  position: fixed;
  left: var(--espace);
  right: var(--espace);
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  height: 58px;
  border: none;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;

  box-shadow: 0 10px 28px rgba(108, 92, 231, 0.45);
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn-scan:active {
  transform: scale(0.97);
  background: var(--accent-clair);
}
.btn-scan-icone {
  font-size: 1.35rem;
  line-height: 1;
}

/* ===== Confort sur grands écrans (cadre type mobile) ===== */
@media (min-width: 600px) {
  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.08);
  }
  .auth {
    max-width: 480px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  .auth.is-out {
    transform: translateX(-50%) scale(1.04);
  }
  .btn-scan {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(480px - 2 * var(--espace));
    max-width: calc(100vw - 2 * var(--espace));
  }
  .btn-scan:active {
    transform: translateX(-50%) scale(0.97);
  }
}

/* ============================================================
   ÉCRAN ABONNEMENT
   ============================================================ */
.abo {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--fond);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 24px);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.abo.is-in { opacity: 1; }
.abo.is-out { opacity: 0; transform: scale(1.04); pointer-events: none; }

.abo-inner {
  width: 100%;
  max-width: 420px;
}
.abo-entete { margin-bottom: 8px; text-align: center; }
.abo-titre {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.abo-sous {
  font-size: 1rem;
  color: var(--texte-doux);
  line-height: 1.5;
  max-width: 22em;
  margin: 0 auto;
}
.abo-actions { margin-top: 8px; padding: 0 1rem; }
.abo-actions .btn-principal { width: 100%; }
.abo-actions .lien-bouton {
  display: block;
  width: 100%;
  margin-top: 14px;
  text-align: center;
  padding: 6px;
}

/* ---- Modèle radio (Uiverse.io / escannord), adapté à la DA ---- */
.radio-input input { display: none; }

.radio-input label {
  --border-color: #d7d8e4;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  min-width: 5rem;
  margin: 0.75rem 1rem;
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  position: relative;
  align-items: center;
  background: #fff;
  box-shadow: var(--ombre);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.12s ease;
}
.radio-input input:checked + label {
  --border-color: var(--accent);
  border-color: var(--border-color);
  border-width: 2px;
}
.radio-input label:hover { --border-color: var(--accent); border-color: var(--border-color); }
.radio-input label:active { transform: scale(0.99); }

.radio-input {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  flex-direction: column;
  margin: 18px 0 8px;
}

.circle {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #d7d6e2;
  margin-right: 0.6rem;
  position: relative;
  transition: background-color 0.18s ease;
}
.radio-input input:checked + label span.circle {
  background-color: #e3def9;
}
.radio-input input:checked + label span.circle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--accent);
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.text {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1.05rem;
}
.price {
  display: flex;
  flex-direction: column;
  text-align: right;
  font-weight: 800;
  font-size: 1.1rem;
}
.small {
  font-size: 11px;
  color: var(--texte-doux);
  font-weight: 500;
  margin-top: 2px;
}
.info {
  position: absolute;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #06231a;
  background-color: #1fec7b;
  border-radius: 20px;
  padding: 2px 10px;
  top: 0;
  transform: translateY(-50%);
  right: 16px;
}

/* ============================================================
   CARTE ACTION : composer une tenue
   ============================================================ */
.carte-action {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-radius: var(--rayon);
  padding: 18px 20px;
  box-shadow: var(--ombre);
}
.carte-action-txt h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.carte-action-txt p { font-size: 0.85rem; color: var(--texte-doux); line-height: 1.35; }
.btn-composer {
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  border-radius: 100px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(108, 92, 231, 0.35);
  transition: transform 0.12s ease, background 0.2s ease;
}
.btn-composer:active { transform: scale(0.96); background: var(--accent-clair); }

/* ============================================================
   CAMÉRA
   ============================================================ */
.cam {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cam-video, .cam-apercu {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-erreur {
  position: relative;
  z-index: 2;
  max-width: 80%;
  text-align: center;
  color: #fff;
  font-size: 1rem;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.5);
  padding: 18px 20px;
  border-radius: 16px;
}
.cam-barre {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px calc(env(safe-area-inset-bottom) + 28px);
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
}
.cam-fermer {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cam-spacer { width: 46px; }
.cam-declencheur {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.55);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.15);
  transition: transform 0.1s ease;
}
.cam-declencheur:active { transform: scale(0.92); }

.cam-barre--apercu { justify-content: space-around; gap: 14px; }
.cam-btn-secondaire, .cam-btn-principal {
  flex: 1;
  height: 52px;
  border-radius: 14px;
  border: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cam-btn-secondaire { background: rgba(255,255,255,0.2); color: #fff; backdrop-filter: blur(6px); }
.cam-btn-principal { background: var(--accent); color: #fff; }

/* ============================================================
   CHARGEMENT (génération de tenue)
   ============================================================ */
.loader-ecran {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(238, 240, 244, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loader-anneau {
  position: relative;
  width: 70px;
  height: 70px;
  margin-bottom: 14px;
}
.loader-anneau span {
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.1s cubic-bezier(0.5, 0.15, 0.5, 0.85) infinite;
}
.loader-anneau span:nth-child(2) { inset: 10px; border-top-color: var(--accent-clair); animation-duration: 1.4s; animation-direction: reverse; }
.loader-anneau span:nth-child(3) { inset: 20px; border-top-color: #c9bff7; animation-duration: 0.9s; }
@keyframes spin { to { transform: rotate(360deg); } }

.loader-texte { font-size: 1.15rem; font-weight: 700; }
.loader-sous { font-size: 0.9rem; color: var(--texte-doux); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%) translateY(20px);
  z-index: 140;
  max-width: 86%;
  background: #1b1b22;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Accessibilité : réduire les animations ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .anim { opacity: 1; transform: none; }
}

/* ============================================================
   GRILLE VÊTEMENTS (dans les catégories)
   ============================================================ */
.vetements-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.vetement-card {
  position: relative;
  border-radius: var(--rayon-petit);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  aspect-ratio: 3 / 4;
}

.vetement-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vetement-nom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 7px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.52), transparent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vetement-suppr {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CLASSIFICATION DU VÊTEMENT
   ============================================================ */
.classify {
  position: fixed;
  inset: 0;
  z-index: 125;
  background: var(--fond);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.classify.is-in  { opacity: 1; transform: translateY(0); }
.classify.is-out { opacity: 0; transform: translateY(28px); pointer-events: none; }

.classify-photo {
  flex-shrink: 0;
  height: 30vh;
  background: #111;
  overflow: hidden;
}
.classify-apercu {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.classify-corps {
  flex: 1;
  padding: 20px var(--espace) calc(env(safe-area-inset-bottom) + 24px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.classify-titre {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
/* --- Groupes d'options (pills + swatches) --- */
.opt-groupe {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.opt-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-doux);
  padding-left: 4px;
}
.opt-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opt-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 0 15px;
  border-radius: 100px;
  background: #fff;
  box-shadow: var(--ombre);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.opt input:checked + .opt-pill {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.38);
}

/* Pastilles de couleur */
.opt-swatches { gap: 10px; }
.swatch {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: var(--ombre);
  cursor: pointer;
  border: 2px solid #fff;
  outline: 2px solid transparent;
  transition: outline-color 0.16s ease, transform 0.12s ease;
}
.opt input:checked + .swatch {
  outline-color: var(--accent);
  transform: scale(1.08);
}

.classify-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}
.classify-btn-annuler {
  flex: 1;
  height: 56px;
  border: none;
  border-radius: 16px;
  background: #e0e1ea;
  color: var(--texte);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.classify-btn-annuler:active { background: #d0d1db; }
.classify-btn-ajouter { flex: 2; margin-top: 0 !important; }

/* ============================================================
   TENUE COMPOSÉE
   ============================================================ */
.tenue-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: var(--fond);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.tenue-modal.is-in  { opacity: 1; transform: translateY(0); }
.tenue-modal.is-out { opacity: 0; transform: translateY(28px); pointer-events: none; }

.tenue-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 22px) var(--espace) 16px;
  flex-shrink: 0;
}
.tenue-titre {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tenue-fermer {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #e0e1ea;
  color: var(--texte);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tenue-fermer:active { background: #d0d1db; }

.tenue-grille {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 var(--espace);
  align-content: start;
}
.tenue-grille > .tenue-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 55%;
  justify-self: center;
}

.tenue-item {
  border-radius: var(--rayon-petit);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--ombre);
}
.tenue-item-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.tenue-item-info {
  padding: 8px 12px 10px;
}
.tenue-item-cat {
  font-size: 0.68rem;
  color: var(--texte-doux);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tenue-item-nom {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tenue-actions {
  flex-shrink: 0;
  padding: 16px var(--espace) calc(env(safe-area-inset-bottom) + 24px);
}
.tenue-actions .btn-principal { width: 100%; margin-top: 0 !important; }

/* --- Score de la tenue --- */
.tenue-score {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 var(--espace) 16px;
  padding: 16px 18px;
  background: #fff;
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}
.tenue-score-num {
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.tenue-score-num.q-haut { color: #2f9e44; }
.tenue-score-num.q-moyen { color: var(--accent); }
.tenue-score-num.q-bas { color: #e8893b; }
.tenue-score-num #tenue-score-val { font-size: 2.6rem; line-height: 1; }
.tenue-score-num small { font-size: 1rem; color: var(--texte-doux); font-weight: 700; margin-left: 2px; }

.tenue-score-barres {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.axe {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 8px;
}
.axe-label { font-size: 0.72rem; font-weight: 600; color: var(--texte-doux); }
.axe-bar {
  height: 7px;
  border-radius: 100px;
  background: #ececf2;
  overflow: hidden;
}
.axe-fill {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   SÉLECTEUR DE CONTEXTE (bottom sheet)
   ============================================================ */
.ctx-sheet {
  position: fixed;
  inset: 0;
  z-index: 128;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ctx-fond {
  position: absolute;
  inset: 0;
  background: rgba(27, 27, 34, 0.4);
  opacity: 0;
  transition: opacity 0.32s ease;
}
.ctx-sheet.is-in .ctx-fond { opacity: 1; }

.ctx-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  background: var(--fond);
  border-radius: 28px 28px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 22px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.ctx-sheet.is-in .ctx-card { transform: translateY(0); }

.ctx-poignee {
  width: 42px;
  height: 5px;
  border-radius: 100px;
  background: #d4d5df;
  margin: 0 auto 6px;
}
.ctx-titre {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ctx-sous {
  font-size: 0.92rem;
  color: var(--texte-doux);
  margin-top: -10px;
}

.ctx-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 100px;
  background: #e0e1ea;
  outline: none;
}
.ctx-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.45);
  cursor: pointer;
}
.ctx-range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.45);
  cursor: pointer;
}

.ctx-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.ctx-actions .classify-btn-annuler { flex: 1; }
.ctx-actions .btn-principal { flex: 2; margin-top: 0 !important; }

/* ============================================================
   ✦ COUCHE « COLORÉ & FUN » (vibe Duolingo / Gen-Z)
   Override esthétique — animations, dégradés, ombres colorées.
   ============================================================ */
:root {
  --accent-fonce: #4b3bc7;              /* base « 3D » des boutons */
  --grad-primary: linear-gradient(135deg, #6c5ce7 0%, #9b5cf0 48%, #ec5fa8 100%);
  --grad-primary-lg: linear-gradient(135deg, #6c5ce7 0%, #9b5cf0 35%, #ec5fa8 70%, #6c5ce7 100%);
  --ressort: cubic-bezier(0.34, 1.56, 0.64, 1); /* rebond */
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes pop-in {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to   { opacity: 1; transform: none; }
  }
  @keyframes shimmer { to { background-position: 200% 0; } }
  @keyframes flotte {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%      { transform: translateY(-4px) rotate(3deg); }
  }
}

/* --- Fond dégradé vivant (au lieu du gris plat) --- */
body {
  background:
    radial-gradient(1100px 620px at 8% -8%, #ffe3ef 0%, rgba(255,227,239,0) 55%),
    radial-gradient(900px 560px at 108% 4%, #e6e2ff 0%, rgba(230,226,255,0) 52%),
    radial-gradient(820px 700px at 50% 118%, #dff1ff 0%, rgba(223,241,255,0) 55%),
    var(--fond);
  background-attachment: fixed;
}

/* --- Titres en dégradé --- */
.brand-titre,
.app-header h1,
.abo-titre,
.tenue-titre {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- Boutons « chunky 3D » qui s'enfoncent au tap --- */
.btn-principal,
.btn-composer,
.btn-scan,
.btn-auth--email {
  background: var(--grad-primary) !important;
  color: #fff !important;
  border: none;
  font-weight: 800;
  box-shadow: 0 6px 0 var(--accent-fonce), 0 14px 26px -8px rgba(108, 92, 231, 0.55);
  transition: transform 0.12s var(--ressort), box-shadow 0.12s ease;
}
.btn-principal:active,
.btn-composer:active,
.btn-scan:active,
.btn-auth--email:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--accent-fonce), 0 6px 12px -8px rgba(108, 92, 231, 0.5);
}

/* le bouton Composer scintille légèrement */
.btn-composer {
  background: var(--grad-primary-lg) !important;
  background-size: 200% 100% !important;
  animation: shimmer 3.5s linear infinite;
}

/* boutons auth Google/Apple : effet d'enfoncement aussi */
.btn-auth--google { box-shadow: 0 5px 0 #d7d8e0, 0 12px 22px -10px rgba(0,0,0,0.18); }
.btn-auth--apple  { box-shadow: 0 5px 0 #000, 0 12px 22px -10px rgba(0,0,0,0.35); }
.btn-auth--google:active,
.btn-auth--apple:active { transform: translateY(3px); }

/* --- Sections catégories : ombres colorées + entrée bondissante --- */
.carte-action,
.categorie {
  animation: pop-in 0.55s var(--ressort) both;
}
.categorie--hauts       { box-shadow: 0 16px 32px -14px rgba(240, 101, 149, 0.55); animation-delay: 0.05s; }
.categorie--bas         { box-shadow: 0 16px 32px -14px rgba(124, 108, 231, 0.50); animation-delay: 0.10s; }
.categorie--vestes      { box-shadow: 0 16px 32px -14px rgba(245, 158, 66, 0.45);  animation-delay: 0.15s; }
.categorie--chaussures  { box-shadow: 0 16px 32px -14px rgba(47, 158, 68, 0.40);   animation-delay: 0.20s; }
.categorie--accessoires { box-shadow: 0 16px 32px -14px rgba(59, 91, 219, 0.45);   animation-delay: 0.25s; }

/* icône de catégorie : plus grosse, colorée, qui flotte */
.categorie-icone {
  width: 46px;
  height: 46px;
  font-size: 1.45rem;
  background: #fff;
  box-shadow: 0 6px 14px -4px rgba(27, 27, 34, 0.18);
  animation: flotte 3.2s ease-in-out infinite;
}
.categorie--bas .categorie-icone         { animation-delay: 0.4s; }
.categorie--vestes .categorie-icone      { animation-delay: 0.8s; }
.categorie--chaussures .categorie-icone  { animation-delay: 1.2s; }
.categorie--accessoires .categorie-icone { animation-delay: 1.6s; }
.categorie-titre { font-size: 1.25rem; font-weight: 800; }

/* --- Cartes vêtements : ombre + rebond au tap --- */
.vetement-card {
  box-shadow: 0 10px 20px -10px rgba(27, 27, 34, 0.3);
  transition: transform 0.15s var(--ressort);
}
.vetement-card:active { transform: scale(0.94); }

/* --- Empty state ludique --- */
.contenu-vide {
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: #a6a2c4;
}
.vide-emoji { font-size: 1.8rem; line-height: 1; }

/* --- Bouton scanner : icône + qui grossit --- */
.btn-scan-icone { font-size: 1.5rem; font-weight: 800; }

/* --- Barres de score : animation de remplissage --- */
.axe-fill {
  transition: width 0.8s var(--ressort);
  background: var(--grad-primary);
}
.tenue-score-num { transition: transform 0.3s var(--ressort); }
