body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 20px; 
    color: #2c3e50; 
    background-color: #f5f7fa; 
}

/* --- Conteneur Général Hub --- */
.horaires-hub-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.salle-type {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 400;
    color: #64748b;
    text-align: center;
    line-height: 1.3;
}

/* --- Barre de recherche Hub --- */
.search-container {
    margin: 1.5rem 0 2rem 0;
}

.search-input {
    width: 90%;
    max-width: 700px;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.salles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.salle-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-card, #ffffff);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-decoration: none;
    color: #1e293b;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.salle-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #3b82f6;
}

/* --- Interface Calendrier Responsive --- */
.calendar-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

@media (min-width: 600px) {
    .calendar-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.view-switcher {
    display: inline-flex;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: 6px;
}

.btn-toggle {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #475569;
    font-size: 0.9rem;
    border-radius: 4px;
}

.btn-toggle.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- Cartes des Cours (Mobile-First) --- */
.schedule-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.event-card {
    display: flex;
    background: #ffffff;
    border-left: 5px solid #3b82f6; /* Marqueur visuel de cours */
    border-top: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0 6px 6px 0;
    padding: 1rem;
}

.event-time {
    font-weight: bold;
    color: #2563eb;
    min-width: 90px;
    border-right: 1px solid #e2e8f0;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-title {
    margin: 0;
    font-size: 1.1rem;
    color: #0f172a;
}

.event-location, .event-date {
    font-size: 0.85rem;
    color: #64748b;
}

/* --- VUE SEMAINE RESPONSIVE --- */
.week-grid {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    margin-top: 20px;
    padding-bottom: 15px;
    /* Rendu "Magnétique" (Swipe) sur smartphone */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; 
}

.day-column {
    flex: 0 0 85vw; /* Sur mobile, chaque jour prend 85% de la largeur */
    scroll-snap-align: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    min-height: 300px;
    box-sizing: border-box;
}

/* Sur les écrans d'ordinateur ou grandes tablettes (paysage) */
@media (min-width: 900px) {
    .week-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr); /* Les 7 jours côte à côte */
        overflow-x: visible;
    }
    .day-column {
        flex: auto;
    }
}

/* --- Spinner d'animation de chargement --- */
.calendar-loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.calendar-loading-overlay.active {
    display: flex;
}

.calendar-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #cbd5e1;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spinOverlay 0.75s linear infinite;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes spinOverlay {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   --- VUE SYNTHÉTIQUE / DISPONIBILITÉ DES SALLES (COMPACT MATRIX) ---
   ========================================================================== */
.overview-container {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

.overview-header {
    margin-bottom: 1.5rem;
}

.overview-header .header-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.overview-header h2 {
    margin: 0;
    font-size: 1.6rem;
    color: #0f172a;
}

.overview-header .subtitle {
    margin: 4px 0 0 0;
    color: #64748b;
    font-size: 0.95rem;
}

.overview-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #ffffff;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.current-week-label {
    font-size: 1rem;
    color: #1e293b;
    white-space: nowrap;
}

.btn-nav {
    text-decoration: none;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 4px;
    color: #334155;
    font-weight: bold;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn-nav:hover {
    background: #e2e8f0;
}

.date-picker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-picker {
    padding: 6px 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    color: #334155;
    display: inline-flex;
    align-items: center;
    transition: background 0.2s;
}
.btn-picker:hover {
    background: #e2e8f0;
}

#calendarDatePicker {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.right-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input-compact {
    padding: 6px 14px;
    font-size: 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
    min-width: 220px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input-compact:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.legend-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: #475569;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}
.legend-box.free {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
}
.legend-box.occupied {
    background: #60a5fa;
}

/* --- Tableau Matriciel Compact --- */
.overview-table-wrapper {
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    max-height: 75vh;
}

.overview-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 0.8rem;
    text-align: center;
}

.overview-table th, 
.overview-table td {
    padding: 0;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    box-sizing: border-box;
}

/* Sticky Header */
.overview-table thead tr {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8fafc;
}

.overview-table thead tr:first-child th {
    top: 0;
}
.overview-table thead tr:nth-child(2) th {
    top: 29px; /* hauteur de la 1ère ligne d'en-tête */
}

