/* =========================================================
   EduVirtuelle — Design « moderne lumineux » des pages intérieures
   (toutes les pages sauf l'accueil). Chargé après style.css.
   ========================================================= */

:root {
  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(29, 78, 216, .05);
  --shadow: 0 2px 4px rgba(15, 23, 42, .04), 0 12px 32px rgba(29, 78, 216, .10);
  --shadow-lg: 0 4px 10px rgba(15, 23, 42, .06), 0 24px 60px rgba(29, 78, 216, .18);
  --ring: 0 0 0 4px rgba(37, 99, 235, .14);
  --tile: #ffffff;
  --hero-a: #eef4ff;
  --hero-b: #f6f0ff;
}
[data-theme="dark"] {
  --tile: #17254a;
  --hero-a: #13224a;
  --hero-b: #1d1a44;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

/* ---------- Icônes 3D (js/icons.js) ---------- */
img.ev-ico {
  display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.24em; object-fit: contain;
  margin: 0 .04em; user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.btn img.ev-ico { width: 1.3em; height: 1.3em; margin: -.1em 0; }
.ev-dot { display: inline-block; width: .62em; height: .62em; border-radius: 50%; vertical-align: .04em; margin: 0 .12em; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.ev-dot-green { color: #16a34a; } .ev-dot-red { color: #dc2626; } .ev-dot-orange { color: #ea580c; } .ev-dot-amber { color: #f59e0b; }
.ev-dot-violet { color: #7c3aed; } .ev-dot-blue { color: #2563eb; } .ev-dot-gray { color: #94a3b8; } .ev-dot-dark { color: #334155; }
.badge .ev-dot { width: .55em; height: .55em; margin: 0; }

/* ---------- Fond de l'application ---------- */
.ev-icons body {
  background:
    radial-gradient(900px 500px at 105% -10%, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(124, 58, 237, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- Menu latéral ---------- */
.ev-icons .sidebar { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); }
.ev-icons .sidebar .brand { padding: 22px 22px 18px; }
.ev-icons .sidebar-nav { padding: 12px 12px; }
.ev-icons .sidebar .brand { padding: 18px 22px 16px; }
.ev-icons .sidebar-nav a, .ev-icons .sidebar-nav button { padding: 6px 10px; gap: 12px; margin-bottom: 3px; font-size: .92rem; border-radius: 12px; position: relative; }
.ev-icons .sidebar-nav .ico {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--border); transition: transform .2s, background .2s;
}
.ev-icons .sidebar-nav .ico img.ev-ico { width: 21px; height: 21px; margin: 0; vertical-align: 0; }
.ev-icons .sidebar-nav a:hover .ico { transform: scale(1.08) rotate(-4deg); background: var(--tile); }
.ev-icons .sidebar-nav a.active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .32);
}
.ev-icons .sidebar-nav a.active .ico { background: rgba(255, 255, 255, .95); border-color: transparent; box-shadow: 0 4px 10px rgba(11, 31, 77, .18); }
.ev-icons .sidebar-nav .sep { margin: 8px 10px; }
.ev-icons .sidebar-foot { padding: 14px; }
.ev-icons .sub-mini {
  border-radius: 16px; padding: 14px; border: 1px solid var(--blue-200);
  background: linear-gradient(135deg, var(--blue-50), color-mix(in srgb, var(--violet-bg) 60%, var(--blue-50)));
}
[data-theme="dark"] .ev-icons .sub-mini, [data-theme="dark"].ev-icons .sub-mini { border-color: var(--border); }

/* ---------- Barre du haut ---------- */
.ev-icons .topbar { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.4) blur(14px); padding: 12px 28px; }
.ev-icons .topbar .title { font-size: 1.05rem; letter-spacing: -.01em; }
.ev-icons .icon-btn { width: 42px; height: 42px; border-radius: 13px; box-shadow: var(--shadow-sm); }
.ev-icons .icon-btn img.ev-ico { width: 22px; height: 22px; margin: 0; vertical-align: 0; }
.ev-icons .topbar .user-chip { padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.ev-icons .topbar .user-chip:hover { border-color: var(--blue-400); }

/* ---------- En-tête de page ---------- */
.ev-icons .page-header {
  position: relative; overflow: hidden; align-items: center;
  padding: 26px 28px; border-radius: var(--radius-lg); border: 1px solid var(--border);
  background:
    radial-gradient(420px 200px at 100% 0, rgba(14, 165, 233, .16), transparent 70%),
    radial-gradient(360px 220px at 75% 120%, rgba(124, 58, 237, .12), transparent 70%),
    linear-gradient(135deg, var(--hero-a), var(--hero-b));
  box-shadow: var(--shadow-sm);
}
.ev-icons .page-header::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 28px solid rgba(37, 99, 235, .06); pointer-events: none;
}
.ev-icons .page-header > * { position: relative; z-index: 1; }
.ev-icons .page-header h1 { font-size: 1.75rem; letter-spacing: -.02em; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ev-icons .page-header h1 > img.ev-ico:first-child {
  width: 58px; height: 58px; padding: 9px; margin: 0; border-radius: 18px; background: var(--tile);
  box-shadow: 0 10px 24px rgba(29, 78, 216, .16), inset 0 0 0 1px rgba(37, 99, 235, .08); flex-shrink: 0;
}
.ev-icons .page-header p { margin-top: 6px; font-size: .95rem; }
.ev-icons .page-header h1 + p, .ev-icons .page-header p { padding-left: 0; }

/* ---------- Cartes ---------- */
.ev-icons .card { border-radius: var(--radius); box-shadow: var(--shadow-sm); border-color: color-mix(in srgb, var(--border) 85%, transparent); }
.ev-icons .card:has(> .card-title), .ev-icons .card-hover { transition: transform .2s, box-shadow .25s, border-color .2s; }
.ev-icons .card-hover:hover, .ev-icons .course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--blue-200); }
.ev-icons .card h3 { letter-spacing: -.01em; }
.ev-icons .card-title h3, .ev-icons .card > h3:first-child { display: flex; align-items: center; gap: 10px; }
.ev-icons .card-title h3 > img.ev-ico:first-child, .ev-icons .card > h3:first-child > img.ev-ico:first-child {
  width: 34px; height: 34px; padding: 6px; border-radius: 11px; margin: 0; background: var(--blue-50); flex-shrink: 0;
}

/* Statistiques */
.ev-icons .stat-card { position: relative; overflow: hidden; padding: 20px; }
.ev-icons .stat-card::before {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, .08), transparent 70%);
}
.ev-icons .stat-card .ic { width: 58px; height: 58px; border-radius: 17px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6); }
.ev-icons .stat-card .ic img.ev-ico { width: 36px; height: 36px; margin: 0; vertical-align: 0; }
.ev-icons .stat-card .ic .ev-dot { width: 18px; height: 18px; box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 18%, transparent); }
.ev-icons .stat-card .val { font-size: 1.7rem; letter-spacing: -.02em; }
.ev-icons .stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ev-icons .stat-card { transition: transform .2s, box-shadow .25s; }

