
/* Course card */
.course-card {
    background: white;
    border-radius: 14px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow-x: auto;
    border: 1px solid #f0e8e8;
    box-shadow: 0 4px 16px rgba(45,5,7,0.05);
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    max-width: 100%; /* Ensure it never exceeds parent */
    overflow-x: auto; /* Allow horizontal scroll for the table */
    display: block;   /* Ensure it's not a flex/grid item that ignores overflow */
}
.course-card h2 {
    overflow-wrap: break-word;
    word-break: break-word;
}
.course-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 5px;
    height: 100%;
    background: var(--secondary-color);
}

/* Semester tabs */
.sem-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #f0e0dc;
    margin: 2rem 0 1.5rem;
}
.sem-tab {
    padding: 0.85rem 1.75rem;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    color: #6b5c5c;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sem-tab:hover { color: #7b1113; }
.sem-tab.active { color: #7b1113; border-bottom-color: #7b1113; }

.sem-panel { display: none; }
.sem-panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from {opacity:0;transform:translateY(6px);} to {opacity:1;transform:translateY(0);} }

/* Subject table */
.subject-table {
    width: 100%;
    min-width: 400px; /* Optional: setting a minimum width for the TABLE itself 
                         actually helps the .course-card scrollbar appear 
                         instead of squishing the text too much */
    border-collapse: collapse;
    table-layout: auto;
}
.subject-table th {
    background: #faf3f0;
    color: #2d0507;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 2px solid #f0e0dc;
}
.subject-table td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #faf3f0;
    font-size: 0.9rem;
    vertical-align: middle;
}
.subject-table tr:last-child td { border-bottom: none; }
.subject-table tr:hover td { background: #fffaf9; }

.type-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}
.type-theory  { background: #fdf0e0; color: #92400e; }
.type-lab     { background: #f0fdf4; color: #166534; }
.type-elective{ background: #ede9fe; color: #6d28d9; }
.type-project { background: #fee2e2; color: #7b1113;  }

/* Sidebar */
.facts-card {
    background: white;
    border-radius: 14px;
    padding: 1.75rem;
    border: 1px solid #f0e8e8;
    margin-bottom: 1.5rem;
}
.facts-card h4 { color: #2d0507; border-bottom: 2px solid #f0e0dc; padding-bottom: 0.6rem; margin-bottom: 1.25rem; }
.facts-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.facts-item { display: grid; grid-template-columns: 20px 85px 1fr; gap: 0.75rem; align-items: flex-start; line-height: 1.4; }
.facts-item i { color: var(--secondary-color); margin-top: 2px; text-align: center; }
.facts-label { font-size: 0.82rem; font-weight: 700; color: #2d0507; }
.facts-value { font-size: 0.88rem; color: #6b5c5c; }

.contact-card {
    background: var(--accent-color);
    border-radius: 14px;
    padding: 1.75rem;
    color: white;
}
.contact-card h4 { color: white; margin-bottom: 0.75rem; }
.contact-card p  { color: rgba(255,255,255,0.75); font-size: 0.9rem; margin-bottom: 1.25rem; }
.contact-card .btn { width: 100%; display: block; text-align: center; border-color: rgba(255,255,255,0.3); color: white; }
.contact-card .btn:hover { background: white; color: var(--accent-color); border-color: white; }

.academics-grid {
    display: grid;
    /* Change grid-template-columns to use minmax(0, 1fr) */
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); 
    gap: 3rem;
    width: 100%;
}

/* Also update the 900px media query around line 126 */
@media (max-width: 900px) {
    .academics-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .section { padding: 3rem 0; }
    
    .course-card { padding: 1.5rem 1.25rem; }
    .course-card h2 { font-size: 1.5rem !important; }
    
    .sem-tab { padding: 0.75rem 1rem; font-size: 0.85rem; }
    
    .sem-panel {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0;
        max-width: 100%;
        box-sizing: border-box;
        border-radius: 8px;
    }
    .subject-table { 
        min-width: 480px; 
        table-layout: auto;
    }
    .subject-table td {
        white-space: normal !important;
        line-height: 1.4;
    }
    
    /* Facts cards */
    .facts-item { 
        grid-template-columns: 20px 1fr; 
        gap: 0.5rem; 
    }
    .facts-label { grid-column: 2; font-size: 0.75rem; margin-bottom: -0.25rem; }
    .facts-value { grid-column: 2; font-size: 0.95rem; font-weight: 500; }
    .facts-item i { grid-row: 1 / span 2; }
    
    .contact-card, .facts-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 400px) {
    .course-card { padding: 1.25rem 0.85rem; width: 100%; }
    .course-card h2 { font-size: 1.35rem !important; }
    .subject-table td, .subject-table th { padding: 0.85rem 0.75rem; font-size: 0.85rem; }
    .sem-tab { padding: 0.6rem 0.75rem; font-size: 0.8rem; }
    .facts-card, .contact-card { padding: 1.25rem 0.85rem; width: 100%; box-sizing: border-box; }
}

.empty-sem { text-align:center; padding:3rem 1rem; color:#6b5c5c; }
.empty-sem i { font-size:2.5rem; color:#e8c8c8; display:block; margin-bottom:0.75rem; }
.empty-sem a { color:#7b1113; font-weight:600; }
