/* ════════════════════════════════════════════════════════
   Notre Appart — Rétro 70s
   ════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;900&family=Fredoka+One&display=swap');

/* ─── Tokens ─────────────────────────────────────────── */
:root {
  --creme:       #F5EFE0;
  --creme-dark:  #EDE4CE;
  --orange:      #E8621A;
  --orange-soft: #F2834B;
  --orange-pale: #FAE0CE;
  --vert:        #4A8C5C;
  --vert-pale:   #D4EDDA;
  --bleu:        #3A6B9E;
  --bleu-pale:   #D0E4F7;
  --terra:       #C0392B;
  --terra-pale:  #FAD5D0;
  --ambre:       #D4820A;
  --ambre-pale:  #FDF0D0;
  --chrome:      #B8C4CC;
  --ink:         #2C1F0E;
  --ink-soft:    #5C4A32;
  --ink-muted:   #9A8572;

  --radius-sm:   12px;
  --radius-md:   20px;
  --radius-lg:   28px;
  --radius-xl:   40px;

  --shadow-card: 0 4px 20px rgba(44,31,14,.10), 0 1px 4px rgba(44,31,14,.06);
  --shadow-lift: 0 8px 32px rgba(44,31,14,.16), 0 2px 8px rgba(44,31,14,.08);

  --font-display: 'Fredoka One', cursive;
  --font-body:    'Nunito', sans-serif;
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  background: var(--creme);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 80px; /* nav height */
}
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ─── Typography ─────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
h1 { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; }
h2 { font-family: var(--font-display); font-size: 1.4rem; }
h3 { font-size: 1rem; font-weight: 700; }

/* ─── Layout ─────────────────────────────────────────── */
.page { display: none; flex-direction: column; gap: 20px; padding: 20px 16px; max-width: 480px; margin: 0 auto; }
.page.active { display: flex; }

/* ─── Top bar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--creme);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--creme-dark);
}
.topbar-title { font-family: var(--font-display); font-size: 1.3rem; color: var(--orange); }
.topbar-user {
  display: flex; gap: 4px;
}
.user-btn {
  padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: .85rem;
  border: 2px solid transparent; transition: all .2s;
}
.user-btn.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.user-btn:not(.active) { background: transparent; color: var(--ink-muted); border-color: var(--creme-dark); }
.user-btn:hover:not(.active) { border-color: var(--orange-soft); color: var(--orange); }

/* ─── Bottom nav ─────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--creme);
  border-top: 2px solid var(--creme-dark);
  display: flex; height: 72px;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; color: var(--ink-muted); font-size: .7rem; font-weight: 700;
  border-radius: 0; transition: color .2s;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.nav-item.active { color: var(--orange); }
.nav-item .badge {
  position: absolute; top: 8px; right: 22%;
  background: var(--terra); color: #fff; font-size: .65rem; font-weight: 900;
  width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.nav-item { position: relative; }

/* ─── FAB ────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 84px; right: 20px; z-index: 110;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--orange); color: #fff;
  font-size: 1.8rem; line-height: 1;
  box-shadow: 0 4px 16px rgba(232,98,26,.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(232,98,26,.5); }
.fab:active { transform: scale(.96); }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 16px;
}

/* ─── Dashboard ──────────────────────────────────────── */
.dash-header { text-align: center; padding: 8px 0; }
.dash-header p { color: var(--ink-muted); font-size: .95rem; margin-top: 4px; }

.progress-ring-wrap { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 4px 0; }
.progress-ring { width: 100px; height: 100px; }
.ring-track { fill: none; stroke: var(--creme-dark); stroke-width: 10; }
.ring-bar   { fill: none; stroke: var(--orange); stroke-width: 10; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset .6s ease; }
.ring-label { font-family: var(--font-display); font-size: 1.5rem; fill: var(--ink); }
.ring-sub   { font-size: .6rem; fill: var(--ink-muted); }

.ring-stats { display: flex; flex-direction: column; gap: 8px; }
.ring-stat  { font-size: .82rem; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: #fff; border-radius: var(--radius-md); padding: 14px;
  box-shadow: var(--shadow-card); text-align: center;
}
.stat-card .big { font-family: var(--font-display); font-size: 1.8rem; }
.stat-card .lbl { font-size: .75rem; color: var(--ink-muted); font-weight: 600; margin-top: 2px; }

.section-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--ink-soft); }

.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  background: #fff; border-radius: var(--radius-md); padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 12px; cursor: pointer;
}
.recent-item:hover { box-shadow: var(--shadow-lift); }
.recent-icon { font-size: 1.4rem; }
.recent-text .name { font-weight: 700; font-size: .9rem; }
.recent-text .meta { font-size: .75rem; color: var(--ink-muted); }