/* Bandeau de bienvenue */
.ev-icons .welcome {
  border-radius: var(--radius-lg); padding: 32px;
  background:
    radial-gradient(500px 260px at 100% 0, rgba(56, 189, 248, .55), transparent 60%),
    radial-gradient(400px 260px at 0 120%, rgba(124, 58, 237, .45), transparent 60%),
    linear-gradient(135deg, #1e40af, #2563eb);
  box-shadow: 0 20px 50px rgba(29, 78, 216, .28);
}
.ev-icons .welcome h1 img.ev-ico { width: 1.15em; height: 1.15em; }

/* Listes et vignettes */
.ev-icons .thumb img.ev-ico { width: 28px; height: 28px; margin: 0; vertical-align: 0; }
.ev-icons .thumb { border-radius: 14px; }
.ev-icons .list-item { padding: 14px 0; }
.ev-icons .sicon-emoji img.ev-ico { width: 1.2em; height: 1.2em; }
.ev-icons .sicon-lg img.ev-ico, .ev-icons .sicon-xl img.ev-ico { width: 62%; height: 62%; margin: 0; }

/* États vides */
.ev-icons .empty-state { padding: 48px 20px; }
.ev-icons .empty-state .big {
  width: 112px; height: 112px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, var(--tile), var(--blue-50)); box-shadow: 0 16px 40px rgba(29, 78, 216, .14), inset 0 0 0 1px var(--blue-100);
}
.ev-icons .empty-state .big img.ev-ico { width: 64px; height: 64px; margin: 0; vertical-align: 0; animation: evFloat 3.2s ease-in-out infinite; }
.ev-icons .empty-state h3 { font-size: 1.2rem; margin-top: 4px; }
@keyframes evFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Notifications */
.ev-icons .notif { border-radius: 16px; transition: box-shadow .2s, transform .2s; }
.ev-icons .notif:hover { box-shadow: var(--shadow-sm); }
.ev-icons .notif .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--tile); box-shadow: inset 0 0 0 1px var(--border); }
.ev-icons .notif .ic img.ev-ico { width: 28px; height: 28px; margin: 0; vertical-align: 0; }

