/* ===== Variables ===== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #27ae60;
    --warning-color: #e74c3c;
    --light-bg: #f5f6fa;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #dcdde1;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ===== Navbar ===== */
.navbar {
    background-color: var(--primary-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    color: var(--white);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--white);
}

/* ===== Navbar User Section ===== */
.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.btn-nav {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.9rem;
    background-color: rgba(255,255,255,0.1);
    transition: all 0.3s;
}

.btn-nav:hover {
    background-color: rgba(255,255,255,0.2);
    color: var(--white);
}

.btn-logout {
    background-color: rgba(231, 76, 60, 0.7);
}

.btn-logout:hover {
    background-color: rgba(231, 76, 60, 0.9);
}

/* ===== School Badge ===== */
.current-school-badge {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-change-school {
    color: rgba(255,255,255,0.8);
    font-size: 0.75rem;
    text-decoration: none;
}

.btn-change-school:hover {
    color: white;
    text-decoration: underline;
}

.btn-superadmin {
    background-color: rgba(156, 39, 176, 0.7);
}

.btn-superadmin:hover {
    background-color: rgba(156, 39, 176, 0.9);
}

/* ===== Navbar Dropdown ===== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown .dropdown-toggle {
    cursor: pointer;
}

.nav-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--primary-color);
    min-width: 180px;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    list-style: none;
    padding: 0.5rem 0;
    z-index: 200;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.nav-dropdown .dropdown-menu li {
    width: 100%;
}

.nav-dropdown .dropdown-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 0;
}

.nav-dropdown .dropdown-menu a:hover {
    background-color: rgba(255,255,255,0.15);
    color: var(--white);
}

.nav-dropdown .dropdown-menu a.active {
    background-color: rgba(255,255,255,0.1);
    color: var(--white);
}

/* ===== Flash Messages ===== */
.flash-messages {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem 0;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.close-alert {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.close-alert:hover {
    opacity: 1;
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== Titles ===== */
h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 2rem;
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-label {
    color: var(--text-light);
    margin-top: 0.5rem;
}

.stat-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.stat-warning .stat-number {
    color: var(--warning-color);
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: var(--text-light);
    color: var(--white);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-link {
    background: none;
    color: var(--secondary-color);
    padding: 0.5rem 0;
}

/* ===== Alerts ===== */
.alert {
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.alert-info {
    background-color: #d4edfc;
    border: 1px solid var(--secondary-color);
}

.success-message {
    background-color: #d4edda;
    border: 1px solid var(--accent-color);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
}

/* ===== Quick Links ===== */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.quick-link-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s;
}

.quick-link-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.quick-icon {
    width: 50px;
    height: 50px;
    background-color: var(--secondary-color);
    color: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* ===== Search Bar ===== */
.search-bar {
    margin-bottom: 1.5rem;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* ===== Entity Lists ===== */
.entity-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.entity-item {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.entity-item a {
    display: block;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: background-color 0.3s;
}

.entity-item a:hover {
    background-color: var(--light-bg);
}

.entity-name {
    font-weight: 600;
    display: block;
}

.entity-desc,
.entity-type {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== Schedule Grid ===== */
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.schedule-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.schedule-grid-container {
    overflow-x: auto;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.schedule-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.schedule-grid th,
.schedule-grid td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: center;
    vertical-align: top;
}

.schedule-grid th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 600;
    padding: 0.75rem;
}

.time-header {
    width: 120px;
}

.day-header {
    width: 18%;
}

.time-cell {
    background-color: var(--light-bg);
    font-weight: 500;
}

.time-label {
    font-size: 0.8rem;
    line-height: 1.3;
}

.schedule-cell {
    height: 80px;
    min-height: 80px;
    position: relative;
}

.schedule-cell.has-course {
    background-color: #f8f9fa;
}

/* ===== Course Cards ===== */
.course-card {
    background: var(--white);
    border-left: 4px solid var(--secondary-color);
    padding: 0.5rem;
    margin: 2px;
    border-radius: 4px;
    text-align: left;
    font-size: 0.8rem;
    height: calc(100% - 4px);
}

.course-subject {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.course-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-light);
}

.course-class,
.course-room,
.course-teacher {
    background-color: var(--light-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.course-card.conflict {
    border-left-color: var(--warning-color) !important;
}

.conflict-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ===== Conflicts ===== */
.conflicts-container {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.conflicts-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    background: var(--white);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
    border-color: var(--secondary-color);
    background-color: var(--secondary-color);
    color: var(--white);
}

.conflicts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.conflict-item {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid var(--warning-color);
}

.conflict-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.type-teacher {
    background-color: #ffeaa7;
    color: #d68910;
}

.type-room {
    background-color: #dfe6e9;
    color: var(--text-dark);
}

.conflict-description {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.conflict-details {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== Replacement Wizard ===== */
.replacement-wizard {
    background: var(--white);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.wizard-step {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.wizard-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group select,
.form-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    min-width: 250px;
}

.courses-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.course-item:hover {
    background-color: #e8f4fd;
    border-left: 4px solid var(--secondary-color);
}

.course-time {
    font-weight: bold;
    min-width: 120px;
}

.available-teachers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.teacher-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--light-bg);
    border-radius: 5px;
}

.info-card {
    background: #d4edfc;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* ===== Status Messages ===== */
.loading {
    color: var(--secondary-color);
}

.success {
    color: var(--accent-color);
}

.error {
    color: var(--warning-color);
}

.no-data {
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
}

.info-text {
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* ===== Actions Bar ===== */
.actions-bar {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== Section ===== */
.section {
    margin-top: 2rem;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    margin-top: 2rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }

    .schedule-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Absences Manager ===== */
.absences-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.teacher-search {
    margin-bottom: 1rem;
}

.teacher-search input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

.teachers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--light-bg);
}

.teacher-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--white);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.teacher-checkbox:hover {
    background: #e8f4fd;
}

.teacher-checkbox input:checked + span {
    font-weight: bold;
    color: var(--secondary-color);
}

.selected-teachers {
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--light-bg);
    border-radius: 5px;
}

/* Teachers List Container */
.teachers-list-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--light-bg);
}

.teacher-row {
    background: var(--white);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
}

.teacher-row:last-child {
    margin-bottom: 0;
}

/* Teacher Days Selection */
.teacher-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e8f4fd;
    border-radius: 4px;
}

.day-checkbox {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.day-checkbox:hover {
    border-color: var(--secondary-color);
}

.day-checkbox input:checked + span {
    font-weight: bold;
    color: var(--secondary-color);
}

.day-checkbox input:not(:checked) + span {
    color: var(--text-light);
    text-decoration: line-through;
}

/* Date Range Info */
.date-range-info {
    padding: 0.75rem;
    background: #e8f4fd;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--secondary-color);
}

/* Day Selector */
#day-selector {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-success {
    background-color: var(--accent-color);
    color: var(--white);
}

.btn-success:hover {
    background-color: #219a52;
}

/* Analysis Summary */
.summary-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 8px;
}

.summary-stats .stat {
    text-align: center;
}

.summary-stats .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.summary-stats .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

.summary-stats .stat-warning .stat-value {
    color: var(--warning-color);
}

/* Class Cards */
.classes-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.class-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.class-card.has-issues {
    border-color: var(--warning-color);
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: var(--white);
}

.class-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.class-hours {
    font-size: 0.9rem;
    opacity: 0.9;
}

.changes-list {
    padding: 0.5rem;
}

.change-item {
    display: grid;
    grid-template-columns: 120px 1fr auto 150px 1fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.change-item:hover {
    background: var(--light-bg);
}

.change-period {
    font-weight: 500;
    font-size: 0.85rem;
}

.change-original {
    font-size: 0.9rem;
}

.change-original small {
    color: var(--text-light);
}

.change-arrow {
    text-align: center;
    color: var(--text-light);
}

.change-action {
    font-weight: 500;
}

.change-note {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Status Colors */
.status-info .change-action {
    color: #2196F3;
}

.status-success .change-action {
    color: var(--accent-color);
}

.status-warning .change-action {
    color: #ff9800;
}

.status-error .change-action {
    color: var(--warning-color);
}

.status-ok .change-action {
    color: var(--text-light);
}

.status-study .change-action {
    color: #9c27b0;
}

/* ===== Class Schedule Grid (Visual per class) ===== */
.class-schedule-grid {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.class-schedule-grid th,
.class-schedule-grid td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

.class-schedule-grid thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.class-schedule-grid .period-col {
    width: 100px;
    background: #f8f9fa;
    text-align: center;
}

.class-schedule-grid .period-col small {
    color: var(--text-light);
    font-size: 0.75rem;
}

.class-schedule-grid .original-col {
    width: 40%;
}

.class-schedule-grid .result-col {
    width: 40%;
}

.class-schedule-grid .no-course {
    color: var(--text-light);
    font-style: italic;
}

/* Row colors based on action */
.class-schedule-grid tr.row-late_start {
    background: #fff3cd;
}

.class-schedule-grid tr.row-early_release {
    background: #fff3cd;
}

.class-schedule-grid tr.row-shifted {
    background: #d1ecf1;
}

.class-schedule-grid tr.row-study_hall,
.class-schedule-grid tr.row-cancelled {
    background: #f3e5f5;
}

.class-schedule-grid tr.row-replaced {
    background: #d4edda;
}

.class-schedule-grid tr.row-unchanged {
    background: #f8f9fa;
}

/* Result cell styles */
.result-lic {
    color: #856404;
    font-weight: 600;
}

.result-shifted {
    color: #0c5460;
    font-weight: 600;
}

.result-etude {
    color: #6a1b9a;
    font-weight: 600;
}

.result-covered {
    color: #e65100;
    font-weight: 600;
}

.result-supervision {
    color: #455a64;
    font-weight: 600;
}

.result-replaced {
    color: #155724;
    font-weight: 600;
}

.result-outing {
    color: #00838f;
    font-weight: 600;
}

.result-moved {
    color: #512da8;
    font-weight: 600;
}

.result-ok {
    color: var(--text-light);
}

/* Class cards layout */
.classes-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

.class-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.class-card.has-issues {
    border-color: var(--warning-color);
    border-width: 2px;
}

.class-card .class-header {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.class-card .class-header h3 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
}

.class-card .class-hours {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Actions Bar */
.card .actions-bar {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive for absences */
@media (max-width: 900px) {
    .change-item {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .change-arrow {
        display: none;
    }

    .summary-stats {
        justify-content: space-around;
    }
}

/* ===== FDJ Grid ===== */
.fdj-header {
    margin-bottom: 1rem;
}

.fdj-title {
    font-size: 1.2rem;
    padding: 0.75rem;
    background: var(--light-bg);
    border-radius: 5px;
    text-align: center;
}

.fdj-grid-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.fdj-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.fdj-grid th,
.fdj-grid td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: center;
    vertical-align: middle;
}

.fdj-grid thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.fdj-grid thead th small {
    font-weight: normal;
    opacity: 0.8;
    display: block;
    font-size: 0.7rem;
}

.fdj-grid .period-cell {
    background: var(--light-bg);
    font-weight: 500;
    min-width: 80px;
}

.fdj-grid .period-cell small {
    color: var(--text-light);
    font-size: 0.75rem;
}

.fdj-grid .status-cell {
    font-weight: bold;
    min-width: 50px;
}

.fdj-grid .status-cell .origin-info {
    font-weight: normal;
    font-size: 0.75rem;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

.fdj-grid .status-cell .outing-reason {
    font-weight: normal;
    font-size: 0.65rem;
    opacity: 0.95;
    display: block;
    margin-top: 1px;
    font-style: italic;
}

.fdj-grid .class-cell {
    font-size: 0.85rem;
    min-width: 60px;
}

/* FDJ Status Colors */
.fdj-grid .status-lic {
    background-color: #ffeb3b;
    color: #333;
}

.fdj-grid .status-lic .lic-time {
    font-weight: normal;
    font-size: 0.75em;
    color: #555;
}

.fdj-grid .status-x,
.fdj-grid .status-etude {
    background-color: #9c27b0;
    color: white;
}

.fdj-grid .status-dec {
    background-color: #2196F3;
    color: white;
}

.fdj-grid .status-repl {
    background-color: #4CAF50;
    color: white;
}

.fdj-grid .status-covered {
    background-color: #FF9800;
    color: white;
    font-weight: bold;
}

.fdj-grid .status-supervision {
    background-color: #607D8B;
    color: white;
    font-weight: bold;
}

.fdj-grid .status-rescheduled {
    background-color: #9C27B0;
    color: white;
    font-weight: bold;
}

.fdj-grid .status-outing {
    background-color: #00BCD4;
    color: white;
    font-weight: bold;
}

/* Co-enseignement maintenu (non confirmé) - mauve avec bordure pointillée */
.fdj-grid .status-maintained {
    background-color: #9575CD;
    color: white;
    font-weight: bold;
    border: 2px dashed #673AB7;
}

/* Co-enseignement confirmé - blanc/neutre avec texte */
.fdj-grid .status-co-teaching-confirmed {
    background-color: #f5f5f5;
    color: #333;
    font-weight: bold;
    border: 1px solid #ccc;
}

/* Split de co-enseignement */
.fdj-grid .status-split {
    background-color: #7E57C2;
    color: white;
    font-weight: bold;
}

/* ===== FDJ Clickable Cells ===== */
.fdj-grid .clickable-cell {
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.fdj-grid .clickable-cell:hover {
    outline: 3px solid var(--secondary-color);
    outline-offset: -3px;
    transform: scale(1.02);
    z-index: 10;
}

.fdj-grid .clickable-cell.has-override {
    background-image: linear-gradient(135deg, transparent 85%, #e74c3c 85%);
}

.fdj-grid .clickable-cell.has-override::after {
    content: "M";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: bold;
    color: #e74c3c;
}

/* ===== Cell Editor Modal ===== */
.cell-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.cell-editor-modal.active {
    display: flex;
}

.cell-editor-modal-content {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.cell-editor-modal h3 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
}

.cell-editor-info {
    background: var(--light-bg);
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cell-editor-info .info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.cell-editor-info .info-label {
    color: var(--text-light);
}

.cell-editor-info .info-value {
    font-weight: 500;
}

.cell-editor-section {
    margin-bottom: 1rem;
}

.cell-editor-section h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.editor-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.editor-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: var(--light-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-option:hover {
    border-color: var(--secondary-color);
    background: #e8f4fd;
}

.editor-option.selected {
    border-color: var(--secondary-color);
    background: #d4edfc;
}

.editor-option .option-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 0.75rem;
    font-weight: bold;
    font-size: 0.85rem;
}

.editor-option .option-icon.icon-cancel {
    background: #ffeaa7;
    color: #d68910;
}

.editor-option .option-icon.icon-move {
    background: #d1ecf1;
    color: #0c5460;
}

.editor-option .option-icon.icon-force {
    background: #f3e5f5;
    color: #6a1b9a;
}

.editor-option .option-icon.icon-delete {
    background: #f8d7da;
    color: #721c24;
}

.editor-option .option-content {
    flex: 1;
}

.editor-option .option-title {
    font-weight: 500;
    color: var(--text-dark);
}

.editor-option .option-desc {
    font-size: 0.8rem;
    color: var(--text-light);
}

.period-selector {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e8f4fd;
    border-radius: 5px;
}

.period-selector label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.period-selector select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.cell-editor-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.cell-editor-actions .btn {
    flex: 1;
}

.cell-editor-actions .btn-cancel {
    background: var(--light-bg);
    color: var(--text-dark);
}

.cell-editor-actions .btn-cancel:hover {
    background: #dcdde1;
}

/* Overrides Badge */
.overrides-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #fff3cd;
    color: #856404;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.overrides-badge .badge-count {
    background: #856404;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.8rem;
}

.btn-clear-overrides {
    background: #f8d7da;
    color: #721c24;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-clear-overrides:hover {
    background: #f5c6cb;
}

/* ===== Available Teachers Section in Modal ===== */
.editor-teachers {
    margin-top: 1rem;
}

.editor-teachers h4 {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.teacher-search-box {
    margin-bottom: 0.75rem;
}

.teacher-search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.9rem;
}

.teacher-search-box input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.available-teachers-grid {
    max-height: 200px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--light-bg);
    border-radius: 5px;
}

.teacher-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--white);
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.teacher-option:hover {
    border-color: var(--accent-color);
    background: #d4edda;
}

.teacher-option .teacher-sigle {
    background: var(--secondary-color);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75rem;
    min-width: 35px;
    text-align: center;
}

.teacher-option .teacher-name {
    font-size: 0.8rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-teachers {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Status for manually assigned teacher */
.fdj-grid .status-assigned {
    background-color: #27ae60;
    color: white;
    font-weight: bold;
}

/* === Supervisor Dropdown (pour assigner un surveillant aux études) === */
.supervisor-dropdown {
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}

.supervisor-loading {
    padding: 10px 15px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.supervisor-empty {
    padding: 10px 15px;
    color: #999;
    font-style: italic;
    text-align: center;
    font-size: 0.85rem;
}

.supervisor-current {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #e8f5e9;
    border-bottom: 1px solid #c8e6c9;
    font-size: 0.85rem;
}

.supervisor-current span {
    color: #2e7d32;
    font-weight: 500;
}

.btn-remove-supervisor {
    background: #ef5350;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.75rem;
}

.btn-remove-supervisor:hover {
    background: #c62828;
}

.supervisor-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}

.supervisor-item:last-child {
    border-bottom: none;
}

.supervisor-item:hover {
    background: #e3f2fd;
}

.supervisor-sigle {
    background: #27ae60;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75rem;
    min-width: 40px;
    text-align: center;
}

.supervisor-name {
    font-size: 0.85rem;
    color: #333;
    flex: 1;
}

.supervisor-count {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* En-têtes de groupe dans le dropdown */
.supervisor-group-header {
    background: #f5f5f5;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #ddd;
}

/* Prior: Profs libérés par excursion (priorité 0) */
.supervisor-group-header.prior-header,
.supervisor-group-header.excursion-header {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #7b1fa2;
    border-left: 3px solid #9b59b6;
}

/* Fourche: Prof de la classe en fourche (priorité 1) */
.supervisor-group-header.fourche-header {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #e65100;
    border-left: 3px solid #ff9800;
}

/* Option AP: Option A + connaît la classe (priorité 3) */
.supervisor-group-header.option-ap-header {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1565c0;
    border-left: 3px solid #2196f3;
}

/* Option A: ne connaît pas la classe (priorité 3) */
.supervisor-group-header.option-a-header {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Ancien option-b-header - gardé pour rétrocompatibilité */
.supervisor-group-header.option-b-header {
    background: #fff3e0;
    color: #e65100;
}

/* Cellules études cliquables */
.study-cell-clickable {
    cursor: pointer;
    position: relative;
}

.study-cell-clickable:hover {
    box-shadow: inset 0 0 0 2px var(--secondary-color);
}

.study-cell-clickable::after {
    content: "▼";
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 0.5rem;
    opacity: 0.4;
    color: #333;
}

.study-cell-clickable:hover::after {
    opacity: 0.8;
}

/* === Class Grid Override Dropdown === */
.class-grid-dropdown {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    max-height: 350px;
    overflow-y: auto;
    min-width: 200px;
    max-width: 280px;
}

.cgd-header {
    padding: 8px 12px;
    font-weight: bold;
    font-size: 0.85rem;
    color: #2c3e50;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 8px 8px 0 0;
}

.cgd-options {
    display: flex;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.cgd-option {
    flex: 1;
    padding: 6px 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: all 0.15s;
}

.cgd-option:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}

.cgd-option.cgd-active {
    background: #bbdefb;
    border-color: #42a5f5;
    font-weight: bold;
}

.cgd-option.cgd-reset {
    color: #e74c3c;
    border-color: #f5c6cb;
}

.cgd-option.cgd-reset:hover {
    background: #fde8e8;
    border-color: #e74c3c;
}

.cgd-separator {
    height: 1px;
    background: #eee;
}

/* Override indicator on class grid cells */
.cgd-has-override {
    position: relative;
}

.cgd-has-override::before {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: #3498db;
    border-radius: 50%;
}
