/* =====================================================================
   wear.byalexm — mobile-first styles (Phase A)
   ===================================================================== */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1c1b1a;
  --ink-soft: #6b6760;
  --line: #e7e4de;
  --accent: #14110f;        /* near-black, editorial */
  --accent-ink: #ffffff;
  --gold: #b7935b;
  --ok: #2f7d4f;
  --err: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --maxw: 1100px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; margin: 0 0 .4em; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

/* ---- buttons ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  padding: 12px 18px; border-radius: 999px; line-height: 1;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn--sm { padding: 8px 12px; font-size: .85rem; }
.btn--block { width: 100%; }

/* ---- forms ---- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.form input, .form select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; width: 100%;
}
.form input:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form__msg { min-height: 1.2em; font-size: .85rem; font-weight: 600; }
.form__msg--error { color: var(--err); }
.form__msg--ok { color: var(--ok); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: .8rem; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.btn--google {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.btn--google svg { width: 18px; height: 18px; }

/* ---- auth pages ---- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 28px 18px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 26px; width: 100%; max-width: 400px;
}
.brand { font-weight: 750; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand small { color: var(--gold); font-weight: 600; }
.auth-card h1 { font-size: 1.5rem; margin-top: 14px; }
.auth-sub { color: var(--ink-soft); margin: -6px 0 18px; font-size: .92rem; }
.auth-links { margin-top: 16px; display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; }
.auth-links a { color: var(--ink-soft); text-decoration: none; }
.auth-links a:hover { color: var(--ink); text-decoration: underline; }
.auth-alt { margin-top: 18px; text-align: center; font-size: .9rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }

/* ---- app header ---- */
.appbar {
  position: sticky; top: 0; z-index: 20; background: rgba(247,246,243,.86);
  backdrop-filter: saturate(1.2) blur(8px); border-bottom: 1px solid var(--line);
}
.appbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.appbar__brand { font-weight: 750; letter-spacing: -0.02em; text-decoration: none; }
.appbar__brand small { color: var(--gold); }
.appbar__right { display: flex; align-items: center; gap: 14px; }
.appbar__greeting { font-size: .9rem; color: var(--ink-soft); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- stats bar ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat__value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.stat__label { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* ---- toolbar ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; flex-wrap: wrap; }
.toolbar h2 { font-size: 1.05rem; margin: 0; }
.toolbar__right { display: flex; align-items: center; gap: 10px; }
.toolbar select { font: inherit; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--surface); }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; appearance: none; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
}
.chip--on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip__n { opacity: .6; font-weight: 500; }

