/* =========================================================
   Page "Cours" — planning jour / semaine / mois
   (audience enseignant / bureau). Tokens : assets/styles/tokens.css
   ========================================================= */

.schedule-frame { display: block; margin-top: 1.25rem; }

/* ---------------- Barre d'outils ---------------- */
.schedule-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

/* Sélecteur de portée (Aujourd'hui / Semaine / Mois) */
.scope-toggle {
    display: inline-flex;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px;
}
.scope-toggle a {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.36rem 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
}
.scope-toggle a:hover { color: var(--text); }
.scope-toggle a.active { color: var(--gold-strong); background: var(--gold-soft); }

/* Navigation précédent / suivant */
.period-nav { display: flex; align-items: center; gap: 0.5rem; }
.wk-step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}
.wk-step:hover { background: var(--hover); color: var(--gold-strong); }
.wk-step svg { display: block; flex: 0 0 auto; }

.period-label-wrap { text-align: center; min-width: 200px; }
.period-label { font-weight: 600; font-size: 1.05rem; }
.period-sub { font-size: 0.74rem; color: var(--text-muted); }
.period-sub a { color: var(--text-muted); text-decoration: underline; }
.period-sub a:hover { color: var(--gold-strong); }

/* ---------------- Grille jour / semaine ---------------- */
.schedule-grid { display: grid; gap: 0.75rem; align-items: start; }
/* minmax(0, 1fr) : les colonnes peuvent rétrécir sous leur contenu (sinon 7 colonnes
   forcent un débordement horizontal sur les écrans < ~1400px). */
.schedule-grid.is-week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.schedule-grid.is-day { grid-template-columns: 1fr; }

.day-col {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.day-head { padding: 0.55rem 0.5rem; text-align: center; border-bottom: 1px solid var(--border); border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.day-head .dow { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; }
.day-head .dnum { font-size: 1.3rem; font-weight: 700; line-height: 1.15; }
.day-head .dmon { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }

.day-col.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft), var(--shadow-sm); }
.day-col.is-today .day-head { background: var(--gold-soft); }
.day-col.is-today .dnum { color: var(--gold-strong); }

.day-body { padding: 0.5rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1 1 auto; min-height: 90px; }

/* Vue Jour : une seule colonne, tête à gauche, cartes en tuiles */
.schedule-grid.is-day .day-col { flex-direction: row; }
.schedule-grid.is-day .day-head {
    flex: 0 0 92px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.schedule-grid.is-day .day-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem; min-width: 0; }

/* ---------------- Carte d'un cours ---------------- */
.course-card {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.65rem;
}
a.course-card:hover { border-color: var(--border-strong); background: var(--surface-2-hov); }
.course-card.is-canceled { opacity: 0.6; }

.cc-time { font-size: 0.78rem; font-weight: 700; color: var(--gold-strong); }
.cc-title { font-weight: 600; font-size: 0.92rem; color: var(--text); margin: 0.12rem 0 0.4rem; }

.cc-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.45rem; }
.cc-chip {
    font-size: 0.66rem;
    color: var(--text-muted);
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.08rem 0.5rem;
}

.cc-foot { display: flex; align-items: center; font-size: 0.74rem; color: var(--text-muted); }
.cc-count { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; }
.cc-count svg { opacity: 0.8; }

/* Repère de note : wrapper carte + bouton hors de l'ancre (HTML valide).
   Le clic ouvre la note en lecture (note_peek_controller.js). */
.course-slot { position: relative; }
.course-slot .cc-title { padding-right: 1.3rem; }
.cc-note {
    position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2;
    width: 22px; height: 22px; border-radius: 7px; padding: 0;
    display: grid; place-items: center; cursor: pointer;
    color: var(--gold-strong); background: var(--gold-soft);
    border: 1px solid rgba(230, 201, 138, 0.35);
    transition: background 0.14s ease, transform 0.14s ease;
}
.cc-note:hover { background: rgba(230, 201, 138, 0.26); transform: translateY(-1px); }
.cc-note:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.cc-note svg { display: block; width: 12px; height: 12px; }

