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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.schedule-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.schedule-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 200px;
}

#scheduleQuarter {
    min-width: 140px;
}

.schedule-controls button {
    padding: 6px 12px;
    font-size: 13px;
    background: #27ae60;
}

.schedule-controls button:hover {
    background: #229954;
}

#deleteScheduleBtn {
    background: #e74c3c !important;
}

#deleteScheduleBtn:hover {
    background: #c0392b !important;
}

.help-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: #3498db;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    transition: background 0.2s, transform 0.2s;
}

.help-icon:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.data-controls {
    display: flex;
    gap: 10px;
}

button {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

button:hover {
    background: #2980b9;
}

.main-content {
    display: flex;
    gap: 20px;
}

.sidebar {
    width: 350px;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 5px;
    position: sticky;
    top: 20px;
    align-self: flex-start;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.panel {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.panel h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.collapsible-header:hover {
    color: #3498db;
}

.collapse-icon {
    font-size: 14px;
    transition: transform 0.2s;
}

.collapsible-section {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

input, select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

input:focus, select:focus {
    outline: none;
    border-color: #3498db;
}

#instructorsList, #coursesList, #programsList {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instructor-item, .course-item, .program-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Program items */
.program-item {
    border-left: 4px solid #8e44ad;
}

.program-name {
    font-weight: 600;
    color: #2c3e50;
}

.program-meta {
    font-size: 12px;
    color: #7f8c8d;
}

/* Program filter */
.program-filter {
    margin-bottom: 15px;
}

.program-filter select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

/* Quarters offered dropdown */
.quarters-offered-dropdown {
    position: relative;
}

.quarters-offered-dropdown .filter-toggle {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: border-color 0.2s;
    color: #333;
}

.quarters-offered-dropdown .filter-toggle:hover {
    border-color: #3498db;
    background: white;
}

.quarters-offered-dropdown .filter-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

/* Instructor filter */
.instructor-filter {
    margin-bottom: 15px;
}

.filter-dropdown {
    position: relative;
}

.filter-toggle {
    width: 100%;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: border-color 0.2s;
}

.filter-toggle:hover {
    border-color: #3498db;
    background: white;
}

.filter-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-checkbox:hover {
    background: #f8f9fa;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
}

.instructor-item .workload {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 600;
}

.course-item {
    cursor: grab;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.course-item.course-scheduled {
    background: #d4edda;
    border-color: #c3e6cb;
}

.course-item.course-unscheduled {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.course-item.course-no-program {
    border-left: 4px solid #e74c3c;
}

.no-program-badge {
    font-size: 14px;
    cursor: help;
}

.course-item:hover {
    background: #e8f4f8 !important;
    border-color: #3498db;
}

.course-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.course-info {
    display: flex;
    flex-direction: column;
}

.course-name {
    font-weight: 600;
    color: #2c3e50;
}

.course-meta {
    font-size: 12px;
    color: #7f8c8d;
}

.delete-btn {
    background: #e74c3c;
    padding: 4px 8px;
    font-size: 12px;
}

.delete-btn:hover {
    background: #c0392b;
}

/* Schedule Area */
.schedule-area {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.schedule-area h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2c3e50;
}

#scheduleGrid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.classroom-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.classroom-header {
    background: #34495e;
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.classroom-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.classroom-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toggle-btn {
    background: transparent;
    border: 1px solid white;
    padding: 4px 12px;
    font-size: 12px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.classroom-schedule {
    display: grid;
    grid-template-columns: 100px repeat(6, 1fr);
    border-top: 1px solid #ddd;
}

.classroom-schedule.hidden {
    display: none;
}

.time-label, .day-header, .time-slot {
    padding: 10px;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
}

.day-header {
    background: #ecf0f1;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}

.time-label {
    background: #f8f9fa;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.time-slot {
    min-height: 80px;
    background: white;
    position: relative;
    transition: background 0.2s;
}

.time-slot.drag-over {
    background: #e8f4f8;
    border: 2px dashed #3498db;
}

.time-slot.occupied {
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
}

.time-slot.arranged-slot {
    min-height: 120px;
}

.time-slot.conflict {
    background: #ffcccc;
}

.time-slot.conflict .scheduled-course {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.scheduled-course {
    color: white;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: move;
    position: relative;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
}

.scheduled-course:hover {
    opacity: 0.9;
}

.scheduled-course .course-name {
    color: white;
    font-size: 14px;
    margin-bottom: 2px;
}

.scheduled-course .course-meta {
    color: rgba(255, 255, 255, 0.9);
}

.scheduled-course .remove-course {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.scheduled-course .remove-course:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Form Timeslots */
.timeslot-form-header {
    padding: 12px 15px;
    background: #34495e;
    color: white;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 14px;
    border-top: 1px solid #ddd;
    transition: background 0.2s;
}

.timeslot-form-header:hover {
    background: #2c3e50;
}

.timeslot-form {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
}

.timeslot-form h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.timeslot-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.timeslot-inputs input {
    flex: 1;
}

.timeslots-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.timeslot-tag {
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ddd;
}

.timeslot-tag button {
    background: transparent;
    color: #e74c3c;
    padding: 0;
    font-size: 14px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeslot-tag button:hover {
    color: #c0392b;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.empty-state p {
    margin-bottom: 10px;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #2c3e50;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #7f8c8d;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #2c3e50;
}

#editCourseForm {
    padding: 20px;
}

#editInstructorForm {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

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

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

/* Modality Modal */
.modality-options {
    padding: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.modality-btn {
    flex: 1;
    padding: 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.modality-btn:hover {
    border-color: #3498db;
    background: #e8f4f8;
    transform: translateY(-2px);
}

.modality-icon {
    font-size: 32px;
}

/* Modality Badge */
.modality-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 5px;
    background: rgba(255, 255, 255, 0.3);
}

/* Timeslot day headers */
.timeslot-day-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.timeslot-day-section h5 {
    font-size: 13px;
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 600;
}

.timeslot-day-section .timeslots-list {
    margin-top: 10px;
}

.day-timeslots {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

/* Validation Summary */
.validation-summary {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.validation-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 14px;
    color: #856404;
    transition: background 0.2s;
}

.validation-header:hover {
    background: rgba(0, 0, 0, 0.05);
}

.validation-icon {
    font-size: 12px;
    transition: transform 0.2s;
}

.validation-title {
    flex: 1;
}

.validation-count {
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.validation-errors {
    padding: 0 15px 15px;
}

.validation-errors.collapsed {
    display: none;
}

.validation-error-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.validation-error-item.instructor-conflict {
    background: #f8d7da;
    border-left: 3px solid #e74c3c;
    color: #721c24;
}

.validation-error-item.cohort-conflict {
    background: #d1ecf1;
    border-left: 3px solid #17a2b8;
    color: #0c5460;
}

.validation-error-item.program-conflict {
    background: #f8d7da;
    border-left: 3px solid #8e44ad;
    color: #721c24;
}

.validation-error-item.quarter-conflict {
    background: #fff3cd;
    border-left: 3px solid #f39c12;
    color: #856404;
}

.validation-error-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.validation-error-text {
    flex: 1;
}

.validation-error-text strong {
    font-weight: 700;
}

/* Quarter badge on scheduled courses */
.quarter-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.3px;
}

/* Section badge on scheduled courses */
.section-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
    background: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.3px;
}

/* Modality modal section input */
.modality-section-input {
    padding: 15px 30px 0;
}

.modality-section-input label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.modality-section-input input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}
/* Cohort Summary */
.cohort-summary-controls {
    margin-bottom: 15px;
}

/* ── Shared Time Slot Manager ── */
.timeslot-manager {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.timeslot-manager-header {
    padding: 12px 15px;
    background: #34495e;
    color: white;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s;
}

.timeslot-manager-header:hover {
    background: #2c3e50;
}

.timeslot-manager-body {
    padding: 15px;
    background: #f8f9fa;
}

.timeslots-editable-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.timeslot-editable {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s, background 0.2s;
}

.timeslot-editable.timeslot-overlap {
    border-color: #e67e22;
    background: #fef9e7;
}

.timeslot-editable input[type="time"] {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    width: 120px;
}

.timeslot-separator {
    color: #7f8c8d;
    font-weight: 600;
}

.overlap-warning {
    font-size: 16px;
    cursor: help;
}

.timeslot-remove {
    background: transparent;
    color: #e74c3c;
    padding: 0;
    font-size: 16px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-left: auto;
}

.timeslot-remove:hover {
    color: #c0392b;
    background: #fce4ec;
    border-color: #e74c3c;
}

.timeslot-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeslot-add-row input[type="time"] {
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    width: 120px;
}

/* Overlap indicator on grid time labels */
.time-label-overlap {
    background: #fef9e7 !important;
    border-left: 3px solid #e67e22;
}

.overlap-indicator {
    font-size: 12px;
    cursor: help;
}

#cohortSummaryBtn {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

#cohortSummaryBtn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

#cohortSummaryBtn:active {
    transform: translateY(0);
}

.cohort-summary-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.cohort-name {
    color: #2c3e50;
    font-size: 22px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.cohort-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.cohort-stat {
    font-size: 15px;
    color: #555;
}

.cohort-stat strong {
    color: #2c3e50;
    margin-right: 5px;
}

.cohort-classes-list {
    display: grid;
    gap: 15px;
}

.cohort-class {
    background: white;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #e1e4e8;
    transition: box-shadow 0.2s;
}

.cohort-class:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cohort-class-name {
    font-size: 17px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.cohort-class-info {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.cohort-schedule-list {
    display: grid;
    gap: 8px;
}

.cohort-schedule-item {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #495057;
    border-left: 3px solid #3498db;
}

.cohort-schedule-item strong {
    color: #2c3e50;
    min-width: 100px;
    display: inline-block;
}

.cohort-modality {
    margin-left: 10px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}