/* WAF Coach Studio — Design System V3
   League Spartan 900 + Poppins — Palette dark */

@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@900&family=Poppins:wght@300;400;500;600&display=swap');

:root {
  --black:   #0d0b0b;
  --nude:    #e5cebb;
  --terra:   #c4835a;
  --cream:   #faf6f2;

  --cardio:  #c94f4f;
  --renfo:   #4a7fd4;
  --zen:     #52a870;

  --surface:  #1a1715;
  --surface2: #231f1c;
  --surface3: #2a2421;
  --border:   #2e2925;
  --border2:  #3d3530;
  --muted:    #9e8e80;
  --muted2:   #6e5f54;

  --radius:   10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

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

html { font-size: 16px; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--black);
  color: var(--cream);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── TYPOGRAPHY ─────────────────────────────── */
.font-spartan { font-family: 'League Spartan', sans-serif; font-weight: 900; }

h1, h2, h3 { font-family: 'League Spartan', sans-serif; font-weight: 900; }
h1 { font-size: 2rem; color: var(--nude); letter-spacing: .03em; }
h2 { font-size: 1.4rem; color: var(--nude); }
h3 { font-size: 1.1rem; color: var(--nude); }

.text-muted  { color: var(--muted); }
.text-nude   { color: var(--nude); }
.text-terra  { color: var(--terra); }
.text-sm     { font-size: .8rem; }
.text-xs     { font-size: .72rem; }
.fw-500      { font-weight: 500; }
.fw-600      { font-weight: 600; }

/* ── LAYOUT ─────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 220px 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  min-height: 100vh;
}

.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.main-content {
  grid-area: main;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ── TOPBAR ─────────────────────────────────── */
.app-logo {
  font-family: 'League Spartan', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--nude);
  letter-spacing: .08em;
  text-decoration: none;
  white-space: nowrap;
}
.app-logo span { color: var(--terra); }

.topbar-nav { display: flex; gap: 2px; flex: 1; }

.topbar-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.topbar-link:hover { color: var(--cream); background: var(--surface2); }
.topbar-link.active { color: var(--nude); background: var(--surface2); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .75rem;
  color: var(--muted);
  text-decoration: none;
}
.user-chip:hover { border-color: var(--border2); color: var(--cream); }

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--terra);
  color: white;
  font-size: .65rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: .6rem; }
.avatar-lg { width: 40px; height: 40px; font-size: .8rem; }

/* ── SIDEBAR ─────────────────────────────────── */
.sidebar-section {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted2);
  padding: 10px 10px 4px;
  margin-top: 6px;
}
.sidebar-section:first-child { margin-top: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
  cursor: pointer;
}
.sidebar-link:hover { background: var(--surface2); color: var(--cream); }
.sidebar-link.active { background: var(--surface2); color: var(--nude); }

.sidebar-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── PAGE HEADER ─────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { margin-bottom: 4px; }
.page-header p  { font-size: .82rem; color: var(--muted); }

.page-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ── CARDS ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.card-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

/* ── STAT CARDS ──────────────────────────────── */
.stat-card {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat-val {
  font-family: 'League Spartan', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--nude);
  line-height: 1;
}
.stat-lbl { font-size: .72rem; color: var(--muted); margin-top: 4px; }

