body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6; /* Light gray background */
    color: #333; /* Dark gray text */
    line-height: 1.6;
}

#logout-btn {
    color: #e74c3c !important; /* Red color for logout button */
    font-weight: 600;
    transition: color 0.3s ease;
}
#logout-btn:hover {
    color: #c0392b !important; /* Darker red on hover */
}

header {
    background-color: #2c3e50; /* Dark blue/gray */
    color: #ffffff;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
header h1 {
    margin: 0;
    padding: 0;
    font-size: 1.8rem;
    display: inline-block;
    vertical-align: middle;
}
header nav {
    vertical-align: middle;
}
header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
header nav ul li {
    display: inline-block;
    margin-left: 25px;
    position: relative; /* For dropdown */
}
header nav ul li a {
    color: #ecf4f2;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 5px 0;
    transition: color 0.3s ease;
}
header nav ul li a:hover,
header nav ul li a.active {
    color: #28879f; /* A lighter blue for hover/active */
}
header nav ul li a.active {
    color: #38b1be; /* The existing light blue accent color */
    font-weight: 700; /* Bolder text */
    border-bottom: 2px solid #71bbcc; /* Underline effect */
}

/* Dropdown Menu Styles */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #34495e; /* Slightly lighter dark blue */
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-top: 3px solid #191e86;
}
.dropdown-content a {
    color: #ffffff;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: 400;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.dropdown-content a:hover {
    background-color: #4a627a; /* Darker hover for dropdown items */
    color: #ffffff;
}
.dropdown:hover .dropdown-content {
    display: block;
}

main {
    padding: 40px 0;
    min-height: calc(100vh - 180px); /* Adjust based on header/footer height */
}

.hero {
    text-align: center;
    background-color: #ffffff;
    padding: 60px 20px;
    margin-bottom: 30px;
}
.hero h2 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
}
.hero p {
    font-size: 1.1rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto 30px auto;
}
.button {
    display: inline-block;
    background-color: #3498db; /* Primary blue */
    color: #ffffff;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.button:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: translateY(-2px);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}
.feature-item {
    background-color: #5cd4b8;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.2s ease;
}
.feature-item:hover {
    transform: translateY(-5px);
}
.feature-item h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 15px;
}
.feature-item p {
    font-size: 0.95rem;
    color: #666;
}
.content-page, .topic-page {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    border-left: 5px solid #3498db; /* Accent border */
}
.content-page h2, .topic-page h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}
.content-page h3, .topic-page h3 {
    color: #34495e;
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
}
.content-page ul, .topic-page ul {
    list-style: disc;
    margin-left: 20px;
    margin-bottom: 20px;
}
.content-page ol, .topic-page ol {
    list-style: decimal;
    margin-left: 20px;
    margin-bottom: 20px;
}
.content-page li, .topic-page li {
    margin-bottom: 8px;
}
.content-page p, .topic-page p {
    margin-bottom: 15px;
    font-size: 1rem;
}
.formula-box {
    background-color: #ecf0f1; /* Light grey */
    border-left: 5px solid #3498db;
    padding: 15px 20px;
    margin: 20px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    color: #2c3e50;
    border-radius: 4px;
    overflow-x: auto; /* For long formulas */
}

/* For LaTeX rendering (MathJax) - not part of CSS directly, but good to know */
mjx-container {
    display: block !important;
    text-align: center !important;
    margin: 1em 0 !important;
}

.contact-form .form-group {
    margin-bottom: 20px;
}
.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="subject"],
.contact-form textarea {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    transition: border-color 0.2s ease;
}
.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form input[type="subject"]:focus,
.contact-form textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}
.contact-form textarea {
    resize: vertical; /* Allow vertical resizing */
}

.diagram-container {
    background-color: #ecf0f1; /* Light background for the diagram area */
    padding: 30px;
    border-radius: 8px;
    margin: 25px 0;
    text-align: center;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}