/* ─── Checklist ──────────────────────────────────────── */
.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  font-size: .78rem; font-weight: 700; border: 2px solid var(--creme-dark);
  background: #fff; color: var(--ink-muted); transition: all .2s;
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.besoin-group { display: flex; flex-direction: column; gap: 8px; }
.group-label { font-size: .7rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 4px 2px; }

.besoin-row {
  background: #fff; border-radius: var(--radius-md); padding: 12px 14px;
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  transition: box-shadow .2s;
}
.besoin-row:hover { box-shadow: var(--shadow-lift); }
.besoin-row.comble { border-left: 4px solid var(--vert); }
.besoin-row.en_discussion { border-left: 4px solid var(--ambre); }
.besoin-row.vide { border-left: 4px solid var(--creme-dark); }

.besoin-check { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  border: 2.5px solid var(--creme-dark); background: var(--creme);
  display: flex; align-items: center; justify-content: center; }
.besoin-row.comble .besoin-check { background: var(--vert); border-color: var(--vert); color: #fff; font-size: .9rem; }

.besoin-info { flex: 1; min-width: 0; }
.besoin-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.besoin-meta { font-size: .73rem; color: var(--ink-muted); margin-top: 2px; }

.prio-badge {
  flex-shrink: 0; font-size: .65rem; font-weight: 900;
  padding: 3px 8px; border-radius: 10px; text-transform: uppercase;
}
.prio-P1 { background: var(--terra-pale); color: var(--terra); }
.prio-P2 { background: var(--ambre-pale); color: var(--ambre); }
.prio-P3 { background: var(--vert-pale); color: var(--vert); }

/* ─── À valider (Tinder cards) ───────────────────────── */
.valider-empty {
  text-align: center; padding: 48px 24px;
  color: var(--ink-muted);
}
.valider-empty .big-emoji { font-size: 3rem; margin-bottom: 12px; }

.tinder-stack { position: relative; height: 420px; }
.tinder-card {
  position: absolute; inset: 0;
  background: #fff; border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
  transition: transform .25s ease, opacity .25s ease;
  display: flex; flex-direction: column;
}
.tinder-card.swipe-yes  { transform: translateX(120%) rotate(15deg); opacity: 0; }
.tinder-card.swipe-no   { transform: translateX(-120%) rotate(-15deg); opacity: 0; }

.tinder-img {
  height: 220px; background: var(--creme-dark);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.tinder-img img { width: 100%; height: 100%; object-fit: cover; }
.tinder-img .no-img { font-size: 4rem; }
.tinder-provenance {
  position: absolute; top: 12px; right: 12px;
  background: rgba(255,255,255,.92); border-radius: 20px;
  padding: 4px 10px; font-size: .72rem; font-weight: 700; color: var(--ink-soft);
}

.tinder-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tinder-besoin { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); }
.tinder-name { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.2; }
.tinder-details { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.tinder-chip {
  padding: 3px 10px; border-radius: 12px;
  font-size: .74rem; font-weight: 700; background: var(--creme); color: var(--ink-soft);
}
.tinder-chip.prix { background: var(--vert-pale); color: var(--vert); }
.tinder-chip.lien { background: var(--bleu-pale); color: var(--bleu); cursor: pointer; }
.tinder-by { font-size: .73rem; color: var(--ink-muted); margin-top: auto; }

.vote-buttons {
  display: flex; gap: 16px; padding: 16px; padding-top: 0;
}
.vote-btn {
  flex: 1; padding: 14px; border-radius: var(--radius-lg);
  font-family: var(--font-display); font-size: 1.2rem;
  transition: transform .15s, box-shadow .15s;
}
.vote-btn:active { transform: scale(.95); }
.vote-non { background: var(--terra-pale); color: var(--terra); }
.vote-non:hover { background: var(--terra); color: #fff; box-shadow: 0 4px 16px rgba(192,57,43,.3); }
.vote-oui { background: var(--vert-pale); color: var(--vert); }
.vote-oui:hover { background: var(--vert); color: #fff; box-shadow: 0 4px 16px rgba(74,140,92,.3); }

.tinder-count { text-align: center; font-size: .8rem; color: var(--ink-muted); font-weight: 600; }

/* ─── Inventaire ─────────────────────────────────────── */
.inventaire-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inv-card {
  background: #fff; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card); cursor: pointer; transition: box-shadow .2s;
}
.inv-card:hover { box-shadow: var(--shadow-lift); }
.inv-card-img {
  height: 120px; background: var(--creme-dark);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 2.5rem;
}
.inv-card-img img { width: 100%; height: 100%; object-fit: cover; }
.inv-card-body { padding: 10px; }
.inv-card-name { font-weight: 700; font-size: .85rem; }
.inv-card-cat { font-size: .7rem; color: var(--ink-muted); margin-top: 2px; }
.inv-badge { font-size: .65rem; font-weight: 900; padding: 2px 7px; border-radius: 8px; background: var(--vert-pale); color: var(--vert); margin-top: 4px; display: inline-block; }
.inv-prix { font-size: .8rem; font-weight: 700; color: var(--vert); margin-top: 4px; }

.inventaire-empty { text-align: center; padding: 40px 16px; color: var(--ink-muted); grid-column: 1/-1; }

/* ─── Modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(44,31,14,.55);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--creme); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: 20px 20px 32px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(30px); transition: transform .25s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--chrome); margin: 0 auto 16px; }
.modal-title { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 16px; }
.modal-close { float: right; background: none; color: var(--ink-muted); font-size: 1.4rem; line-height: 1; margin-top: -2px; }

/* ─── Form ───────────────────────────────────────────── */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.form-field input,
.form-field select,
.form-field textarea {
  background: #fff; border: 2px solid var(--creme-dark); border-radius: var(--radius-md);
  padding: 10px 14px; font-family: var(--font-body); font-size: .9rem; color: var(--ink);
  outline: none; transition: border-color .2s; width: 100%;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--orange); }
.form-field textarea { resize: vertical; min-height: 80px; }

.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-sep { border: none; border-top: 2px solid var(--creme-dark); margin: 4px 0; }

.btn-primary {
  width: 100%; padding: 14px; border-radius: var(--radius-lg);
  background: var(--orange); color: #fff;
  font-family: var(--font-display); font-size: 1.1rem;
  transition: background .2s, transform .15s;
}
.btn-primary:hover { background: var(--orange-soft); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  width: 100%; padding: 12px; border-radius: var(--radius-lg);
  background: var(--creme-dark); color: var(--ink-soft);
  font-family: var(--font-display); font-size: 1rem;
  transition: background .2s;
}
.btn-secondary:hover { background: var(--chrome); }

.pick-type { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.pick-btn {
  padding: 20px 12px; border-radius: var(--radius-xl);
  border: 2.5px solid var(--creme-dark); background: #fff;
  text-align: center; cursor: pointer; transition: all .2s;
}
.pick-btn:hover { border-color: var(--orange); }
.pick-btn .pick-icon { font-size: 2rem; margin-bottom: 8px; }
.pick-btn .pick-label { font-family: var(--font-display); font-size: 1rem; }
.pick-btn .pick-sub { font-size: .72rem; color: var(--ink-muted); margin-top: 4px; }

/* ─── Detail panel ───────────────────────────────────── */
.detail-img {
  height: 200px; background: var(--creme-dark); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; font-size: 4rem; margin-bottom: 12px;
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; }

.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--creme-dark); font-size: .88rem; }
.detail-row .dk { font-weight: 700; color: var(--ink-soft); }
.detail-row .dv { color: var(--ink); text-align: right; }

.props-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.prop-item {
  background: #fff; border-radius: var(--radius-md); padding: 12px;
  box-shadow: var(--shadow-card); display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.prop-item:hover { box-shadow: var(--shadow-lift); }
.prop-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.prop-status.valide { background: var(--vert); }
.prop-status.en_attente { background: var(--ambre); }
.prop-status.refuse { background: var(--terra); }
.prop-info { flex: 1; }
.prop-name { font-weight: 700; font-size: .87rem; }
.prop-meta { font-size: .72rem; color: var(--ink-muted); }
.prop-prix { font-size: .85rem; font-weight: 700; color: var(--vert); }

/* ─── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; border-radius: 20px;
  padding: 10px 20px; font-size: .85rem; font-weight: 600;
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; white-space: nowrap;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--vert); }
.toast.error   { background: var(--terra); }

/* ─── Notif panel ─────────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  background: #fff; border-radius: var(--radius-md); padding: 12px 14px;
  box-shadow: var(--shadow-card); font-size: .83rem;
  display: flex; gap: 10px; align-items: flex-start;
}
.notif-item.unread { border-left: 3px solid var(--orange); background: var(--orange-pale); }
.notif-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.notif-msg { flex: 1; line-height: 1.4; }
.notif-time { font-size: .7rem; color: var(--ink-muted); margin-top: 4px; }

/* ─── Comment thread ─────────────────────────────────── */
.comment-box { background: var(--creme-dark); border-radius: var(--radius-md); padding: 12px; font-size: .83rem; color: var(--ink-soft); white-space: pre-wrap; }

/* ─── Loader ─────────────────────────────────────────── */
.loading { text-align: center; padding: 40px; color: var(--ink-muted); font-weight: 600; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--chrome); border-radius: 2px; }

/* ─── Utils ─────────────────────────────────────────── */
.gap-12 { display: flex; flex-direction: column; gap: 12px; }
.text-center { text-align: center; }
.text-muted  { color: var(--ink-muted); }
.text-sm     { font-size: .8rem; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
