/* Universal Box Sizing */
html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background-color: #f7f7f7;
    color: #333;
    line-height: 1.6;
    /* Improved readability */
}

header {
    background-color: #763626;
    color: white;
    padding: 15px 10px;
    /* Adjusted for mobile */
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    /* Adjusted for mobile */
    margin: 0;
}

/* Navigation - Desktop styles (base) */
nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

nav li {
    margin: 0 15px;
    position: relative;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
    padding: 10px 0;
    display: block;
    white-space: nowrap;
    /* Prevent breaking nav links */
}

nav a:hover {
    color: #ffd700;
}

/* Dropdown menu for Admission Information (Desktop) */
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #763626;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    list-style: none;
    padding: 0;
    margin-top: 5px;
    border-radius: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: normal;
}

.dropdown-menu a:hover {
    background-color: #a04c38;
    color: #ffd700;
    border-radius: 5px;
}

.dropdown-arrow {
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.2s;
}

main {
    padding: 30px;
    /* Base padding */
}

section {
    margin-bottom: 50px;
    /* Base margin */
    padding: 15px;
    /* Added internal padding for sections */
}

/* Gallery */
.gallery {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    /* Center images */
}

.gallery figure {
    text-align: center;
    margin: 0;
    /* Reset margin from figure default */
    width: 300px;
}

.gallery img {
    max-width: 100%;
    /* Make images responsive */
    height: auto;
    /* Maintain aspect ratio */
    border: 3px solid #ddd;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.gallery img:hover {
    transform: scale(1.05);
}

.gallery figcaption {
    margin-top: 8px;
    font-style: italic;
    color: #555;
    font-size: 0.9em;
}

footer {
    background-color: #763626;
    color: white;
    text-align: center;
    padding: 15px;
    font-size: 0.9em;
}

.datetime-bar {
    background-color: #f4f4f4;
    color: #333;
    text-align: center;
    padding: 8px;
    /* Adjusted padding */
    font-size: 0.9rem;
    /* Adjusted font size */
    font-weight: bold;
    border-bottom: 1px solid #ccc;
}

.language-toggle {
    text-align: center;
    margin: 10px 0;
}

.language-toggle button {
    background-color: #ddd;
    border: none;
    padding: 6px 12px;
    /* Adjusted padding */
    margin: 0 3px;
    /* Adjusted margin */
    cursor: pointer;
    font-weight: bold;
    border-radius: 5px;
    font-size: 0.9em;
}

.language-toggle button:hover {
    background-color: #bbb;
}

/* General table styles */
.programs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    margin-bottom: 30px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.programs-table thead,
.programs-table tbody,
.programs-table th,
.programs-table td,
.programs-table tr {
    white-space: normal;
}

.programs-table th,
.programs-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    vertical-align: top;
    min-width: 120px;
    transition: background-color 0.2s;
}

/* --- STICKY HEADER AND COLUMN FIX --- */

/* 1. Make all header cells sticky */
.programs-table th {
    position: sticky;
    top: 0;
    left: 0;
    background-color: #763626;
    color: white;
    font-weight: bold;
    z-index: 10;
}

/* 2. Make the first column of the body sticky */
.programs-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    /* Lower z-index than the header */
}

/* 3. (KEY FIX) Apply background colors directly to ALL cells, not just rows. */
/* This is a more robust way to prevent the transparency override issue. */

/* Default background for all cells in ODD rows */
.programs-table tbody td {
    background-color: #fff;
}

/* Background for all cells in EVEN rows (striped effect) */
.programs-table tbody tr:nth-child(even) td {
    background-color: #f2f2f2;
}

/* Background for all cells in HOVERED rows */
.programs-table tbody tr:hover td {
    background-color: #ddd;
}

/* --- END OF FIX --- */


/* Headings for sections and sub-sections */
section h2 {
    color: #763626;
    margin-bottom: 20px;
    font-size: 2em;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f2f2f2;
}

section h3 {
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.6em;
    color: #763626;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

section h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2em;
    color: #5a2a20;
}

/* Specific section adjustments */
.education-subsection,
.admission-content-section,
.faq-section {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 30px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.faq-question {
    font-size: 1.1em;
    margin-top: 0;
    margin-bottom: 8px;
}

.faq-answer {
    font-size: 0.9em;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        padding: 10px 5px;
    }

    header h1 {
        font-size: 1.3em;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
    }

    nav li {
        margin: 5px 0;
        width: 90%;
    }

    nav a {
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        background-color: #6a3022;
        margin-top: 0;
        transform: none;
    }

    .dropdown-menu:not(.active) {
        display: none;
    }

    .dropdown-arrow {
        display: inline-block;
        margin-left: 5px;
        transition: transform 0.2s ease-in-out;
    }

    main {
        padding: 15px;
    }

    section {
        margin-bottom: 30px;
        padding: 15px 10px;
    }

    section h2 {
        font-size: 1.6em;
        margin-bottom: 15px;
        padding-bottom: 8px;
    }

    section h3 {
        font-size: 1.3em;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    section h4 {
        font-size: 1.0em;
        margin-top: 15px;
        margin-bottom: 8px;
    }

    .gallery {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .gallery img {
        width: 95%;
        border-width: 2px;
    }

    .gallery figcaption {
        font-size: 0.85em;
    }

    .programs-table th,
    .programs-table td {
        padding: 8px;
        font-size: 0.9em;
    }

    .education-subsection,
    .admission-content-section,
    .faq-section {
        margin-bottom: 25px;
        padding: 15px;
    }

    .faq-question {
        font-size: 1em;
        margin-bottom: 5px;
    }

    .faq-answer {
        font-size: 0.85em;
    }

    .datetime-bar {
        font-size: 0.8rem;
    }

    .language-toggle button {
        font-size: 0.8em;
        padding: 5px 10px;
    }

    footer {
        padding: 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.2em;
    }

    nav a {
        font-size: 0.8em;
        padding: 6px 8px;
    }

    section h2 {
        font-size: 1.4em;
    }

    section h3 {
        font-size: 1.1em;
    }

    section h4 {
        font-size: 0.9em;
    }

    .programs-table th,
    .programs-table td {
        padding: 6px;
        font-size: 0.85em;
    }

    .faq-question {
        font-size: 0.95em;
    }

    .faq-answer {
        font-size: 0.8em;
    }
}