/* ═══════════════════════════════════════════════
   LA MAISON — dashboard Rafael & Lucie
   Thème : SAISONS PASTEL (doux, couple, mignon —
   palette qui change tout seule selon le mois :
   été/automne/hiver/printemps). Typo : Baloo 2 + Nunito.
   ═══════════════════════════════════════════════ */

:root {
  --ink: #3A3542;
  --muted: #9A93A0;
  --card: #FFFFFF;
  --border: #F1EBEE;
  --danger: #E0776E;
  --rafael: #F6C9B8;
  --on-rafael: #8A4A32;
  --lucie: #D9D3F2;
  --on-lucie: #564D8F;
  --both: #D3ECDC;
  --on-both: #4A7B5D;
  --radius: 22px;
  --nav-h: 64px;
  --shadow: 0 2px 14px rgba(90,70,90,.05);
}

/* ── Été (juin-août) : pêche pastel, aqua pastel ── */
[data-season="summer"] {
  --primary: #E8987C;
  --on-primary: #fff;
  --grad1: #FBE0D2;
  --grad1-fg: #9A5A3E;
  --grad2: #D6EFE9;
  --grad2-fg: #3E8072;
  --bg: #FFF9F5;
  --green: #6FAB92;
  --season-emoji: "☀️";
}
/* ── Automne (sept-nov) : terracotta pastel, sauge pastel ── */
[data-season="autumn"] {
  --primary: #D99A72;
  --on-primary: #fff;
  --grad1: #F3DCC4;
  --grad1-fg: #8A5A2E;
  --grad2: #DCE6D2;
  --grad2-fg: #5A7A4A;
  --bg: #FBF4EB;
  --green: #7C9A6A;
  --season-emoji: "🍂";
}
/* ── Hiver (déc-fév) : bleu poudré, lilas pastel ── */
[data-season="winter"] {
  --primary: #9AB6DE;
  --on-primary: #fff;
  --grad1: #DCE7F5;
  --grad1-fg: #4A6C99;
  --grad2: #E6DCF2;
  --grad2-fg: #6B569A;
  --bg: #F8FAFD;
  --green: #7FA6B8;
  --season-emoji: "❄️";
}
/* ── Printemps (mars-mai) : vert menthe pastel, rose fleur pastel ── */
[data-season="spring"] {
  --primary: #7FC49A;
  --on-primary: #fff;
  --grad1: #DCF0E2;
  --grad1-fg: #3E7A56;
  --grad2: #F6DCE6;
  --grad2-fg: #A85B7E;
  --bg: #F8FCF7;
  --green: #6FAF87;
  --season-emoji: "🌸";
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}
h1, h2, h3, .top-title, .stat-num, .hist-total, .charge-amount, .total-banner .tb-num, #topClock, .month-nav .month-label {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 16px;
  border: 1.5px solid #D8D5CE; border-radius: 12px;
  padding: 10px 12px; background: #fff; color: var(--ink);
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #B4B1AA; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
label { font-weight: 700; font-size: 14px; display: block; margin: 12px 0 4px; }

