/* Outfit AI — feuille de style unique.
   Objectif : beaucoup d'espace, peu de couleurs, lisible d'un coup d'œil à 7h
   du matin sur un téléphone. */

:root {
  --bg: #FBFAF8;
  --surface: #FFFFFF;
  --surface-alt: #F4F2EE;
  --text: #16181C;
  --text-soft: #5A6069;
  --muted: #8A8F98;
  --border: #E7E3DC;
  --border-strong: #D6D1C7;
  --accent: #2F5D8C;
  --accent-soft: #EAF1F8;
  --good: #2E7D5B;
  --bad: #B3453C;
  --warn: #B5822A;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .04), 0 8px 24px rgba(20, 22, 26, .05);
  --shadow-lift: 0 2px 4px rgba(20, 22, 26, .05), 0 16px 40px rgba(20, 22, 26, .09);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --nav-h: 62px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1A1C20;
    --surface-alt: #23262B;
    --text: #ECEDEF;
    --text-soft: #A8ADB5;
    --muted: #7C828B;
    --border: #2B2F35;
    --border-strong: #3A3F47;
    --accent: #7FAFD8;
    --accent-soft: #1E2A36;
    --good: #6FC79B;
    --bad: #E08279;
    --warn: #DBAE5E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 620; letter-spacing: -.017em; line-height: 1.22; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .95rem; }

p { margin: 0; }

/* ---------------------------------------------------------------- layout */

.shell { max-width: 820px; margin: 0 auto; padding: 22px 18px 40px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 820px; margin: 0 auto;
  padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.02em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #9ec3e2));
  display: grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 700;
}
.desk-nav { display: none; gap: 4px; }
.desk-nav a {
  padding: 7px 13px; border-radius: 999px; font-size: .88rem;
  color: var(--text-soft); transition: background .18s ease, color .18s ease;
}
.desk-nav a:hover { background: var(--surface-alt); color: var(--text); }
.desk-nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 560; }

/* barre d'onglets mobile */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: .68rem; color: var(--muted); letter-spacing: .01em;
  transition: color .18s ease;
}
.tabbar a svg { width: 21px; height: 21px; stroke-width: 1.7; }
.tabbar a.active { color: var(--accent); }

@media (min-width: 720px) {
  .desk-nav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
  h1 { font-size: 1.95rem; }
}

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.section { margin-top: 26px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.section-head h2 { font-size: .82rem; text-transform: uppercase; letter-spacing: .085em; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.soft { color: var(--text-soft); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- météo */

.weather {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.weather-emoji { font-size: 2.5rem; line-height: 1; }
.weather-main { flex: 1; min-width: 0; }
.weather-temp { font-size: 2rem; font-weight: 640; letter-spacing: -.03em; line-height: 1.05; }
.weather-desc { color: var(--text-soft); font-size: .93rem; margin-top: 2px; }
.weather-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .82rem; color: var(--muted); }

.periods {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px;
}
.period { text-align: center; }
.period-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.period-emoji { font-size: 1.1rem; margin: 3px 0; }
.period-temp { font-size: .95rem; font-weight: 570; }
.period-rain { font-size: .7rem; color: var(--accent); }

/* ---------------------------------------------------------------- tenue */

.outfit-title { font-size: 1.35rem; font-weight: 640; letter-spacing: -.022em; }

.pieces { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.piece {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.piece:last-child { border-bottom: 0; }
.piece-thumb {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 11px;
  background: var(--surface-alt); display: grid; place-items: center;
  font-size: 1.25rem; overflow: hidden; border: 1px solid var(--border);
}
.piece-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.piece-body { flex: 1; min-width: 0; }
.piece-name { font-weight: 545; font-size: .96rem; }
.piece-meta { font-size: .79rem; color: var(--muted); margin-top: 1px; }
.piece-slot { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.swatch {
  width: 15px; height: 15px; border-radius: 5px; flex: 0 0 15px;
  border: 1px solid rgba(0,0,0,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}

.why {
  margin-top: 16px; padding: 15px 16px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
  font-size: .93rem; line-height: 1.6; color: var(--text);
}
.why strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 5px; font-weight: 640; }

.score-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.score-bar { flex: 1; height: 5px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.score-val { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 17px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: .9rem; font-weight: 530; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .1s ease, opacity .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { background: var(--surface-alt); }
.btn:active:not(:disabled) { transform: scale(.983); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; }
.actions .btn { flex: 1; min-width: 118px; }

/* ----------------------------------------------------------------- tags */

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-alt); color: var(--text-soft);
  font-size: .74rem; font-weight: 500; white-space: nowrap;
}
.tag-accent { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------ garde-robe */

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }

.gcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: box-shadow .2s ease, transform .2s ease;
}
.gcard:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.gcard.is-off { opacity: .5; }
.gcard-img {
  aspect-ratio: 1 / 1; background: var(--surface-alt);
  display: grid; place-items: center; font-size: 2.2rem;
  position: relative; overflow: hidden;
}
/* L'image est sortie du flux : sinon sa hauteur intrinsèque dimensionne la
   grille, `aspect-ratio` est ignoré et une photo portrait déborde sur le titre. */
.gcard-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.gcard-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.gcard-name { font-size: .88rem; font-weight: 560; line-height: 1.3; }
.gcard-brand { font-size: .72rem; color: var(--muted); }
.gcard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }
.gcard-off {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.62); color: #fff; font-size: .64rem;
  padding: 2px 7px; border-radius: 999px; letter-spacing: .04em;
}

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: .82rem; white-space: nowrap; cursor: pointer;
  font-family: inherit; color: var(--text-soft); transition: all .16s ease;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------ formulaire */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: .82rem; font-weight: 560; color: var(--text-soft); }
.field .hint { font-size: .76rem; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=search],
select, textarea {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 16px; /* 16px : évite le zoom auto sur iOS */
  transition: border-color .16s ease, box-shadow .16s ease;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%238A8F98' stroke-width='1.6' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: .82rem; cursor: pointer; font-family: inherit;
  color: var(--text-soft); user-select: none; transition: all .15s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 540; }

.scale { display: flex; gap: 6px; }
.scale button {
  flex: 1; padding: 9px 0; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); font-family: inherit; font-size: .85rem; cursor: pointer;
  color: var(--text-soft); transition: all .15s ease;
}
.scale button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 560; }
.scale-legend { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: 3px; }

