/* ============================================================
   REZANGO — Design system
   Palette : fond quasi-noir + violet électrique + blanc pur
   Typographie : Inter (system-ui fallback)
   ============================================================ */

:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --bg3:       #1c2230;
  --card:      #1a2033;
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.15);
  --accent:    #7c3aed;
  --accent-lt: #9d5cf6;
  --accent-glow: rgba(124,58,237,0.18);
  --green:     #22c55e;
  --red:       #ef4444;
  --amber:     #f59e0b;
  --text:      #f0f6fc;
  --text2:     #8b949e;
  --text3:     #6e7681;
  --radius:    14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --trans:     all 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, 'Inter', BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  overscroll-behavior: none;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

.page { display: none; flex: 1; flex-direction: column; }
.page.active { display: flex; }

/* ─── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.topbar-logo { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.topbar-logo span { color: var(--accent-lt); }
.topbar-actions { display: flex; gap: 8px; }

/* ─── BOTTOM NAV ─────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  position: sticky; bottom: 0; z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 6px 0; cursor: pointer;
  color: var(--text3); transition: var(--trans);
  font-size: 11px; font-weight: 500;
  border: none; background: none;
}
.nav-item svg { width: 22px; height: 22px; stroke-width: 1.6; }
.nav-item.active { color: var(--accent-lt); }
.nav-item:hover { color: var(--text2); }

/* ─── SCROLL AREA ────────────────────────────────────────── */
.scroll-area { flex: 1; overflow-y: auto; padding: 20px; }
.scroll-area::-webkit-scrollbar { width: 0; }

/* ─── TYPOGRAPHY ─────────────────────────────────────────── */
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p  { color: var(--text2); font-size: 14px; }

.section-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text3);
  margin-bottom: 12px; padding: 0 2px;
}

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--trans);
}
.card:hover { border-color: var(--border2); }

.card-list { display: flex; flex-direction: column; gap: 10px; }

/* ─── SLOTS GRID ──────────────────────────────────────────── */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.slot {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--trans);
}
.slot:hover:not(.full):not(.past) { border-color: var(--accent); background: var(--accent-glow); }
.slot.selected { border-color: var(--accent-lt); background: var(--accent-glow); }
.slot.full { opacity: 0.4; cursor: not-allowed; }
.slot.past { opacity: 0.25; cursor: not-allowed; }
.slot-time { font-size: 15px; font-weight: 600; color: var(--text); }
.slot-avail { font-size: 11px; color: var(--text3); margin-top: 2px; }
.slot.selected .slot-time { color: var(--accent-lt); }

/* ─── DATE STRIP ─────────────────────────────────────────── */
.date-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.date-strip::-webkit-scrollbar { display: none; }
.date-pill {
  flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--trans);
}
.date-pill.active { background: var(--accent); border-color: var(--accent); }
.date-pill .dow { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
.date-pill .day { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 2px; }
.date-pill.active .dow, .date-pill.active .day { color: #fff; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600;
}
.badge-green  { background: rgba(34,197,94,0.12);  color: #4ade80; }
.badge-red    { background: rgba(239,68,68,0.12);   color: #f87171; }
.badge-amber  { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.badge-accent { background: var(--accent-glow);     color: var(--accent-lt); }

/* ─── BOUTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: var(--trans); border: none; width: 100%; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-lt); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-lt); }
.btn-danger  { background: rgba(239,68,68,0.1); color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text2); }
.form-input {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 13px 14px;
  color: var(--text); font-size: 15px; outline: none;
  transition: var(--trans); width: 100%;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text3); }

select.form-input { cursor: pointer; }

/* ─── AVATAR ─────────────────────────────────────────────── */
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent-glow); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--accent-lt);
  flex-shrink: 0;
}

/* ─── BOOKING CARD ───────────────────────────────────────── */
.booking-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.booking-info { flex: 1; }
.booking-studio { font-size: 15px; font-weight: 600; color: var(--text); }
.booking-detail { font-size: 13px; color: var(--text2); margin-top: 2px; }
.booking-date-block {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg3); border-radius: var(--radius-sm);
  padding: 8px 14px; text-align: center; flex-shrink: 0;
}
.booking-date-block .month { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-lt); }
.booking-date-block .daynum { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1; }

/* ─── DIVIDER ────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── TOAST ──────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius-pill); padding: 10px 20px;
  font-size: 14px; font-weight: 500; color: var(--text);
  opacity: 0; transition: all 0.25s ease; z-index: 999;
  white-space: nowrap; pointer-events: none; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 200;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 32px; width: 100%; max-width: 500px;
  max-height: 85dvh; overflow-y: auto;
  animation: slideUp 0.28s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-handle { width: 36px; height: 4px; background: var(--border2); border-radius: 2px; margin: 0 auto 20px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }

/* ─── ACCUEIL ────────────────────────────────────────────── */
.hero-greeting { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.hero-sub { font-size: 14px; color: var(--text2); margin-bottom: 24px; }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; text-align: center; gap: 12px; }
.empty-state svg { opacity: 0.25; }
.empty-state p { color: var(--text3); font-size: 14px; }

/* ─── ADMIN VIEWS ────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent-lt); }
.stat-label { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ─── COACH TAG ──────────────────────────────────────────── */
.coach-tag { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.coach-tag:last-child { border-bottom: none; }
.coach-tag-info { flex: 1; }
.coach-tag-name { font-size: 14px; font-weight: 600; }
.coach-tag-role { font-size: 12px; color: var(--text3); }

/* ─── LOGIN ──────────────────────────────────────────────── */
.auth-container { display: flex; flex-direction: column; justify-content: flex-start; min-height: 100dvh; padding: 32px 24px; }
.auth-logo { font-size: 32px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
.auth-logo span { color: var(--accent-lt); }
.auth-tagline { font-size: 15px; color: var(--text2); margin-bottom: 40px; }

/* ─── TOGGLE ROLE ────────────────────────────────────────── */
.role-toggle { display: flex; background: var(--bg3); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; gap: 4px; }
.role-btn { flex: 1; padding: 9px; border-radius: 6px; border: none; background: transparent; color: var(--text2); font-size: 14px; font-weight: 500; cursor: pointer; transition: var(--trans); }
.role-btn.active { background: var(--accent); color: #fff; }

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page.active .scroll-area { animation: fadeIn 0.22s ease; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (min-width: 640px) {
  .scroll-area { max-width: 540px; margin: 0 auto; width: 100%; }
  .slots-grid { grid-template-columns: repeat(4, 1fr); }
}