/* ═══ LOCK SCREEN ═══ */
#lockScreen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--grad1);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lock-card {
  background: #fff; border-radius: 28px; padding: 40px 32px;
  text-align: center; max-width: 380px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.15);
}
.lock-emoji { font-size: 64px; }
.lock-card h1 { font-size: 32px; margin: 8px 0 4px; color: var(--ink); }
.lock-card p { color: var(--muted); margin-bottom: 24px; }
.lock-msg { margin-top: 16px; color: var(--danger); font-weight: 700; min-height: 22px; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; padding: 11px 18px;
  font-weight: 800; font-size: 15px;
  transition: opacity .15s ease, transform .1s ease;
  min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-green { background: var(--green); color: #fff; }
.btn-coral { background: var(--grad1); color: var(--grad1-fg); }
.btn-ghost { background: #F1EFE7; color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-big { width: 100%; font-size: 17px; padding: 14px; }
.btn:hover { opacity: .88; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background .15s ease;
}
.icon-btn:hover { background: #F1EFE7; }

/* ═══ TOPBAR ═══ */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  gap: 8px;
}
.top-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.top-title { font-size: 21px; font-weight: 700; white-space: nowrap; color: var(--ink); }
#topDate { color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 10px; }
#topWeather { font-size: 15px; font-weight: 700; white-space: nowrap; }
#topClock { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }

/* ═══ LAYOUT ═══ */
#views { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } .btn:active { transform: none; } }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { font-size: 19px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink); }
.card h2 .h2-action { font-size: 14px; font-family: 'Nunito'; font-weight: 800; color: var(--primary); }
.section-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* ═══ NAV ═══ */
#bottomNav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--card); box-shadow: 0 -2px 12px rgba(43,42,56,.06);
  display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 12px; font-weight: 700;
  transition: color .15s ease; max-width: 120px;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn.active { color: var(--primary); }
.nav-btn span { font-size: 12.5px; }

/* ═══ TASKS ═══ */
.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 30px; height: 30px; min-width: 30px; border-radius: 50%;
  border: 2.5px solid #D8D5CE; background: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.task-check svg { width: 18px; height: 18px; opacity: 0; color: #fff; transition: opacity .15s ease; }
.task-row.done .task-check { background: var(--green); border-color: var(--green); }
.task-row.done .task-check svg { opacity: 1; }
.task-label { flex: 1; font-weight: 700; }
.task-row.done .task-label { text-decoration: line-through; color: var(--muted); }
.task-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; display: block; }
.task-row.late .task-sub { color: var(--danger); }
.task-row.late .task-check { border-color: var(--danger); }
.chip {
  font-size: 12px; font-weight: 800; border-radius: 99px;
  padding: 4px 12px; white-space: nowrap;
}
.chip.rafael { background: var(--rafael); color: var(--on-rafael); }
.chip.lucie { background: var(--lucie); color: var(--on-lucie); }
.chip.both { background: var(--both); color: var(--on-both); }
.done-by { font-size: 11.5px; color: var(--green); font-weight: 800; display: inline-block; width: 100%; text-decoration: none; }

/* ═══ ACCUEIL ═══ */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat-card .stat-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat-card .stat-num { font-size: 25px; font-weight: 700; margin-top: 2px; color: var(--ink); }
.stat-card .stat-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-card.blue { background: var(--grad1); }
.stat-card.blue .stat-label, .stat-card.blue .stat-sub { color: var(--grad1-fg); opacity: .8; }
.stat-card.blue .stat-num { color: var(--grad1-fg); }
.stat-card.green { background: var(--grad2); }
.stat-card.green .stat-label, .stat-card.green .stat-sub { color: var(--grad2-fg); opacity: .8; }
.stat-card.green .stat-num { color: var(--grad2-fg); }
.stat-card.coral .stat-num { color: var(--primary); }
.stat-card.purple .stat-num { color: var(--on-lucie); }

.note-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.note-row:last-child { border-bottom: none; }
.note-text { flex: 1; font-weight: 600; }
.note-meta { font-size: 11.5px; color: var(--muted); font-weight: 700; display: block; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; }
.add-row .btn { min-width: 48px; padding: 10px; }

.empty { text-align: center; color: var(--muted); font-weight: 600; padding: 18px 8px; }
.empty .empty-emoji { font-size: 34px; display: block; margin-bottom: 6px; }

/* ═══ COURSES ═══ */
.subtabs { display: flex; gap: 6px; margin-bottom: 14px; background: #F1EFE7; border-radius: 14px; padding: 4px; }
.subtab {
  flex: 1; padding: 9px 4px; border-radius: 11px; font-weight: 800; font-size: 14px;
  color: var(--muted); transition: background .15s ease, color .15s ease; min-height: 40px;
}
.subtab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.shop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--border); min-height: 50px;
}
.shop-item:last-child { border-bottom: none; }
.shop-item .task-label { font-weight: 700; }
.shop-item.checked .task-label { text-decoration: line-through; color: var(--muted); }
.shop-item.checked .task-check { background: var(--green); border-color: var(--green); }
.shop-item.checked .task-check svg { opacity: 1; }
.catalog-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.catalog-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: #F1EFE7; border-radius: 99px; padding: 8px 14px;
  font-weight: 700; font-size: 14px; min-height: 40px; color: var(--ink);
  transition: background .15s ease;
}
.catalog-item:hover { background: #E8E4D8; }
.catalog-item.inlist { background: #E3F6EC; color: var(--green); }
.catalog-item .plus { font-weight: 900; color: var(--primary); }
.catalog-item.inlist .plus { color: var(--green); }

.hist-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--border); width: 100%; text-align: left;
  min-height: 56px;
}
.hist-row:last-child { border-bottom: none; }
.hist-main { flex: 1; min-width: 0; }
.hist-title { font-weight: 800; }
.hist-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.hist-total { font-size: 20px; font-weight: 700; white-space: nowrap; color: var(--primary); }
.split-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin-top: 6px; background: #F1EFE7; }
.split-bar .sr { background: var(--rafael); }
.split-bar .sl { background: var(--lucie); }
.legend { display: flex; gap: 14px; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 4px; }