/* Alertes */
.ev-icons .alert { border-radius: 16px; align-items: center; padding: 14px 18px; }
.ev-icons .alert > img.ev-ico:first-child { width: 30px; height: 30px; margin: 0; flex-shrink: 0; vertical-align: 0; }

/* Boutons */
.ev-icons .btn { border-radius: 13px; }
.ev-icons .btn-sm { border-radius: 10px; }
.ev-icons .btn-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.ev-icons .btn-ghost { border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); }

/* Formulaires */
.ev-icons .input, .ev-icons select.input, .ev-icons textarea.input { border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.ev-icons .input:focus { box-shadow: var(--ring); border-color: var(--blue-500); outline: none; }
.ev-icons .filters { padding: 10px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); }
.ev-icons .filters .input { box-shadow: none; }

/* Tableaux */
.ev-icons .table-wrap { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.ev-icons .table th { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.ev-icons .table tbody tr { transition: background .15s; }
.ev-icons .table tbody tr:hover { background: var(--primary-soft); }

/* Onglets */
.ev-icons .tabs { gap: 4px; border-bottom: 0; background: var(--surface); padding: 5px; border-radius: 14px; border: 1px solid var(--border); width: fit-content; max-width: 100%; box-shadow: var(--shadow-sm); }
.ev-icons .tab { border-radius: 10px; border-bottom: 0; padding: 9px 16px; }
.ev-icons .tab.active { background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .28); }

/* Badges */
.ev-icons .badge { padding: 4px 11px; }

/* Cours */
.ev-icons .course-card { border-radius: 20px; }
.ev-icons .course-cover { height: 130px; }
.ev-icons .course-extras { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.ev-icons .chapter { border-radius: 14px; }
.ev-icons .chapter-head { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.ev-icons .lesson-link img.ev-ico { width: 18px; height: 18px; }
.ev-icons .lesson-content { line-height: 1.75; }

/* Modales */
.ev-icons .modal { border-radius: 22px; }

/* Pages de connexion / inscription */
.ev-icons .auth-side h1 img.ev-ico { width: 1.1em; height: 1.1em; }

/* Animation d'apparition des cartes */
.ev-icons .content .card { animation: evRise .45s cubic-bezier(.2, .8, .2, 1) both; }
.ev-icons .content .grid > .card:nth-child(2) { animation-delay: .04s; }
.ev-icons .content .grid > .card:nth-child(3) { animation-delay: .08s; }
.ev-icons .content .grid > .card:nth-child(4) { animation-delay: .12s; }
.ev-icons .content .grid > .card:nth-child(n+5) { animation-delay: .16s; }
@keyframes evRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .ev-icons .content .card, .ev-icons .empty-state .big img.ev-ico { animation: none; }
}

/* ---------- Téléphone ---------- */
@media (max-width: 900px) {
  .ev-icons .topbar { padding: 10px 14px; }
  .ev-icons .page-header { padding: 20px 18px; border-radius: 20px; }
  .ev-icons .page-header h1 { font-size: 1.35rem; gap: 12px; }
  .ev-icons .page-header h1 > img.ev-ico:first-child { width: 46px; height: 46px; padding: 7px; border-radius: 14px; }
  .ev-icons .filters { padding: 8px; }
  .ev-icons .tabs { width: 100%; }
}
@media (max-width: 600px) {
  .ev-icons .stat-card { padding: 16px; gap: 12px; }
  .ev-icons .stat-card .ic { width: 48px; height: 48px; border-radius: 14px; }
  .ev-icons .stat-card .ic img.ev-ico { width: 30px; height: 30px; }
  .ev-icons .stat-card .val { font-size: 1.4rem; }
  .ev-icons .empty-state .big { width: 92px; height: 92px; }
  .ev-icons .empty-state .big img.ev-ico { width: 52px; height: 52px; }
}

/* En-tête d'un cours et sommaire qui reste visible */
.ev-icons .course-hero {
  padding: 26px 28px; border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 200px at 100% 0, rgba(14, 165, 233, .16), transparent 70%),
    radial-gradient(360px 220px at 70% 130%, rgba(124, 58, 237, .12), transparent 70%),
    linear-gradient(135deg, var(--hero-a), var(--hero-b));
}
.ev-icons .course-hero h1 { letter-spacing: -.02em; }
@media (min-width: 1000px) {
  .ev-icons .course-layout > aside.card { position: sticky; top: 86px; max-height: calc(100vh - 110px); overflow-y: auto; }
}
.ev-icons .topbar .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 600px) { .ev-icons .topbar { gap: 8px; } .ev-icons .topbar .icon-btn { width: 38px; height: 38px; } }