.interactive-diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    margin-bottom: 20px;
}
.diagram-box {
    background-color: #3498db; /* Primary blue for boxes */
    color: #ffffff;
    padding: 20px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 120px;
    text-align: center;
}
.diagram-box:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.diagram-operator {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}
.diagram-instruction {
    font-style: italic;
    color: #666;
    margin-top: 15px;
}
.info-display {
    background-color: #ffffff;
    border: 1px solid #ddd;
    padding: 15px;
    margin-top: 20px;
    border-radius: 6px;
    font-size: 1.05rem;
    color: #333;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.quiz-question {
    background-color: #fdfdfd;
    border: 1px solid #eee;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.quiz-question p {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 15px;
}
.quiz-options label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.quiz-options label:hover {
    background-color: #eef;
    border-color: #b7d7f7;
}
.quiz-options input[type="radio"] {
    margin-right: 10px;
}
.quiz-results {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    font-weight: 600;
}
.quiz-results.correct {
    background-color: #e6ffe6; /* Light green */
    color: #28a745; /* Dark green */
    border: 1px solid #28a745;
}
.quiz-results.incorrect {
    background-color: #ffe6e6; /* Light red */
    color: #dc3545; /* Dark red */
    border: 1px solid #dc3545;
}
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.pagination .button {
    font-size: 0.95rem;
    padding: 10px 20px;
}
.pagination .prev-button {
    background-color: #6c757d; /* Gray */
}
.pagination .prev-button:hover {
    background-color: #5a6268;
}
footer {
    background-color: #34495e; /* Darker blue/gray */
    color: #ffffff;
    text-align: center;
    padding: 1.2rem 0;
    margin-top: 30px;
    font-size: 0.9rem;
}

/* Modal Styles for Progress Tracking */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    padding-top: 60px;
}
.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    color: #333;
}
.modal-content h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
}
.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}
#progress-details ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
#progress-details li {
    background-color: #e9ecef;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#progress-details li.completed {
    background-color: #d4edda; /* Light green for completed */
    color: #155724;
}
#progress-details li.incomplete {
    background-color: #f8d7da; /* Light red for incomplete */
    color: #721c24;
}
#progress-details .progress-status {
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.85em;
}
#progress-details li.completed .progress-status {
    background-color: #28a745;
    color: white;
}
#progress-details li.incomplete .progress-status {
    background-color: #dc3545;
    color: white;
}
#hamburger-btn {
    display: none;
}
@media (max-width: 820px) {
    #hamburger-btn {
        display: block;
    }
}
header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
header nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    margin-left: 40px; /* Add space from logo */
}
header nav ul {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-wrap: wrap;
}
header nav ul li {
    position: relative;
    margin-left: 18px;
}
header nav ul li a {
    display: inline-block;
    position: relative;
    background: transparent;
    color: #ecf4f2;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 8px;
    padding: 10px 18px;
    min-width: 80px;
    text-align: center;
    transition: color 0.3s, background 0.3s;
    z-index: 2;
    overflow: visible;
}
header nav ul li a.active, header nav ul li a:focus {
    color: #38b1be;
}
header nav ul li a:hover {
    color: #38b1be;
}
/* Sliding highlight for active nav item */
#nav-slider {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #38b1be 0%, #71bbcc 100%);
    border-radius: 2px;
    box-shadow: none;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 1;
    width: 80px;
    transform: none;
    pointer-events: none;
}
@media (max-width: 820px) {
    header .container {
        flex-direction: row;
    }
    header nav ul {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }
    header nav ul li {
        margin-left: 0;
        margin-bottom: 8px;
    }
    header nav ul li a {
        min-width: 120px;
        width: 100%;
        text-align: left;
        padding: 12px 32px;
    }
    #nav-slider {
        display: none;
    }
}
@media (max-width: 768px) {
    header nav ul li {
        margin-left: 15px;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .hero h2 {
        font-size: 2rem;
    }
    .hero {
        padding: 40px 15px;
    }
    .feature-item {
        padding: 20px;
    }
    .content-page, .topic-page {
        padding: 25px;
    }
    .content-page h2, .topic-page h2 {
        font-size: 1.7rem;
    }
    .modal-content {
       margin: 10% 20px;
    }
    .interactive-diagram {
        flex-direction: column; /* Stack boxes vertically on small screens */
        gap: 15px;
    }
    .diagram-box {
        width: 80%; /* Make boxes wider */
        max-width: 250px;
    }
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
}
@media (max-width: 480px) {
    header h1 {
        display: block;
        text-align: center;
        margin-bottom: 10px;
    }
    header nav {
        float: none;
        text-align: center;
    }
    header nav ul li {
        margin: 0 8px;
    }
    .button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    .hero h2 {
        font-size: 1.8rem;
    }
}