/* Planner — thèmes repris de Cumpari (Classique, Pétrole, Nuit).
   Les trois palettes sont celles de Cumpari (assets/css/themes.css) ; les jetons de Planner
   (--bg, --panel, --text, --muted, --border, --accent, --danger, --today) en sont dérivés, et les
   noms de Cumpari (--surface, --line, --primary, --primary2, --on-primary…) sont fournis aussi.
   Chargé APRÈS style.css : il l'emporte à spécificité égale.
   Anciennes valeurs (light, dark, system) : acceptées et rattachées à Classique / Nuit. */

/* ---------- Classique (défaut, y compris pages sans thème : connexion, invitation) ---------- */
:root,
html[data-theme="classic"],
html[data-theme="light"],
html[data-theme="system"]{
  color-scheme:light;
  --bg:#f4f6f8;--surface:#fff;--panel:#fff;--text:#1f2933;--muted:#667085;--line:#d9e0e7;--border:#d9e0e7;
  --primary:#234b72;--primary2:#183754;--accent:#234b72;--on-primary:#fff;
  --danger:#b42318;--success:#067647;--today:#e8eff6;
  --radius:16px;--shadow:0 8px 24px rgba(16,24,40,.06);
  --tone-soft:#f8fafc;--tone-panel:#eef2f6;--tone-chip:#e9eef4;
  --tone-hover:color-mix(in srgb,var(--primary) 9%,var(--surface));
  --theme-field:#fff;
  --theme-side:#fff;--theme-side-text:#1f2933;--theme-side-muted:#667085;--theme-side-line:#d9e0e7;
  --theme-nav-hover:#eef2f6;--theme-nav-active:#e9eef4;--theme-nav-active-text:#234b72;
  --theme-focus:rgba(35,75,114,.18);
  --theme-warning-bg:#fff7e4;--theme-warning-text:#805d00;
}

/* ---------- Pétrole (clair, plus contrasté) ---------- */
html[data-theme="petrol"]{
  color-scheme:light;
  --bg:#c4d7d8;--surface:#e8f1f1;--panel:#e8f1f1;--text:#0b1f23;--muted:#35504f;--line:#7fa3a6;--border:#7fa3a6;
  --primary:#12646a;--primary2:#0c4f55;--accent:#12646a;--on-primary:#fff;
  --danger:#b84a4a;--success:#397a55;--today:#cfe3e4;
  --radius:14px;--shadow:0 8px 22px rgba(15,48,53,.22);
  --tone-soft:#dcebeb;--tone-panel:#bcd5d6;--tone-chip:#c9dfe0;
  --theme-field:#f8fcfc;
  --theme-side:#15343a;--theme-side-text:#f6fbfb;--theme-side-muted:#c4d9db;--theme-side-line:#28545a;
  --theme-nav-hover:rgba(255,255,255,.12);--theme-nav-active:rgba(255,255,255,.20);--theme-nav-active-text:#fff;
  --theme-focus:rgba(25,117,123,.24);
}

/* ---------- Nuit ---------- */
html[data-theme="night"],
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#10171e;--surface:#18222c;--panel:#18222c;--text:#e8edf2;--muted:#9cabb8;--line:#31404d;--border:#31404d;
  --primary:#63aeb8;--primary2:#7bc0c8;--accent:#63aeb8;--on-primary:#0b1117;
  --danger:#e07a76;--success:#72bd8a;--today:#22313c;
  --radius:14px;--shadow:0 10px 28px rgba(0,0,0,.22);
  --tone-soft:#141e27;--tone-panel:#22313c;--tone-chip:#22313c;
  --theme-field:#101820;
  --theme-side:#0b1117;--theme-side-text:#f3f7fa;--theme-side-muted:#9fb0be;--theme-side-line:#1f2b36;
  --theme-nav-hover:rgba(255,255,255,.08);--theme-nav-active:rgba(99,174,184,.20);--theme-nav-active-text:#f3f7fa;
  --theme-focus:rgba(99,174,184,.26);
  --theme-warning-bg:#342b18;--theme-warning-text:#edc66d;
}

