/* ═══════════════════════════════════════════════════════
   SchedulerMatrixView.razor.css
   Charte Educated : Bleu #5351FB  — Orangé #5351FB
   ═══════════════════════════════════════════════════════ */

.edt-matrix-wrapper {
    /* ── Palette Educated ── */
    --edu-blue: #5351FB;
    --edu-blue-dark: #3B39C0;
    --edu-blue-mid: #6462FC;
    --edu-blue-soft: #EEEEFF;
    --edu-orange: #5351FB;
    --edu-orange-soft: #FEF0E6;
    --edu-border: rgba(83,81,251,.12);
    --edu-border-day: rgba(83,81,251,.25);
    --edu-empty-bg: rgba(83,81,251,.03);
    --edu-hover-bg: rgba(83,81,251,.06);
    --edu-sel-ring: #5351FB;
    --edu-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 6px 0 20px;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: 13px;
    position: relative;
}

/* ══════════════════════════
   TOOLBAR
══════════════════════════ */
.edt-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.edt-toolbar-left {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.edt-toolbar-right {
    display: flex;
    gap: 8px;
}

.edt-filter-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.edt-filter-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: #5351FB;
    opacity: 1;
}

.edt-combo {
    min-width: 175px;
}

.edt-btn {
    font-size: 12px;
    height: 32px;
}

.edt-btn-primary {
    font-weight: 600;
}

/* ══════════════════════════
   STATS BAR
══════════════════════════ */
.edt-stats-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.edt-stat-card {
    background: #fff;
    border: 1px solid #ebebeb;
    box-shadow: 0 2px 8px rgba(83,81,251,.07);
    border-radius: 10px;
    padding: 6px 16px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    position: relative;
    overflow: hidden;
}

    .edt-stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 3px;
        height: 100%;
        background: #5351FB;
        border-radius: 10px 0 0 10px;
    }

.edt-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #888;
    opacity: 1;
}

.edt-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #5351FB;
    line-height: 1.1;
}

.edt-stat-period {
    font-size: 13px;
    font-weight: 500;
}

/* ══════════════════════════
   LÉGENDE
══════════════════════════ */
.edt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #444;
}

.edt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.edt-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ══════════════════════════
   LOADING / EMPTY
══════════════════════════ */
.edt-loading, .edt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 56px 24px;
    border: 1.5px solid rgba(83,81,251,.12);
    border-radius: 12px;
    color: #888;
}

.edt-spinner-ring {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(83,81,251,.15);
    border-top-color: #5351FB;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ══════════════════════════
   SCROLL WRAPPER
══════════════════════════ */
.edt-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
    border: 1.5px solid rgba(83,81,251,.18);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(83,81,251,.08);
    position: relative;
}

/* ══════════════════════════
   TABLE
══════════════════════════ */
.edt-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 600px;
    table-layout: auto;
    font-size: 12px;
}

    /* ── En-têtes généraux ── */
    .edt-table thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        text-align: center;
        padding: 0;
        border-bottom: 1px solid #e0e0e0;
        border-right: 1px solid #e0e0e0;
        white-space: nowrap;
        user-select: none;
        box-shadow: 0 2px 6px rgba(0,0,0,.08);
    }

/* ── Coin Classe/Groupe ── */
.edt-th-corner {
    position: sticky !important;
    top: 0;
    left: 0;
    z-index: 20 !important;
    background: #f5f5f5 !important;
    color: #333 !important;
    min-width: 200px;
    max-width: 240px;
    padding: 0 14px !important;
    text-align: left !important;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-right: 3px solid #5351FB !important;
    border-bottom: 2px solid #e0e0e0 !important;
}

/* ── En-tête Jour ── */
.edt-th-day {
    background: #fafafa;
    color: #222;
    padding: 7px 6px 5px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    border-left: 3px solid #5351FB !important;
    border-bottom: 1px solid #e8e8e8 !important;
    border-right: 1px solid #e8e8e8 !important;
}

.edt-th-day-date {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #888;
    margin-top: 1px;
}

/* ── En-tête Séance ── */
.edt-th-sess {
    background: #fff;
    color: #333;
    padding: 4px 4px 5px;
    min-width: 100px;
    width: 100px;
    font-size: 10px;
    border-left: 1px solid #e8e8e8;
    border-bottom: 2px solid #5351FB !important;
}

.edt-sess-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #1a1a2e;
}

.edt-sess-time {
    display: block;
    font-size: 9px;
    color: #5351FB;
    font-weight: 600;
    margin-top: 1px;
    font-family: 'Space Mono', monospace;
}

/* ── Weekend ── */
.edt-th-day.edt-wk {
    background: #f0f0f0 !important;
    color: #888 !important;
    border-left-color: #ccc !important;
}

.edt-th-sess.edt-wk {
    background: #fafafa !important;
    border-bottom-color: #ccc !important;
}

    .edt-th-sess.edt-wk .edt-sess-name {
        color: #999;
    }

    .edt-th-sess.edt-wk .edt-sess-time {
        color: #bbb;
    }

/* ── Séparateur de jour ── */
.edt-th-sess:first-of-type,
.edt-th-day + .edt-th-sess {
    border-left: 3px solid #5351FB !important;
}

/* ══════════════════════════
   LIGNES / CELLULES
══════════════════════════ */
.edt-row {
    transition: background .1s, box-shadow .1s;
}

    .edt-row:hover {
        box-shadow: 0 2px 8px rgba(83,81,251,.08);
        position: relative;
        z-index: 1;
    }

        .edt-row:hover .edt-td-class {
            background: #FEF0E6;
        }

        .edt-row:hover .edt-td-cell {
            background: rgba(83,81,251,.04);
        }

        .edt-row:hover .edt-cell-empty {
            background: rgba(83,81,251,.07);
        }

    /* Alternance légère */
    .edt-row:nth-child(even) .edt-td-class {
        background: #FAFAFA;
    }

    .edt-row:nth-child(even) .edt-td-cell {
        background: #FAFAFA;
    }

    .edt-row:nth-child(even) .edt-cell-empty {
        background: rgba(0,0,0,.015);
    }