.rank-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-num { font-family: 'Baloo 2', sans-serif; font-weight: 700; color: var(--muted); width: 22px; }
.rank-label { flex: 1; font-weight: 700; }
.rank-val { font-weight: 800; white-space: nowrap; }

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.month-nav .month-label { font-size: 19px; font-weight: 700; text-transform: capitalize; }

.ticket-photo { max-width: 100%; border-radius: 14px; margin-top: 10px; }

/* ═══ CHARGES ═══ */
.charge-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px solid var(--border); min-height: 56px;
}
.charge-row:last-child { border-bottom: none; }
.charge-icon { font-size: 22px; width: 32px; text-align: center; }
.charge-main { flex: 1; min-width: 0; }
.charge-label { font-weight: 800; }
.charge-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.charge-amount { font-size: 19px; font-weight: 700; white-space: nowrap; }
.charge-row.paid .charge-amount { color: var(--green); }
.charge-row.paid .task-check { background: var(--green); border-color: var(--green); }
.charge-row.paid .task-check svg { opacity: 1; }
.charge-amount-input { width: 90px; text-align: right; padding: 8px; }
.total-banner {
  background: var(--grad1); color: var(--grad1-fg); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; text-align: center;
}
.total-banner .tb-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.total-banner .tb-num { font-size: 34px; font-weight: 700; }
.total-banner .tb-sub { font-size: 13px; font-weight: 700; opacity: .8; }

/* ═══ MODAL ═══ */
#modalBackdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(43,42,56,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
#modalBox {
  background: #fff; border-radius: 24px 24px 0 0;
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #modalBox { animation: none; } }
#modalBox h3 { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 10px 6px; border-radius: 12px; border: 1.5px solid #D8D5CE;
  font-weight: 800; font-size: 14px; color: var(--muted); background: #fff; min-height: 44px;
}
.seg button.on { border-color: var(--primary); background: #FFF1EA; color: var(--primary); }
.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }

/* ═══ TOAST ═══ */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; border-radius: 14px;
  padding: 11px 18px; font-weight: 700; font-size: 14.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
  z-index: 60; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }

/* ═══ TV / GRAND ÉCRAN ═══ */
@media (min-width: 1100px) {
  :root { --nav-h: 0px; }
  body { font-size: 18px; }
  #topbar { padding: 16px 32px; }
  .top-title { font-size: 27px; }
  #topClock { font-size: 30px; }
  #topDate, #topWeather { font-size: 18px; }
  #views { max-width: 1400px; padding: 28px 32px 40px; }
  #bottomNav {
    top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
    width: auto; height: 62px;
    background: transparent; box-shadow: none; gap: 4px; z-index: 25;
    justify-content: center; padding: 0;
  }
  .nav-btn { flex-direction: row; gap: 8px; padding: 0 16px; border-radius: 14px; font-size: 16px; max-width: none; flex: none; }
  .nav-btn svg { width: 22px; height: 22px; }
  .nav-btn span { font-size: 16px; }
  .nav-btn.active { background: #fff; box-shadow: var(--shadow); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-card .stat-num { font-size: 32px; }
  .task-label { font-size: 19px; }
  #view-accueil.view.active { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
  #view-accueil .stats-grid { grid-column: 1 / -1; }
  #modalBackdrop { align-items: center; }
  #modalBox { border-radius: 24px; }
}