/* ---- wardrobe grid ---- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding-bottom: 80px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card__imgwrap { position: relative; aspect-ratio: 1 / 1; background: #efece6; }
.card__img { width: 100%; height: 100%; object-fit: cover; }
.card__img--ph { display: grid; place-items: center; font-size: 2.4rem; }
.card__cat { position: absolute; left: 8px; top: 8px; background: rgba(20,17,15,.78); color: #fff; font-size: .7rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.card__body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__name { font-size: .98rem; margin: 0; line-height: 1.25; }
.card__meta { font-size: .8rem; color: var(--ink-soft); margin: -4px 0 0; }
.card__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; }
.card__stat { display: flex; flex-direction: column; }
.card__stat-v { font-weight: 700; font-size: .9rem; }
.card__stat-l { font-size: .68rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.card__worn { font-size: .76rem; color: var(--ink-soft); margin: 0; }
.card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card__actions .btn { flex: 1 0 auto; }

.empty { grid-column: 1 / -1; text-align: center; padding: 50px 20px; color: var(--ink-soft); display: grid; gap: 8px; justify-items: center; }
.empty__title { font-size: 1.1rem; font-weight: 650; color: var(--ink); }

/* ---- floating add button (mobile) ---- */
.fab { position: fixed; right: 18px; bottom: 18px; z-index: 30; box-shadow: 0 6px 18px rgba(0,0,0,.22); }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: flex-end; justify-content: center; background: rgba(20,17,15,.45); }
.modal.open { display: flex; }
.modal__panel { background: var(--surface); width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal__head h2 { margin: 0; font-size: 1.15rem; }
.modal__x { appearance: none; border: 0; background: transparent; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.photo-pick { display: grid; gap: 6px; }
.photo-preview {
  aspect-ratio: 4 / 3; border: 1.5px dashed var(--line); border-radius: 12px; background: #f1efe9 center/cover no-repeat;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-soft); font-size: .9rem; text-align: center;
}
.photo-preview.has-img { border-style: solid; color: transparent; }
.photo-preview .ph-hint { padding: 16px; }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .modal { align-items: center; }
  .modal__panel { border-radius: 18px; }
  .fab { display: none; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* =====================================================================
   Phase B — nav tabs, dashboard, achievements, rediscover, toasts
   ===================================================================== */

/* ---- nav tabs in the appbar ---- */
.tabs { display: flex; gap: 4px; background: #ece9e3; padding: 3px; border-radius: 999px; }
.tab { text-decoration: none; font-size: .85rem; font-weight: 600; color: var(--ink-soft); padding: 7px 14px; border-radius: 999px; line-height: 1; white-space: nowrap; }
.tab--on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.appbar__brand small { color: var(--gold); }
@media (max-width: 480px) {
  .appbar__brand small { display: none; }
  .tab { padding: 7px 11px; }
  .appbar__logout { padding: 7px 10px; }
}

/* ---- dashboard ---- */
.dash-hello { font-size: 1.4rem; margin: 22px 0 16px; }

.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.hero-card--streak { background: linear-gradient(135deg, #1c1b1a, #34302b); color: #fff; border-color: transparent; }
.hero-card__top { display: flex; align-items: center; justify-content: space-between; }
.hero-card__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.hero-card--streak .hero-card__label { color: rgba(255,255,255,.66); }
.level-badge { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: .95rem; }
.xpbar { height: 9px; background: #ece9e3; border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.xpbar__fill { height: 100%; background: linear-gradient(90deg, var(--gold), #d8b27d); border-radius: 999px; transition: width .5s ease; }
.hero-card__sub { font-size: .8rem; color: var(--ink-soft); }
.hero-card--streak .hero-card__sub { color: rgba(255,255,255,.72); }
.streak-num { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; margin: 6px 0 4px; }
.streak-fire { font-size: 1.6rem; }

.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 26px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.mini__v { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.mini__l { font-size: .74rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }

.dash-section { margin-bottom: 30px; }
.dash-section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.dash-section__head h2 { font-size: 1.1rem; margin: 0; }
.dash-section__hint { font-size: .85rem; margin: 0 0 12px; }

/* ---- rediscover strip ---- */
.rediscover-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.rd { flex: 0 0 138px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.rd__img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #efece6; }
.rd__img--ph { display: grid; place-items: center; font-size: 2rem; }
.rd__name { font-weight: 600; font-size: .85rem; padding: 8px 8px 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd__sub { font-size: .72rem; color: var(--err); padding: 2px 8px 8px; }
.rd__btn { width: calc(100% - 16px); margin: 0 8px 8px; }

/* ---- achievements ---- */
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.badge { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; opacity: .62; filter: grayscale(.7); }
.badge--on { opacity: 1; filter: none; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, var(--shadow); }
.badge__icon { font-size: 1.9rem; line-height: 1; }
.badge__name { font-weight: 700; font-size: .92rem; margin-top: 6px; }
.badge__desc { font-size: .76rem; color: var(--ink-soft); margin-top: 2px; }
.badge__bar { height: 6px; background: #ece9e3; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.badge__bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.badge__prog { font-size: .72rem; color: var(--ink-soft); font-weight: 600; }
.badge__check { font-size: .74rem; color: var(--gold); font-weight: 700; margin-top: 8px; }

/* ---- activity ---- */
.activity { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.activity__row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.activity__row:last-child { border-bottom: 0; }
.activity__name { font-weight: 600; }
.activity__when { color: var(--ink-soft); font-size: .82rem; }
.activity__empty { padding: 18px 14px; color: var(--ink-soft); font-size: .9rem; text-align: center; }

/* ---- toasts ---- */
.toast-host { position: fixed; left: 0; right: 0; bottom: 18px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 92vw; background: var(--accent); color: #fff; font-size: .88rem; font-weight: 600; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.22); opacity: 0; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast--ok { background: var(--ok); }
.toast--badge { background: linear-gradient(135deg, var(--gold), #ca9a64); }

@media (min-width: 640px) {
  .hero-cards { grid-template-columns: 1fr 1fr; }
  .mini-stats { grid-template-columns: repeat(4, 1fr); }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
}
