/* --- 1. Global & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: #d32f2f;
    margin-bottom: 24px;
    font-size: 2.5rem;
    flex-shrink: 0;
}

/* --- 2. Main Two-Column Layout --- */
.planner-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    flex-grow: 1;
    min-height: 0;
}

.plan-column, .available-courses-column {
    overflow-y: auto;
    padding: 8px;
}

.plan-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.available-courses-column {
    background: #fdfdfd;
    border-radius: 8px;
}

/* --- 3. Left Column: Summary & Selections --- */
.main-summary, .semester-column {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.main-summary {
    flex-shrink: 0;
}

.summary-header {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.6rem;
    font-weight: 600;
}

.semester-selections-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.semester-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

/* --- 4. Summary Table (REVISED STYLES) --- */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.summary-table th, .summary-table td {
    padding: 14px 10px;
    border-bottom: 1px solid #e9ecef;
}

.summary-table th {
    font-weight: bold;
    color: #343a40;
    text-align: left;
}

.summary-table th:not(:first-child) {
    text-align: center;
}

.summary-table td {
    color: #495057;
    vertical-align: middle;
}

.summary-table td:not(:first-child) {
    text-align: center;
}

.summary-table .fixed-row {
    background-color: #fafafa;
    font-size: 0.95rem;
}

.summary-table tfoot .summary-total-row {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2e7d32;
    background-color: #e8f5e9;
    border-top: 2px solid #a5d6a7;
}

.summary-table tfoot tr:first-child td {
    border-bottom: none;
}

/* --- Status Indicators (REVISED STYLES) --- */
.requirement-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.requirement-status.complete {
    background: #4caf50;
    color: white;
}

/* This special rule styles the dash in the fixed rows */
.fixed-row .requirement-status.complete {
    background: none;
    color: #4caf50;
    font-weight: bold;
    font-size: 1.5rem;
    /* Makes the dash character look like a line */
    margin-left: 15px;
    padding: 0;
    line-height: 1;
    /* Aligns the dash vertically */
}

.requirement-status.incomplete {
    background: #f44336;
    color: white;
}


/* --- 5. Other Component Styles (Largely Unchanged) --- */
.credits-summary {
    background: #e8f5e8;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #4caf50;
}

.credits-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.credits-total {
    font-weight: bold;
    border-top: 1px solid #999;
    padding-top: 5px;
    margin-top: 10px;
    font-size: 1.1rem;
}

.credits-final {
    font-weight: bold;
    color: #2196f3;
    font-size: 1.2rem;
}

.fixed-section {
    margin-bottom: 15px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 8px;
    border-left: 4px solid #666;
}

.fixed-section h3 {
    color: #666;
    margin-bottom: 10px;
}

.compact-fixed-course {
    color: #333;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.category-title {
    font-weight: bold;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ddd;
}

.selected-course {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.remove-btn {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 20px;
    text-align: center;
}

.semester-toggle-btn {
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 2px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: bold;
    margin-right: 5px;
}

.available-courses-column .section-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    padding: 0 12px;
}

#courses-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.course-group {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.course-group.options {
    grid-column: 1 / -1;
}

.group-header {
    padding: 0 0 15px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-header h3 {
    font-size: 1.2rem;
    margin: 0;
    color: #333;
}

.group-header .group-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.group-credits {
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

.projets .group-credits {
    background: #ff9800;
    color: #212529;
}

.physique-bio .group-credits {
    background: #8bc34a;
}

.options .group-credits {
    background: #9c27b0;
}

.semester-separator {
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #5e6c84;
    background-color: #f4f5f7;
    padding: 8px 12px;
    margin: 15px 0;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.course-grid {
    display: grid;
    gap: 10px;
}

.course-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background: white;
}

.course-card:hover {
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.course-card.selected {
    border: 2px solid #4caf50 !important;
    background: linear-gradient(135deg, #e8f5e8, #c8e6c8) !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3) !important;
    transform: translateY(-2px) !important;
}

.course-card.selected .course-title {
    color: #2e7d32 !important;
    font-weight: bold !important;
}

.course-card.selected .course-credits {
    background: #4caf50 !important;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.4) !important;
}

.course-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.course-code {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.course-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-details-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.course-credits {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
    background: #2196f3;
}

.course-language, .course-semester, .course-group-indicator {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: white;
    font-weight: 500;
}

.course-language {
    background: #ff9800;
}

.course-semester {
    background: #607d8b;
}

.course-group-indicator.physique-bio {
    background: #8bc34a;
}

.course-group-indicator.projets {
    background: #ff9800;
    color: #212529;
}

.course-group-indicator.options {
    background: #9c27b0;
}

.info-button {
    background: #666;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    cursor: pointer;
}

.toggle-section {
    margin-top: 10px;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
    font-size: 0.8rem;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- 6. Responsive Design --- */
@media (max-width: 1200px) {
    body {
        height: auto;
        overflow: auto;
    }

    .planner-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #courses-container {
        grid-template-columns: 1fr;
    }

    .semester-selections-wrapper {
        grid-template-columns: 1fr;
    }
}