/* ---------- Habillage commun ---------- */
body{font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}
html[data-theme="petrol"] body{
  background:
    radial-gradient(circle at 88% -8%,rgba(25,117,123,.24),transparent 31rem),
    linear-gradient(180deg,#b9cfd0 0,#c8dadb 280px,#c4d7d8 100%);
  background-attachment:fixed;
}

/* Barre latérale = l'en-tête de Cumpari */
.sidebar{background:var(--theme-side);color:var(--theme-side-text);border-right:1px solid var(--theme-side-line)}
html[data-theme="petrol"] .sidebar{background:linear-gradient(170deg,#122e34 0%,#173f46 58%,#1c5960 100%);box-shadow:7px 0 24px rgba(15,48,53,.18)}
.sidebar nav a,.logout{color:var(--theme-side-text)}
.sidebar nav a:hover,.logout:hover{background:var(--theme-nav-hover)}
.sidebar nav a.is-active,.sidebar nav a[aria-current="page"]{background:var(--theme-nav-active);color:var(--theme-nav-active-text);font-weight:700}
.sidebar .app-version{color:var(--theme-side-muted)}
@media(max-width:800px){
  .sidebar{border-top:1px solid var(--theme-side-line)}
}

/* Fiches, boutons, champs */
.card,.auth-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);
}
html[data-theme="petrol"] .card,html[data-theme="petrol"] .auth-card{background:linear-gradient(180deg,#fff 0%,#f8fbfb 100%)}
html[data-theme="petrol"] .card>h2{color:#0c3d42}
.btn{background:var(--primary);color:var(--on-primary);font-weight:700}
.btn:hover{background:var(--primary2)}
input,select,textarea{background:var(--theme-field);color:var(--text);border-color:var(--line)}
input:focus,select:focus,textarea:focus{outline:0;border-color:var(--primary);box-shadow:0 0 0 3px var(--theme-focus)}
.alert{background:var(--tone-soft);border:1px solid var(--line)}
.alert.error{background:color-mix(in srgb,var(--danger) 10%,var(--surface));color:var(--danger);border-color:color-mix(in srgb,var(--danger) 35%,var(--line))}
.muted{color:var(--muted)}
a.section-link,.backlink{color:var(--primary)}
table th{color:var(--muted)}
hr{border-color:var(--line)}

/* Sélecteurs date / heure : l'icône suit le thème */
html[data-theme="night"] input::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input::-webkit-calendar-picker-indicator{filter:invert(1);opacity:.8;cursor:pointer}
html[data-theme="classic"] input::-webkit-calendar-picker-indicator,
html[data-theme="petrol"] input::-webkit-calendar-picker-indicator{filter:none;opacity:.8;cursor:pointer}

/* Marque « Cumpari (élèves) » : emblème + nom en deux couleurs, comme l'en-tête de Cumpari. */
.brand-link{gap:11px;color:var(--theme-side-text)}
.brand-logo.brand-logo-cumpari{width:40px;height:40px;max-width:40px;max-height:40px;flex:0 0 40px;border-radius:22%}
.brand-text{display:flex;flex-direction:column;gap:3px;line-height:1}
.brand-label{font-weight:800;font-size:1.3rem;letter-spacing:-.01em}
.brand-label-pari{color:#1b7a8c}
html[data-theme="petrol"] .brand-label-pari,
html[data-theme="night"] .brand-label-pari,
html[data-theme="dark"] .brand-label-pari{color:#3fa8bb}
.brand-sub{font-size:.72rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--theme-side-muted)}

/* Déconnexion (formulaire POST) : se présente comme les autres rubriques du menu */
.logout-form{margin-top:auto}
.logout-form .logout{margin-top:0;width:100%;text-align:left;background:none;border:0;cursor:pointer;color:var(--theme-side-text);font:inherit;padding:10px 12px;border-radius:10px}
.logout-form .logout:hover{background:var(--theme-nav-hover)}
@media(max-width:800px){.sidebar .logout-form{display:none}}

/* ---------- Cumpari (V2.24.0) : la charte graphique de Cumpari — bleu nuit, violet, tuile et point menthe ----------
   Jetons repris de Cumpari (assets/css/themes.css, thème « cumpari ») : fond de page plus foncé que les cartes, violet #5145a8,
   barre latérale bleu nuit #101a36. Les cours (cadre isolé) restent affichés comme en Classique. */
html[data-theme="cumpari"]{
  color-scheme:light;
  --bg:#e3e8f2;--surface:#fff;--panel:#fff;--text:#1d2840;--muted:#5b6880;--line:#d3dae8;--border:#d3dae8;
  --primary:#5145a8;--primary2:#43388f;--accent:#5145a8;--on-primary:#fff;
  --danger:#b42318;--success:#397a55;--today:#e9e6fb;
  --radius:18px;--shadow:0 8px 24px rgba(24,35,78,.08);
  --tone-soft:#f6f8fc;--tone-panel:#eef1f8;--tone-chip:#e9edf6;
  --theme-field:#fff;
  --theme-side:#101a36;--theme-side-text:#ffffff;--theme-side-muted:#a8b8d4;--theme-side-line:#172652;
  --theme-nav-hover:rgba(255,255,255,.10);--theme-nav-active:rgba(255,255,255,.16);--theme-nav-active-text:#fff;
  --theme-focus:rgba(81,69,168,.30);
  --theme-warning-bg:#fff7e4;--theme-warning-text:#805d00;
}
html[data-theme="cumpari"] .sidebar{box-shadow:6px 0 22px rgba(16,26,54,.20)}
html[data-theme="cumpari"] .sidebar nav a{color:#c3cde0}
html[data-theme="cumpari"] .sidebar nav a:hover,
html[data-theme="cumpari"] .sidebar nav a.is-active,
html[data-theme="cumpari"] .sidebar nav a[aria-current="page"]{color:#fff}
html[data-theme="cumpari"] .brand-logo.brand-logo-cumpari{content:url("/assets/img/cumpari-logo.svg");border-radius:0}
html[data-theme="cumpari"] .brand-label{text-transform:lowercase;font-weight:790;letter-spacing:-.045em}
html[data-theme="cumpari"] .brand-label-pari{color:inherit}
html[data-theme="cumpari"] .brand-label-pari::after{content:".";color:#a69afe}
html[data-theme="cumpari"] input::-webkit-calendar-picker-indicator{filter:none;opacity:.8;cursor:pointer}
html[data-theme="cumpari"] .card>h2{color:#1d2840}

/* Groupes du menu latéral (V2.24.0) */
.sidebar nav .nav-group{display:block;margin:14px 12px 2px;font-size:.68rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--theme-side-muted)}
.sidebar nav .nav-group:first-child{margin-top:0}
@media(max-width:800px){.sidebar nav .nav-group{display:none}}
