* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Dashboard Section */
.dashboard-section {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    padding: 24px;
    color: white;
}

.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-header h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    cursor: default;
    margin: 0;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header i {
    font-size: 1.5rem;
    color: white;
}

.card-header h3 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 20px;
    color: #374151;
}

/* File Upload Card */
.file-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

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

.shared-dataset-picker {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #d1d5db;
}

.shared-dataset-picker-title {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shared-dataset-picker-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.shared-dataset-picker-row select {
    flex: 1;
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

.shared-dataset-picker-row .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.file-upload-btn-dash {
    background: #3b82f6;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    border: none;
}

.file-upload-btn-dash:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Filter Card */
.filter-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    margin-top: 12px;
}

.filter-label:first-of-type {
    margin-top: 0;
}

.filter-dropdown-dash {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-dropdown-dash:hover {
    border-color: #3b82f6;
}

.filter-dropdown-dash:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.action-btn {
    background: #f3f4f6;
    border: none;
    padding: 16px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-weight: 500;
}

.action-btn i {
    font-size: 1.5rem;
}

.action-btn span {
    font-size: 0.85rem;
}

.action-btn:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.action-btn.regenerate-btn {
    background: #10b981;
    color: white;
}

.action-btn.regenerate-btn:hover {
    background: #059669;
}

#boardStatsBtn {
    background: #f59e0b;
    color: white;
}

#boardStatsBtn:hover {
    background: #d97706;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 500;
}