/* ── Colonne Classe — sticky gauche ── */
.edt-td-class {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #fff;
    border-right: 3px solid #5351FB;
    border-bottom: 1px solid #ececec;
    padding: 6px 14px;
    min-width: 200px;
    max-width: 240px;
    width: max-content;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
    box-shadow: 3px 0 10px rgba(83,81,251,.10);
}

.edt-class-name {
    font-size: 12px;
    font-weight: 700;
    color: #1a1a2e;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: .01em;
}

.edt-class-sub {
    font-size: 10px;
    font-weight: 400;
    color: #888;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Cellule créneau ── */
.edt-td-cell {
    border-right: 1px solid #ececec;
    border-bottom: 1px solid #ececec;
    padding: 3px;
    vertical-align: top;
    min-width: 100px;
    width: 100px;
    height: 80px;
    min-height: 80px;
    cursor: pointer;
    transition: background .12s;
    overflow: hidden;
    position: relative;
}

    /* Séparateur entre jours */
    .edt-td-cell.edt-day-first {
        border-left: 3px solid #5351FB;
    }

.edt-cell-empty {
    background: #fdfdfd;
}

    .edt-cell-empty:hover {
        background: rgba(83,81,251,.06) !important;
    }

.edt-wk {
    background: #f8f8f8;
}

/* ── Cellule sélectionnée ── */
.edt-cell-selected {
    box-shadow: inset 0 0 0 2px #5351FB !important;
    background: rgba(83,81,251,.06) !important;
}

/* ── Hint "+" sur cellule vide ── */
.edt-cell-hint {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    color: rgba(83,81,251,.25);
}

.edt-cell-empty:hover .edt-cell-hint {
    display: flex;
    color: rgba(83,81,251,.55);
}

/* ══════════════════════════
   APPOINTMENT CARD
══════════════════════════ */
.edt-appt {
    border-radius: 5px;
    border-left: 3px solid var(--appt-border);
    background: var(--appt-bg);
    color: var(--appt-text);
    padding: 3px 4px;
    height: 100%;
    width: 100px;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    transition: filter .12s, transform .1s;
    position: relative;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(83,81,251,.10);
}

    .edt-appt:hover {
        filter: brightness(.94);
        transform: scale(1.01);
        z-index: 2;
        box-shadow: 0 3px 10px rgba(83,81,251,.18);
    }

/* Matière : 2 lignes max */
.edt-appt-subj {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    word-break: break-word;
    letter-spacing: .01em;
}

/* Type TD/Cours — badge pill compact */
.edt-appt-type {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .85;
    background: rgba(0,0,0,.12);
    border-radius: 20px;
    padding: 0px 4px;
    display: inline-block;
    width: fit-content;
    white-space: nowrap;
}

/* Footer salle + enseignant */
.edt-appt-footer {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: auto;
}

/* Chips */
.edt-chip {
    font-size: 9px;
    font-weight: 500;
    padding: 0px 3px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 2px;
}

    .edt-chip::before {
        font-size: 8px;
        flex-shrink: 0;
        opacity: .7;
    }

.edt-chip-room::before {
    content: '📍';
}

.edt-chip-teacher::before {
    content: '👤';
}

.edt-chip-room {
    background: rgba(0,0,0,.12);
}

.edt-chip-teacher {
    background: rgba(0,0,0,.08);
}

/* Badges absent / rattrapage */
.edt-badge {
    display: inline-block;
    font-size: 8px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    margin-top: 2px;
    letter-spacing: .03em;
}

.edt-badge-absent {
    background: rgba(200,0,0,.18);
    color: #8B0000;
}

.edt-badge-ratt {
    background: rgba(83,81,251,.18);
    color: #3B39D4;
}

/* ══════════════════════════
   MENU CONTEXTUEL
══════════════════════════ */
.edt-ctx-menu {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ebebeb;
    box-shadow: 0 2px 8px rgba(83,81,251,.07);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(83,81,251,.18), 0 2px 8px rgba(0,0,0,.08);
    min-width: 190px;
    padding: 5px 0;
    animation: ctx-in .12s ease;
}

@keyframes ctx-in {
    from {
        opacity: 0;
        transform: scale(.95) translateY(-4px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.edt-ctx-item {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .1s;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .edt-ctx-item:hover {
        background: #EEEEFF;
    }

.edt-ctx-danger {
    color: #C62828;
}

    .edt-ctx-danger:hover {
        background: #FFF0F0;
    }

.edt-ctx-clone {
    color: #5351FB;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

    .edt-ctx-clone:hover {
        background: #EEEEFF;
    }

.edt-ctx-clone-time {
    font-size: 10px;
    font-weight: 500;
    opacity: .65;
    font-family: 'Space Mono', monospace;
}

.edt-ctx-sep {
    border-top: 1px solid rgba(83,81,251,.1);
    margin: 4px 0;
}

/* ══════════════════════════
   IMPRESSION
══════════════════════════ */
@media print {
    .edt-toolbar, .edt-stats-bar, .edt-legend {
        display: none !important;
    }

    .edt-scroll-wrap {
        max-height: none !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
    }

    .edt-table {
        font-size: 9px !important;
    }

    .edt-th-day, .edt-th-sess, .edt-appt {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