.photo-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 22px; text-align: center; cursor: pointer; background: var(--surface-alt);
  transition: border-color .18s ease, background .18s ease;
}
.photo-drop:hover { border-color: var(--accent); }
.photo-preview { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.photo-preview img { width: 100%; display: block; max-height: 320px; object-fit: cover; }

/* --------------------------------------------------------------- toasts */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 400px);
}
@media (min-width: 720px) { .toasts { bottom: 22px; } }
.toast {
  padding: 12px 15px; border-radius: 12px; font-size: .88rem;
  background: #1D2025; color: #fff; box-shadow: var(--shadow-lift);
  animation: toast-in .26s cubic-bezier(.2,.8,.3,1);
}
.toast.err { background: var(--bad); }
.toast.ok { background: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- divers */

.empty { text-align: center; padding: 52px 22px; }
.empty-emoji { font-size: 2.6rem; margin-bottom: 12px; }
.empty h2 { font-size: 1.18rem; margin-bottom: 7px; text-transform: none; letter-spacing: -.02em; color: var(--text); }
.empty p { color: var(--muted); font-size: .92rem; max-width: 340px; margin: 0 auto 20px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, color-mix(in srgb, var(--surface-alt) 55%, var(--surface)) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.hist { display: flex; gap: 13px; padding: 15px 16px; align-items: flex-start; border-bottom: 1px solid var(--border); }
.hist:last-child { border-bottom: 0; }
.hist-date { flex: 0 0 46px; text-align: center; }
.hist-day { font-size: 1.2rem; font-weight: 620; line-height: 1; }
.hist-mon { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hist-body { flex: 1; min-width: 0; }
.hist-outfit { font-size: .9rem; font-weight: 520; }
.hist-meta { font-size: .77rem; color: var(--muted); margin-top: 2px; }
.hist-rate { font-size: 1rem; flex: 0 0 auto; }

.login-wrap { min-height: 78vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(100%, 380px); }

.divider { height: 1px; background: var(--border); margin: 22px 0; border: 0; }

details.adv > summary {
  cursor: pointer; font-size: .85rem; color: var(--accent); padding: 8px 0;
  list-style: none; font-weight: 530;
}
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; display: inline-block; transition: transform .2s ease; }
details.adv[open] > summary::before { transform: rotate(90deg); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: .87rem; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 520; text-align: right; }

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

/* ------------------------------------------------- discussion styliste */

.ask { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.ask-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; }
.ask-row .btn { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; }
.ask-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.ask-suggestions button {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-soft); font-family: inherit;
  font-size: .78rem; cursor: pointer; transition: all .15s ease;
}
.ask-suggestions button:hover { background: var(--surface-alt); border-color: var(--accent); color: var(--accent); }
.ask-reply {
  margin-top: 12px; padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--surface-alt); font-size: .91rem; line-height: 1.55;
  animation: toast-in .25s cubic-bezier(.2,.8,.3,1);
}