/* Schedule Section */
.schedule-section {
    flex: 1;
    padding: 24px;
    background: white;
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.section-header h2 {
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.header-controls label {
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}

.student-dropdown {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 250px;
}

.student-dropdown:hover {
    border-color: #3b82f6;
}

.student-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.icon-btn {
    background: #3b82f6;
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.icon-btn:active {
    transform: translateY(0);
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error/Warning Banners */
.error-banner, .warning-banner {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.error-banner {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.warning-banner {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.error-banner.hidden, .warning-banner.hidden {
    display: none;
}

/* Schedule Table */
.schedule-container {
    overflow-x: auto;
    margin-top: 20px;
}

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

.schedule-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #e5e7eb;
    text-align: center;
    vertical-align: top;
}

.schedule-table th {
    background: #1f2937;
    color: white;
    font-weight: 600;
    padding: 12px;
}

.day-header {
    background: #1f2937 !important;
    min-width: 100px;
}

.session-header {
    background: #374151 !important;
    min-width: 200px;
}

.day-column {
    background: #6b7280;
    color: white;
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 15;
}

.schedule-cell {
    background: #e2dfdf;
    padding: 12px;
    min-height: 80px;
}

/* Highlighted Cells */
.schedule-cell.highlighted-available {
    cursor: pointer !important;
    border: 2px solid #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.schedule-cell.highlighted-unavailable {
    cursor: pointer !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Exam Cards */
.exam-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    position: relative;
}

.exam-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* Exam Card States */
.exam-card.current-exam {
    background: #f0fdf4 !important;
    border: 2px solid #22c55e !important;
}

.exam-card.conflicting-exam {
    background: #fef2f2 !important;
    border: 2px solid #ef4444 !important;
    position: relative;
}

.exam-card.student-highlight {
    background: #eff6ff !important;
    border: 2px solid #3b82f6 !important;
}

.exam-card.in-conflict-student {
    background: #fef2f2 !important;
    border: 2px solid #ef4444 !important;
}

.exam-card.in-conflict-rule {
    background: #fff7ed !important;
    border: 2px solid #f59e0b !important;
}

.exam-card.in-conflict-both {
    background: #fef3f2 !important;
    border: 2px solid #a855f7 !important;
}

/* Exam Card Components */
.exam-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.exam-number {
    background: #6b7280;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
}

.student-count {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 3px;
}

.student-count i {
    font-size: 12px;
}

.exam-actions {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.exam-btn {
    background: #f3f4f6;
    border: none;
    color: #6b7280;
    padding: 5px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.exam-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

.exam-btn i {
    font-size: 14px;
}

/* Conflict Tooltip */
.conflict-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1100;
    pointer-events: none;
    white-space: nowrap;
}

.exam-card.conflicting-exam:hover .conflict-tooltip,
.exam-card.in-conflict-student:hover .conflict-tooltip,
.exam-card.in-conflict-rule:hover .conflict-tooltip,
.exam-card.in-conflict-both:hover .conflict-tooltip {
    opacity: 1;
    visibility: visible;
}

.conflict-tooltip-content {
    background: #1f2937;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    line-height: 1.6;
}

.conflict-tooltip-content strong {
    display: block;
    color: #ef4444;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.conflict-tooltip-content div {
    padding: 3px 0;
    color: #e5e7eb;
}

.conflict-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
}

/* Stop Sign Icon */
.stop-sign {
    position: absolute;
    top: -6px;
    left: -6px;
    background: #ef4444;
    border: 2px solid white;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: help;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    z-index: 5;
}

.stop-sign:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.6);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.modal-content.modal-small {
    max-width: 400px;
}

.modal-content.modal-large {
    max-width: 900px;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.close:hover,
.close:focus {
    transform: scale(1.2);
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Settings Groups */
.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.setting-group input,
.setting-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    margin-bottom: 10px;
    transition: border-color 0.2s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.load-schedule-select {
    width: 100%;
}

/* Buttons */
.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary {
    background: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Students List */
.students-list {
    max-height: 400px;
    overflow-y: auto;
}

.student-item {
    padding: 10px;
    border-bottom: 1px solid #e5e7eb;
}

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

.student-item:hover {
    background: #f9fafb;
}

.clickable-student {
    cursor: pointer;
    transition: background 0.2s ease;
}

.clickable-student:hover {
    background: #f3f4f6 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .student-dropdown {
        width: 100%;
    }
    
    .icon-btn {
        width: 100%;
        height: 44px;
    }
    
    h1 {
        font-size: 1.5rem;
    }

    .schedule-table th,
    .schedule-table td {
        min-width: 120px;
        padding: 8px;
    }

    .exam-card {
        padding: 6px 10px;
        margin: 3px;
        font-size: 13px;
    }
    
    .exam-title {
        font-size: 12px;
    }
    
    .exam-number {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .student-count {
        font-size: 11px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        max-height: 60vh;
    }
}

.file-upload-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-upload-btn {
    background: #3b82f6;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    border: none;
}

.file-upload-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.file-status {
    font-size: 0.85rem;
    color: #6b7280;
}

.file-status.success {
    color: #10b981;
    font-weight: 500;
}

.file-status.error {
    color: #ef4444;
    font-weight: 500;
}

.file-status-not-loaded {
    color: #f59e0b;
    font-weight: 500;
    font-size: 0.8rem;
}

.file-preview-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: auto;
}

.file-preview-btn:hover {
    background: #e5e7eb;
    color: #1f2937;
}

/* Data Preview Modal */
.modal-content.modal-xlarge {
    max-width: 1100px;
}

.data-preview-summary {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.data-preview-table-wrap {
    overflow-x: auto;
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.data-preview-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
    white-space: nowrap;
}

.data-preview-table th,
.data-preview-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.data-preview-table th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    z-index: 1;
}

/* Visually separate the app's interpretation from the raw spreadsheet columns */
.data-preview-table td.data-preview-interpreted-col {
    background: #eef2ff;
    border-left: 2px solid #c7d2fe;
    white-space: normal;
}

.data-preview-table th.data-preview-interpreted-col {
    background: #e0e7ff;
    color: #3730a3;
    border-left: 2px solid #c7d2fe;
}

.data-preview-row-included {
    background: white;
}

.data-preview-row-warning {
    background: #fffbeb;
}

.data-preview-row-skipped {
    background: #fef2f2;
    color: #9ca3af;
}

.data-preview-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.data-preview-status.data-preview-row-included {
    background: #d1fae5;
    color: #065f46;
}

.data-preview-status.data-preview-row-warning {
    background: #fef3c7;
    color: #92400e;
}

.data-preview-status.data-preview-row-skipped {
    background: #fee2e2;
    color: #991b1b;
}

.data-preview-reason {
    display: block;
    color: #9ca3af;
    font-size: 0.78rem;
    font-style: italic;
    margin-top: 2px;
}

.data-preview-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.data-preview-tab-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.data-preview-tab-btn:hover {
    background: #e5e7eb;
}

.data-preview-tab-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.data-preview-mono {
    font-family: 'Courier New', monospace;
    white-space: normal;
}

/* Log Modal Styles */
.log-messages {
    max-height: 500px;
    overflow-y: auto;
}

.log-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid;
}

.log-item.log-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.log-item.log-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.log-item.log-error {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #6b7280;
}

.log-icon {
    font-size: 1rem;
}

.log-timestamp {
    font-family: monospace;
}

.log-message {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

/* Scrollbar Styling */
.schedule-container::-webkit-scrollbar,
.students-list::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.log-messages::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.schedule-container::-webkit-scrollbar-track,
.students-list::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.schedule-container::-webkit-scrollbar-thumb,
.students-list::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb:hover,
.students-list::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Custom Rules Styling */
.setting-group h4 {
    font-size: 1rem;
    color: #1f2937;
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.setting-group p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 12px;
}

.rule-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.rule-select {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.2s ease;
}

.rule-select:focus {
    outline: none;
    border-color: #667eea;
}

.rule-number {
    width: 80px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    text-align: center;
    transition: border-color 0.2s ease;
}

.rule-number:focus {
    outline: none;
    border-color: #667eea;
}

.btn-small {
    padding: 10px 16px;
    width: auto;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.rules-list {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.rule-item:last-child {
    margin-bottom: 0;
}

.rule-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rule-item span {
    flex: 1;
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
}

.rule-item strong {
    color: #1f2937;
    font-weight: 600;
}

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-delete:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-delete:active {
    transform: translateY(0);
}

.btn-delete i {
    font-size: 14px;
}

.no-rules {
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
    padding: 20px;
}

/* Saved Schedules List */
.saved-schedules-list {
    background: #f9fafb;
    border-radius: 8px;
    padding: 12px;
    min-height: 60px;
    max-height: 300px;
    overflow-y: auto;
}

.saved-schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.saved-schedule-item:last-child {
    margin-bottom: 0;
}

.saved-schedule-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.schedule-info {
    flex: 1;
}

.schedule-info strong {
    display: block;
    color: #1f2937;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.schedule-meta {
    font-size: 0.8rem;
    color: #6b7280;
}

.schedule-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-load {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.btn-load:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.btn-load:active {
    transform: translateY(0);
}

.btn-load i {
    font-size: 14px;
}

.btn-delete-schedule {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.btn-delete-schedule:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-delete-schedule:active {
    transform: translateY(0);
}

.btn-delete-schedule i {
    font-size: 14px;
}

/* Rules List Scrollbar */
.rules-list::-webkit-scrollbar {
    width: 6px;
}

.rules-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.rules-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.rules-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Rules Modal Sections */
.rules-section {
    margin-bottom: 30px;
}

.rules-section:last-child {
    margin-bottom: 0;
}

.rules-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.rules-section-title i {
    font-size: 1.5rem;
    color: #6b7280;
}

/* Strict Rules */
.strict-rules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.strict-rule-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    border-radius: 8px;
}

.strict-rule-item i {
    font-size: 1.5rem;
    color: #22c55e;
    flex-shrink: 0;
    margin-top: 2px;
}

.strict-rule-item strong {
    display: block;
    color: #1f2937;
    font-size: 1rem;
    margin-bottom: 4px;
}

.strict-rule-item p {
    color: #374151;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.5;
}

/* Custom Rule Categories */
.custom-rule-category {
    margin-bottom: 24px;
}

.custom-rule-category:last-child {
    margin-bottom: 0;
}

.custom-rule-category h4 {
    font-size: 1.05rem;
    color: #1f2937;
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.custom-rule-category p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 12px;
}

/* Responsive for Custom Rules */
@media (max-width: 768px) {
    .rule-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rule-select {
        width: 100%;
        min-width: auto;
    }
    
    .rule-number {
        width: 100%;
    }
    
    .btn-small {
        width: 100%;
    }
    
    .rule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .btn-delete {
        width: 100%;
        justify-content: center;
    }
}

/* View Toggle Buttons */
.view-toggle-container {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.view-toggle-btn {
    flex: 1;
    background: white;
    border: 2px solid #e5e7eb;
    color: #374151;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-toggle-btn i {
    font-size: 1.1rem;
}

.view-toggle-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.view-toggle-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* Split View Layout */
.split-view-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

.split-view-panel {
    flex: 1;
    overflow-x: auto;
}

.split-view-panel h3 {
    color: #1f2937;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

@media (max-width: 1200px) {
    .split-view-container {
        flex-direction: column;
    }
}

/* ================================================
   MODE SELECTION OVERLAY
   ================================================ */

.mode-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #1a365d 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.mode-overlay.hidden {
    display: none;
}

.mode-selection-container {
    max-width: 900px;
    width: 95%;
    padding: 40px 20px;
}

.mode-selection-header {
    text-align: center;
    margin-bottom: 48px;
    color: white;
}

.mode-selection-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.mode-selection-header p {
    font-size: 1.1rem;
    color: #94a3b8;
}

.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 640px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }
}

.mode-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 3px solid transparent;
    cursor: pointer;
}

.mode-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    border-color: #3b82f6;
}

.mode-card-board:hover {
    border-color: #8b5cf6;
}

.mode-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.mode-card-icon i {
    font-size: 2rem;
    color: white;
}

.mode-card-icon-board {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.mode-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.mode-card p {
    font-size: 0.95rem;
    color: #6b7280;
    margin-bottom: 20px;
    line-height: 1.6;
}

.mode-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
    text-align: left;
    width: 100%;
}

.mode-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.mode-features li:last-child {
    border-bottom: none;
}

.mode-features li i {
    color: #10b981;
    font-size: 1rem;
    flex-shrink: 0;
}

.mode-select-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    letter-spacing: 0.025em;
}

.mode-select-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
}

.mode-select-btn-board {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.mode-select-btn-board:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.5);
}

/* ================================================
   MODE BADGE & SWITCH BUTTON (in header)
   ================================================ */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.header-left h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    cursor: default;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.mode-badge-mock {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.mode-badge-board {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.switch-mode-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.switch-mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ================================================
   BOARD EXAMS FILE UPLOAD BUTTON STYLE
   ================================================ */

.file-upload-btn-board {
    background: #7c3aed !important;
}

.file-upload-btn-board:hover {
    background: #6d28d9 !important;
}

/* ================================================
   BOARD EXAMS DASHBOARD (board mode colours)
   ================================================ */

.dashboard-section.board-mode {
    background: linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
}

/* ================================================
   BOARD EXAMS SCHEDULE TABLE
   ================================================ */

.board-schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    font-size: 0.9rem;
}

.board-schedule-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.board-schedule-table th {
    background: #1f2937;
    color: white;
    font-weight: 600;
    padding: 12px 10px;
    text-align: center;
    border: 1px solid #374151;
}

.board-schedule-table td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    vertical-align: top;
}

.board-date-cell {
    background: #374151;
    color: white;
    font-weight: 700;
    text-align: center;
    min-width: 110px;
    vertical-align: middle;
}

.board-session-am {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    min-width: 60px;
}

.board-session-pm {
    background: #fef3c7;
    color: #92400e;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
    min-width: 60px;
}

.board-time-cell {
    text-align: center;
    vertical-align: middle;
    min-width: 90px;
    font-size: 0.88em;
    font-weight: 600;
    color: #1e40af;
    background: #eff6ff;
    white-space: nowrap;
}

.board-exams-cell {
    font-size: 0.82em;
    color: #374151;
    min-width: 200px;
    background: #f9fafb;
}

.board-exam-entry {
    padding: 3px 0;
    border-bottom: 1px dotted #d1d5db;
    line-height: 1.4;
}

.board-exam-entry:last-child {
    border-bottom: none;
}

.board-exam-code {
    font-weight: 600;
    color: #1f2937;
}

.board-exam-syllabus {
    color: #6b7280;
    font-size: 0.95em;
}

.board-exam-meta {
    color: #9ca3af;
    font-size: 0.9em;
}

.board-venue-cell {
    text-align: center;
    min-width: 110px;
    vertical-align: middle;
}

.board-venue-cell .board-teacher-name {
    cursor: pointer;
    text-decoration: underline;
    color: #3b82f6;
    font-weight: 500;
}

.board-venue-cell .board-teacher-name:hover {
    color: #1d4ed8;
}

.board-unassigned {
    color: #d1d5db;
    font-style: italic;
}

.board-week-header {
    background: linear-gradient(135deg, #374151, #1f2937);
    color: #9ca3af;
    text-align: center;
    font-size: 0.8em;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 6px 10px;
}

/* Board exams empty state */
.board-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.board-empty-state i {
    font-size: 4rem;
    color: #8b5cf6;
    margin-bottom: 20px;
    display: block;
}

.board-empty-state h2 {
    color: #1f2937;
    margin-bottom: 10px;
}

/* Board exams loading message */
.board-loading-text {
    color: #8b5cf6;
}

/* Available teacher listed in a board exam session cell */
/* ================================================
   BOARD EXAM TEACHER HIGHLIGHT STYLES
   ================================================ */

/* Info bar shown above the table when a teacher is selected */
.board-teacher-indicator {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 10px;
    font-size: 0.88em;
    color: #1e40af;
}

.board-teacher-clear {
    cursor: pointer;
    color: #ef4444;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    white-space: nowrap;
}

.board-teacher-clear:hover {
    background: #fee2e2;
}

.board-teacher-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    color: #475569;
}

.board-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Selected teacher div highlighted inside a cell */
.board-teacher-avail.board-teacher-selected {
    background: #bfdbfe !important;
    color: #1e3a8a !important;
    font-weight: 700;
    border: 1px solid #2563eb;
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.board-study-room.board-teacher-selected {
    background: #bfdbfe !important;
    color: #1e3a8a !important;
    font-weight: 700;
    border-left: 3px solid #1d4ed8 !important;
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

/* Cell where the selected teacher IS currently assigned */
.board-venue-cell.board-cell-teacher-assigned {
    background: #dbeafe !important;
}

/* Cell where the selected teacher is available but NOT currently assigned */
.board-venue-cell.board-cell-teacher-available {
    background: #d1fae5 !important;
}

/* Teacher divs that belong to OTHER teachers while one is selected — completely hidden */
.board-teacher-hidden {
    display: none !important;
}

/* ================================================
   BOARD EXAM WORKLOAD STATS MODAL
   ================================================ */

.board-stats-summary {
    color: #6b7280;
    font-size: 0.88em;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #8b5cf6;
}

.board-stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.board-stats-row {
    display: grid;
    grid-template-columns: 200px 1fr 52px 52px;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    transition: background 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

.board-stats-row:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.board-stats-selected {
    background: #eff6ff !important;
    border-color: #3b82f6 !important;
    font-weight: 600;
}

.board-stats-name {
    font-size: 0.9em;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-stats-bar-wrap {
    height: 12px;
    background: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.board-stats-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.board-stats-count {
    font-size: 0.88em;
    font-weight: 700;
    color: #374151;
    text-align: right;
    min-width: 32px;
}

/* Count badge in the teacher indicator bar */
.board-teacher-count {
    display: inline-block;
    background: #6d28d9;
    color: white;
    font-size: 0.82em;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.board-study-room {
    font-size: 0.78em;
    color: #1e40af;
    background: #dbeafe;
    border-radius: 4px;
    padding: 1px 5px;
    margin-top: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 3px solid #3b82f6;
    font-weight: 600;
    display: block;
}

.board-study-room-empty {
    font-size: 0.72em;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 3px;
    padding: 1px 4px;
    margin-top: 3px;
    font-weight: 600;
    display: block;
}

.board-invig-warning {
    font-size: 0.72em;
    color: #f59e0b;
    font-weight: 600;
    margin-top: 2px;
    padding: 1px 4px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 3px;
    display: block;
}

.board-teacher-avail {
    font-size: 0.78em;
    color: #065f46;
    background: #d1fae5;
    border-radius: 4px;
    padding: 1px 5px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Board staff replace — custom picker list */
.board-replace-list {
    max-height: 220px;
    overflow-y: auto;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
    background: white;
}

.board-replace-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.88em;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: filter 0.1s ease;
    user-select: none;
}

.board-replace-option:last-child {
    border-bottom: none;
}

.board-replace-option.available {
    color: #065f46;
    background: #f0fdf4;
}

.board-replace-option.unavailable {
    color: #991b1b;
    background: #fff5f5;
}

.board-replace-option.remove-option {
    color: #6b7280;
    background: #f9fafb;
    font-style: italic;
    border-bottom: 2px solid #e5e7eb;
}

.board-replace-option:hover {
    filter: brightness(0.93);
}

.board-replace-option.board-replace-selected {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    font-weight: 700;
}

/* Board schedule staff replace button */
.board-replace-btn {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.8em;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 3px;
    border-radius: 3px;
    opacity: 0.5;
    transition: all 0.15s ease;
    vertical-align: middle;
    line-height: 1;
}

.board-replace-btn:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    opacity: 1;
}

/* Per-exam starting time badge shown inline when times differ within a session */
.board-exam-time {
    display: inline-block;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 0.75em;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-right: 4px;
    vertical-align: middle;
    white-space: nowrap;
}
