/* ═══════════════════════════════════════════════════════════════════════════
   ZATTS — zatts.css — design system unifié
   Basé sur routine.html (design de référence validé par Nolan).
   Dark mode, mobile-first, max-width 480px centré.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg: #0f0f0f;
  --bg2: #1a1a1a;
  --bg3: #242424;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.14);

  /* Text */
  --text: #f0f0f0;
  --text2: #999;
  --text3: #555;

  /* Colors (flat + bg + border variants pour chaque) */
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.25);

  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --blue-border: rgba(59, 130, 246, 0.25);

  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --amber-border: rgba(245, 158, 11, 0.25);

  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.1);
  --purple-border: rgba(168, 85, 247, 0.25);

  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.25);

  --orange: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.1);
  --orange-border: rgba(249, 115, 22, 0.25);
}

/* ─── RESET ──────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── AUTH SCREEN ────────────────────────────────────────────────────── */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 2rem;
  gap: 1.25rem;
}
.auth-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
}
.auth-sub {
  font-size: 14px;
  color: var(--text2);
}
.auth-input {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--blue); }
.auth-btn {
  width: 100%;
  max-width: 320px;
  padding: 14px;
  background: var(--blue);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.auth-btn:active { opacity: 0.8; }
.auth-error {
  font-size: 13px;
  color: var(--red);
  display: none;
}

/* ─── APP LAYOUT ─────────────────────────────────────────────────────── */
#app {
  display: none;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
}

/* ─── HEADER ─────────────────────────────────────────────────────────── */
.header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.header-left { min-width: 0; flex: 1; }
.header-date {
  font-size: 13px;
  color: var(--text2);
}
.header-title {
  font-size: 18px;
  font-weight: 600;
}
.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* Pills génériques (streak, accueil, etc.) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}
.pill:active { opacity: 0.7; }
.pill-amber {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: var(--amber);
  cursor: default;
}
.pill-muted { color: var(--text2); }

/* Alias pour rétrocompat */
.streak-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
}

/* ─── TABS ───────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  padding: 12px 20px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tab {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.tab.active {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text);
}

/* ─── PROGRESS BAR ───────────────────────────────────────────────────── */
.progress-wrap { padding: 12px 20px 0; flex-shrink: 0; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 6px;
}
.progress-bar {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── SCROLL AREA ────────────────────────────────────────────────────── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 100px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 8px;
}
.section-label:first-child { margin-top: 4px; }

/* ─── WEEKEND BANNER ─────────────────────────────────────────────────── */
.weekend-banner {
  background: var(--purple-bg);
  border-bottom: 1px solid var(--purple-border);
  padding: 8px 20px;
  font-size: 13px;
  color: var(--purple);
  text-align: center;
  font-weight: 500;
  flex-shrink: 0;
}

/* ─── TASK ITEMS (routine + nettoyage) ───────────────────────────────── */
.task {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.task:active { transform: scale(0.98); }
.task.done {
  background: var(--green-bg);
  border-color: var(--green-border);
}
.task.no-check {
  cursor: default;
  background: var(--amber-bg);
  border-color: var(--amber-border);
}
.task.free-time {
  cursor: default;
  background: var(--bg2);
  border-color: var(--border);
  opacity: 0.6;
}

.check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid var(--border2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.task.done .check {
  background: var(--green);
  border-color: var(--green);
}
.checkmark {
  display: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.task.done .checkmark { display: block; }

.task-info { flex: 1; min-width: 0; }
.task-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.task.done .task-name { color: var(--green); }
.task.no-check .task-name { color: var(--amber); }
.task.free-time .task-name { color: var(--text2); }
.task-note {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.task-time-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  flex-shrink: 0;
}

/* ─── TOAST ──────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg3);
  border: 1px solid var(--border2);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
  transition: transform 0.3s ease;
  z-index: 999;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ─── LOADING ────────────────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text3);
  font-size: 14px;
}

/* ─── CARDS (utilitaires généraux) ───────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

/* ─── MODALS ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 40px;
  border-top: 1px solid var(--border2);
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: var(--text2);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