/* ── BADGES ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-cardio      { background: rgba(201,79,79,.18); color: #e88080; border: 1px solid rgba(201,79,79,.3); }
.badge-renfo       { background: rgba(74,127,212,.18); color: #7aaef5; border: 1px solid rgba(74,127,212,.3); }
.badge-zen         { background: rgba(82,168,112,.18); color: #7dd49a; border: 1px solid rgba(82,168,112,.3); }

.badge-debutante   { background: rgba(196,131,90,.18); color: var(--terra); border: 1px solid rgba(196,131,90,.3); }
.badge-tout        { background: rgba(229,206,187,.15); color: var(--nude); border: 1px solid rgba(229,206,187,.2); }
.badge-inter       { background: rgba(155,89,182,.18); color: #c39de8; border: 1px solid rgba(155,89,182,.3); }
.badge-avancee     { background: rgba(229,206,187,.25); color: var(--nude); border: 1px solid rgba(229,206,187,.35); }

.badge-admin       { background: rgba(196,131,90,.25); color: var(--terra); border: 1px solid rgba(196,131,90,.4); }
.badge-coach       { background: rgba(82,168,112,.2); color: #7dd49a; border: 1px solid rgba(82,168,112,.3); }
.badge-adherente   { background: rgba(74,127,212,.18); color: #7aaef5; border: 1px solid rgba(74,127,212,.3); }

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--terra);
  color: white;
}
.btn-primary:hover { background: #b8744f; }

.btn-secondary {
  background: var(--surface2);
  color: var(--cream);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface3); border-color: var(--border2); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--cream); background: var(--surface2); }

.btn-danger {
  background: rgba(201,79,79,.2);
  color: #e88080;
  border: 1px solid rgba(201,79,79,.3);
}
.btn-danger:hover { background: rgba(201,79,79,.35); }

.btn-sm { padding: 5px 11px; font-size: .73rem; }
.btn-lg { padding: 11px 22px; font-size: .88rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }
.btn-icon-sm { width: 28px; height: 28px; }

/* ── FORMS ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: .03em;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--cream);
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(196,131,90,.15);
}
.form-control::placeholder { color: var(--muted2); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: .72rem; color: var(--muted2); margin-top: 4px; }
.form-error { font-size: .72rem; color: #e88080; margin-top: 4px; }

/* ── TABLES ──────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface2); }

/* ── EXERCISE CARDS ──────────────────────────── */
.ex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.ex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all .15s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}
.ex-card:hover {
  border-color: var(--terra);
  transform: translateY(-2px);
}
.ex-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ex-emoji {
  width: 42px; height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.ex-emoji-cardio { background: rgba(201,79,79,.2); }
.ex-emoji-renfo  { background: rgba(74,127,212,.2); }
.ex-emoji-zen    { background: rgba(82,168,112,.2); }

.ex-name { font-size: .92rem; font-weight: 600; color: var(--nude); margin-bottom: 2px; }
.ex-muscle { font-size: .73rem; color: var(--muted); }
.ex-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: .72rem;
  color: var(--muted);
}
.ex-meta-item { display: flex; align-items: center; gap: 4px; }

/* ── SEARCH & FILTERS ────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 36px;
  color: var(--cream);
  font-family: 'Poppins', sans-serif;
  font-size: .82rem;
}
.search-input:focus { outline: none; border-color: var(--terra); }
.search-wrap { position: relative; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted2); font-size: 14px; pointer-events: none; }

.filter-btn {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--border2); color: var(--cream); }
.filter-btn.active { background: var(--surface2); color: var(--nude); border-color: var(--terra); }
.filter-btn.cardio.active  { background: rgba(201,79,79,.2); color: #e88080; border-color: var(--cardio); }
.filter-btn.renfo.active   { background: rgba(74,127,212,.2); color: #7aaef5; border-color: var(--renfo); }
.filter-btn.zen.active     { background: rgba(82,168,112,.2); color: #7dd49a; border-color: var(--zen); }

/* ── FLASH MESSAGES ──────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-success { background: rgba(82,168,112,.15); color: #7dd49a; border: 1px solid rgba(82,168,112,.3); }
.flash-error   { background: rgba(201,79,79,.15); color: #e88080; border: 1px solid rgba(201,79,79,.3); }
.flash-info    { background: rgba(74,127,212,.15); color: #7aaef5; border: 1px solid rgba(74,127,212,.3); }

/* ── MODAL ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  transform: translateY(20px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-family: 'League Spartan', sans-serif; font-size: 1.2rem; color: var(--nude); }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--cream); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── UTILITIES ───────────────────────────────── */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-auto { margin-top: auto; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--muted); font-size: 1rem; margin-bottom: 6px; }

/* ── SCROLLBAR ───────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
  }
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .ex-grid { grid-template-columns: 1fr; }
  .filters-bar { gap: 6px; }
  .topbar-nav { display: none; }
}