/* Cap à 3 catégories d'âge : le « +N » liste le reste en infobulle native (title). */
.cc-chip.chip-more {
    cursor: default; font-weight: 600;
    color: var(--gold-strong); background: var(--gold-soft); border-color: rgba(230, 201, 138, 0.35);
}

.cc-badge { display: inline-block; font-size: 0.68rem; font-weight: 600; border-radius: 999px; padding: 0.08rem 0.55rem; }
.cc-badge--cancel { color: var(--danger); background: rgba(226, 98, 91, 0.12); border: 1px solid rgba(226, 98, 91, 0.35); }

.day-empty {
    flex: 1 1 auto;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.76rem;
    padding: 1.1rem 0.5rem;
}

/* ---------------- Vue Mois : calendrier ---------------- */
.month-scroll { overflow-x: auto; }
.month-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; margin-bottom: 0.4rem; }
.month-weekdays div {
    text-align: center;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; }
.month-weekdays, .month-grid { min-width: 680px; } /* défilement horizontal sur petit écran */

.month-cell {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 104px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}
.month-cell.is-outside { opacity: 0.45; }
.month-cell.is-today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft); }
.month-cell .mc-day { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.1rem; }
.month-cell.is-today .mc-day { color: var(--gold-strong); }

.course-pill {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    line-height: 1.3;
    padding: 0.12rem 0.4rem;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}
a.course-pill:hover { border-color: var(--border-strong); background: var(--surface-2-hov); }
.course-pill .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-pill .t { color: var(--gold-strong); font-weight: 700; }
.course-pill.is-canceled { opacity: 0.55; text-decoration: line-through; }
/* Point discret « cette séance a une note » en fin de pastille (vue Mois) */
.pill-note { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; margin-left: auto; background: var(--gold-strong); box-shadow: 0 0 0 2px var(--gold-soft); }

/* ---------------- Modale : lecture d'une note ---------------- */
.note-modal {
    position: fixed; inset: 0; z-index: 1050;
    display: flex; align-items: center; justify-content: center; padding: 1.25rem;
    background: rgba(3, 16, 22, 0.62); backdrop-filter: blur(3px);
}
.nm-card {
    position: relative; width: 100%; max-width: 440px;
    background: var(--surface-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.nm-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, var(--gold-strong), var(--gold)); }
.nm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.05rem 1.2rem 0.35rem; }
.nm-eyebrow { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.nm-title { font-size: 1.05rem; font-weight: 600; margin-top: 0.15rem; }
.nm-close {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center; cursor: pointer; line-height: 1;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
.nm-close:hover { color: var(--text); border-color: var(--border-strong); background: var(--hover); }
.nm-close svg { display: block; }
.nm-meta { padding: 0 1.2rem; font-size: 0.76rem; color: var(--text-faint); }
.nm-body { padding: 0.7rem 1.2rem 0; }
.nm-body .note-text {
    white-space: pre-wrap; color: var(--text); font-size: 0.92rem; line-height: 1.6;
    background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 0.85rem 1rem; max-height: 46vh; overflow: auto;
}
.nm-foot { padding: 1rem 1.2rem 1.2rem; display: flex; justify-content: flex-end; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1040px) {
    .schedule-grid.is-week { grid-template-columns: 1fr; gap: 0.6rem; }
    .schedule-grid.is-week .day-col { flex-direction: row; }
    .schedule-grid.is-week .day-head {
        flex: 0 0 78px;
        border-bottom: none;
        border-right: 1px solid var(--border);
        border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .schedule-grid.is-week .day-body { flex-direction: row; flex-wrap: wrap; }
    .schedule-grid.is-week .course-card,
    .schedule-grid.is-week .course-slot { flex: 1 1 230px; }
    .schedule-grid.is-week .day-empty { flex-basis: 100%; justify-content: flex-start; padding: 1rem; }
}
@media (max-width: 620px) {
    .schedule-toolbar { justify-content: center; }
    .wk-step span { display: none; }
    .wk-step { padding: 0.5rem 0.6rem; }
    .period-label-wrap { min-width: 0; flex: 1 1 auto; }
    .schedule-grid.is-day .day-body { grid-template-columns: 1fr; }
}