/* Page « Informations légales » */
.legal-wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 20px; }
.legal-top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.legal-top-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.legal-main { padding-top: 28px; padding-bottom: 48px; }
.legal-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.legal-nav a { padding: 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; color: var(--heading); box-shadow: var(--shadow-sm); }
.legal-nav a:hover { border-color: var(--blue-400); text-decoration: none; }
.legal-sec { margin-bottom: 22px; padding: 28px; scroll-margin-top: 80px; }
.legal-sec h2 { font-size: 1.45rem; display: flex; align-items: center; gap: 10px; }
.legal-sec h3 { font-size: 1.05rem; margin-top: 22px; color: var(--primary-strong); }
[data-theme="dark"] .legal-sec h3 { color: var(--primary); }
.legal-sec p, .legal-sec li { color: var(--text-soft); line-height: 1.75; }
.legal-sec ul { padding-left: 22px; margin: 0 0 1em; }
.legal-sec li { margin-bottom: 6px; }
.legal-sec .table td { vertical-align: top; }
@media (max-width: 600px) { .legal-sec { padding: 20px 16px; } .legal-top .brand small { display: none; } }

/* Page « Pas de connexion » (application installée) */
.offline-box { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 24px; max-width: 460px; margin: 0 auto; }
.offline-box img { border-radius: 24px; box-shadow: var(--shadow); }
.offline-box h1 { font-size: 1.6rem; margin: 6px 0 0; }
.offline-box p { color: var(--text-muted); }
/* Fenêtre « Installer l'application » */
.install-steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.install-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.install-steps li:last-child { border-bottom: 0; }
.install-steps li::before { content: counter(s); flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); }
/* Application installée : marges des encoches (iPhone) */
@media (display-mode: standalone) {
  .ev-icons .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .ev-icons .sidebar { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .ev-icons .content { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}

/* Une carte ne dépasse jamais l'écran : les tableaux larges défilent dans leur carte */
.grid > * { min-width: 0; }
.annot-overlay { width: 100vw; right: auto; }

/* Clavier de symboles scientifiques (correction des copies, visio) */
.write-text .wt-input { font-size: 1.6rem; font-weight: 700; line-height: 1.25; resize: vertical; min-height: 64px; }
.sym-pad { margin-top: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.sym-tabs { display: flex; gap: 4px; padding: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: thin; }
.sym-tab { flex-shrink: 0; border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 700; padding: 6px 10px; border-radius: 9px; color: var(--text-soft); cursor: pointer; white-space: nowrap; }
.sym-tab.active { background: var(--primary); color: #fff; }
.sym-grid { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px; max-height: 190px; overflow-y: auto; }
.sym-key { min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 1.1rem "Cambria Math", "Segoe UI Symbol", "STIX Two Math", "Times New Roman", serif; cursor: pointer; touch-action: manipulation; }
.sym-key.sym-wide { font-family: var(--font); font-size: .85rem; }
.sym-key:hover { border-color: var(--blue-400); background: var(--primary-soft); }
.sym-key:active { transform: scale(.94); }
.annot-overlay ~ .modal-backdrop { z-index: 1100; }
.wt-hint { display: flex; align-items: flex-start; gap: 8px; color: var(--text-muted); line-height: 1.5; }
.wt-hint input { margin-top: 3px; flex-shrink: 0; }
@media (max-width: 600px) { .sym-grid { max-height: 150px; } .sym-key { min-width: 38px; height: 38px; } }