/* Colonne Salle Sticky */
.overview-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #ffffff;
    border-right: 2px solid #cbd5e1 !important;
}

.overview-table thead .sticky-col {
    z-index: 20;
    background: #f8fafc;
}

.room-head {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    font-weight: 700;
    color: #334155;
    padding: 8px !important;
    vertical-align: middle;
    background: #f8fafc;
}

.day-head-title {
    font-weight: 700;
    color: #1e293b;
    padding: 6px 4px !important;
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e1 !important;
    border-left: 2px solid #cbd5e1;
}

.day-head-title .day-date {
    font-weight: 400;
    color: #64748b;
    font-size: 0.75rem;
}

.day-head-title.today-head {
    background: #eff6ff;
    color: #1d4ed8;
}

.unit-head {
    width: 16px;
    min-width: 16px;
    max-width: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    padding: 4px 0 !important;
    background: #f8fafc;
    border-bottom: 2px solid #cbd5e1 !important;
    cursor: help;
}

/* Cellule Salle */
.room-cell {
    padding: 4px 8px !important;
    text-align: left;
    vertical-align: middle;
    background: #ffffff;
}

.room-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}
.room-link:hover .room-name {
    color: #2563eb;
}

.room-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.85rem;
    line-height: 1.2;
}

.room-type {
    font-size: 0.7rem;
    color: #64748b;
    line-height: 1.1;
}

.room-row:hover .room-cell {
    background: #f8fafc;
}

/* Separation épaisse entre chaque jour */
.overview-table td:nth-child(12n+2),
.overview-table th:nth-child(12n+2) {
    border-left: 2px solid #cbd5e1;
}

/* Cellules de Périodes */
.period-cell {
    width: 16px;
    min-width: 16px;
    max-width: 18px;
    height: 24px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
    position: relative;
}

.period-cell.free {
    background: #ffffff;
}

.period-cell.free:hover {
    background: #e2e8f0;
}

.period-cell.occupied {
    background: #60a5fa;
    border-color: #3b82f6;
}

.period-cell.occupied:hover {
    background: #2563eb;
    transform: scale(1.15);
    z-index: 2;
    box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
    border-radius: 2px;
}

.period-cell.today-col.free {
    background: #f8fafc;
}

/* Hover sur toute la ligne */
.room-row:hover .period-cell.free {
    background: #f1f5f9;
}

/* --- Modal Popup Détails Cours --- */
.course-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.course-modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.course-modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    border: 1px solid #e2e8f0;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.modal-close-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.modal-room-tag {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
}

.modal-day-tag {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
}

.modal-title {
    margin: 8px 0 16px 0;
    font-size: 1.25rem;
    color: #0f172a;
    line-height: 1.3;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.95rem;
    color: #334155;
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.modal-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-icon {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

/* --- Carte & Ligne de recherche de disponibilité --- */
.availability-search-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.search-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.search-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
}

.results-badge {
    background: #10b981;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 12px;
}

.search-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.filter-row.mode-row {
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed #e2e8f0;
}

.filter-row.main-params-row {
    justify-content: flex-start;
    gap: 1.25rem 1.5rem;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #334155;
    cursor: pointer;
    user-select: none;
}
.radio-label input[type="radio"] {
    accent-color: #3b82f6;
    cursor: pointer;
}

.date-range-group {
    transition: opacity 0.2s ease;
}

.filter-date-input {
    padding: 5px 10px;
    font-size: 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
}
.filter-date-input:focus {
    border-color: #3b82f6;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.filter-select {
    padding: 6px 12px;
    font-size: 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    cursor: pointer;
}
.filter-select:focus {
    border-color: #3b82f6;
}

.unit-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.unit-pill {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.unit-pill:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.unit-pill.active {
    background: #3b82f6;
    color: #ffffff;
    border-color: #2563eb;
}

.periods-row {
    justify-content: space-between;
}

.btn-reset-filter {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-left: auto;
}
.btn-reset-filter:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Surbrillance des créneaux correspondants à la recherche */
.period-cell.highlight-matched {
    outline: 2px solid #10b981 !important;
    outline-offset: -2px;
    box-shadow: inset 0 0 4px rgba(16, 185, 129, 0.5);
}



