:root {
    --bg-color: #f5f6fa;
    --text-color: #2c3e50;
    --header-bg: linear-gradient(90deg, #2c3e50 0%, #3498db 100%);
    --header-text: #ffffff;
    --progress-bg: #ecf0f1;
    --progress-bar: #3498db;
    --progress-text-bg: rgba(52, 152, 219, 0.7);
    --progress-text: #ffffff;
    --hero-bg: rgba(255, 255, 255, 0.2);
    --hero-border: rgba(255, 255, 255, 0.3);
    --hero-text: #3498db;
    --quiz-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(52, 152, 219, 0.05));
    --quiz-border: rgba(52, 152, 219, 0.2);
    --quiz-progress-bg: #ecf0f1;
    --quiz-option-bg: rgba(255, 255, 255, 0.2);
    --quiz-option-hover: rgba(52, 152, 219, 0.3);
    --quiz-correct: rgba(0, 204, 0, 0.2);
    --quiz-correct-text: #006600;
    --quiz-incorrect: rgba(231, 76, 60, 0.2);
    --quiz-incorrect-text: #c0392b;
    --course-item-bg: #f9fbfd;
    --course-item-hover: #e6f0fa;
    --cta-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(52, 152, 219, 0.05));
    --cta-border: rgba(52, 152, 219, 0.2);
    --cta-text: #e67e22;
    --buy-btn-bg: #00cc00;
    --buy-btn-hover: #00cc00;
    --footer-bg: rgba(44, 62, 80, 0.9);
    --footer-text: #ffffff;
    --loader-bg: #2c3e50;
    --loader-border: #3498db;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --header-bg: linear-gradient(90deg, #1c2526 0%, #1e5f74 100%);
    --header-text: #e0e0e0;
    --progress-bg: #2d2d2d;
    --progress-bar: #4a90e2;
    --progress-text-bg: rgba(74, 144, 226, 0.7);
    --progress-text: #e0e0e0;
    --hero-bg: rgba(40, 40, 40, 0.2);
    --hero-border: rgba(100, 100, 100, 0.3);
    --hero-text: #4a90e2;
    --quiz-bg: linear-gradient(135deg, rgba(40, 40, 40, 0.1), rgba(74, 144, 226, 0.05));
    --quiz-border: rgba(74, 144, 226, 0.2);
    --quiz-progress-bg: #2d2d2d;
    --quiz-option-bg: rgba(60, 60, 60, 0.2);
    --quiz-option-hover: rgba(74, 144, 226, 0.3);
    --quiz-correct: rgba(0, 153, 0, 0.2);
    --quiz-correct-text: #00cc00;
    --quiz-incorrect: rgba(204, 51, 51, 0.2);
    --quiz-incorrect-text: #ff3333;
    --course-item-bg: #2d2d2d;
    --course-item-hover: #3a3a3a;
    --cta-bg: linear-gradient(135deg, rgba(40, 40, 40, 0.1), rgba(74, 144, 226, 0.05));
    --cta-border: rgba(74, 144, 226, 0.2);
    --cta-text: #ff8c1a;
    --buy-btn-bg: #00b300;
    --buy-btn-hover: #009900;
    --footer-bg: rgba(28, 37, 38, 0.9);
    --footer-text: #e0e0e0;
    --loader-bg: #1c2526;
    --loader-border: #4a90e2;
}

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

body {
    font-family: 'Inter', 'Poppins', sans-serif;
    color: var(--text-color);
    background: var(--bg-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--progress-bg);
    z-index: 2000;
}

.progress-bar {
    height: 100%;
    background: var(--progress-bar);
    width: 0;
    transition: width 0.3s ease;
}

.progress-text {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translate(-50%, -20px);
    background: var(--progress-text-bg);
    color: var(--progress-text);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2001;
    opacity: 0;
    max-width: 300px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease, scale 0.3s ease;
}

.progress-text.show {
    opacity: 1;
    transform: translate(-50%, 0);
    scale: 1;
}

.progress-text.hide {
    opacity: 0;
    transform: translate(-50%, -20px) scale(0.95);
}

header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 1.5rem 0;
    position: fixed;
    width: 100%;
    top: 5px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-main {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    color: var(--header-text);
}

.logo-main::after {
    content: '∑';
    position: absolute;
    font-size: 1rem;
    top: 0;
    right: -20px;
    color: var(--header-text);
    opacity: 0.7;
}

.logo-sub {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--header-text);
    text-transform: uppercase;
    opacity: 0.8;
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
}

.theme-icon-container {
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.theme-icon-container.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.theme-icon {
    font-size: 1.2rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.theme-icon-container:hover .theme-icon {
    transform: scale(1.2);
}

.theme-icon-container[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--progress-text-bg);
    color: var(--progress-text);
    padding: 0.3rem 0.8rem;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}

.theme-icon-container:hover[data-tooltip]::after {
    opacity: 1;
    bottom: -25px;
}

.menu-toggle {
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--header-text);
    display: block;
}

.nav-links {
    display: none;
    position: absolute;
    top: 100%;
    right: 2rem;
    background: var(--quiz-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--quiz-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    padding: 2rem;
    border-radius: 15px;
    flex-direction: column;
    gap: 1.2rem;
    min-width: 250px;
    max-width: 300px;
    z-index: 1001;
    transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
    opacity: 0;
    transform: translateY(-10px);
    align-items: center;
    list-style: none;
}

.nav-links.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
}

.nav-links a:hover {
    color: var(--quiz-option-hover);
    transform: translateY(-2px);
}

/* Full-width horizontal lines */
.nav-links::before,
.nav-links a:nth-child(1)::after,
.nav-links a:nth-child(2)::after,
.nav-links a:nth-child(3)::after,
.nav-links a:nth-child(4)::after {
    content: '';
    display: block;
    width: calc(100% - 2rem);
    height: 1px;
    background: var(--quiz-border);
    margin: 0.8rem auto;
    opacity: 0.7;
    backdrop-filter: blur(4px);
}

.nav-links::before {
    margin-top: 0;
}

.nav-links a:nth-child(5)::after {
    content: '';
    display: block;
    width: calc(100% - 2rem);
    height: 1px;
    background: var(--quiz-border);
    margin: 0.8rem auto 0;
    opacity: 0.7;
    backdrop-filter: blur(4px);
}

.hero {
    margin-top: 65px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--hero-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--hero-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 10px;
}

.hero::before {
    content: 'f(x) = x²';
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 2rem;
    color: var(--hero-text);
    opacity: 0.1;
    transform: rotate(-30deg);
}

.hero h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--hero-text);
    font-weight: 700;
}

.video-container {
    max-width: 700px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

.video-container iframe {
    width: 100%;
    height: 500px;
    border: none;
}

.quiz-containers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
    justify-content: center;
}

.quiz-container {
    background: var(--quiz-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--quiz-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    padding: 2.5rem;
    border-radius: 15px;
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 1200px;
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quiz-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 2px 6px rgba(255, 255, 255, 0.3);
}

.quiz-container h3 {
    font-size: 1.6rem;
    color: var(--hero-text);
    margin-bottom: 1rem;
}

.quiz-progress-container {
    width: 100%;
    height: 1.5rem;
    background: var(--quiz-progress-bg);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.quiz-progress-bar {
    height: 100%;
    background: var(--progress-bar);
    width: 0;
    transition: width 0.3s ease;
}

.quiz-question {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.5;
    color: var(--text-color);
}

.quiz-image {
    margin-bottom: 1rem;
}

.quiz-image img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.quiz-option {
    background: var(--quiz-option-bg);
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s ease, transform 0.2s ease;
    border: 1px solid var(--quiz-border);
    color: var(--text-color);
}

.quiz-option:hover {
    background: var(--quiz-option-hover);
    transform: translateY(-2px);
}

.quiz-option.incorrect-answer {
    animation: shake 0.4s ease;
}

.quiz-feedback {
    font-size: 1rem;
    padding: 1rem;
    border-radius: 10px;
    display: none;
    line-height: 1.5;
    color: var(--text-color);
}

.quiz-feedback.show {
    display: block;
}

.quiz-feedback.correct {
    background: var(--quiz-correct);
    color: var(--quiz-correct-text);
}

.quiz-feedback.incorrect {
    background: var(--quiz-incorrect);
    color: var(--quiz-incorrect-text);
}

.time-remaining {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    background: var(--quiz-option-bg);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--quiz-border);
    color: var(--text-color);
}

.next-btn {
    background: var(--progress-bar);
    color: var(--header-text);
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1rem;
    transition: background 0.3s ease;
}

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

.section {
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section h2 {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--hero-text);
    font-weight: 700;
}

.about-course {
    background: var(--hero-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--hero-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    border-radius: 10px;
    position: relative;
}

.course-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.course-item {
    background: var(--course-item-bg);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    transition: background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.course-item::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 2rem;
    color: var(--hero-text);
    opacity: 0.1;
}

.course-item:nth-child(1)::before { content: '∈'; }
.course-item:nth-child(2)::before { content: 'aⁿ'; }
.course-item:nth-child(3)::before { content: 'x²'; }
.course-item:nth-child(4)::before { content: '[A]'; }
.course-item:nth-child(5)::before { content: '≅'; }
.course-item:nth-child(6)::before { content: 't(n)'; }
.course-item:nth-child(7)::before { content: '≈'; }
.course-item:nth-child(8)::before { content: '∑'; }
.course-item:nth-child(9)::before { content: '∞'; }

.course-item:hover {
    background: var(--course-item-hover);
}

.course-item::after {
    content: attr(data-symbol);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg);
    font-size: 1.5rem;
    color: var(--hero-text);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.cta-info {
    background: var(--cta-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--cta-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    padding: 2.5rem;
    border-radius: 15px;
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-info:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 2px 6px rgba(255, 255, 255, 0.3);
}

.cta-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--hero-text);
}

.cta-info p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--cta-text);
    font-weight: 600;
    display: grid;
    place-items: center;
}

.buy-btn {
    display: inline-block;
    background: var(--buy-btn-bg);
    color: var(--header-text);
    padding: 0.8rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    perspective: 1000px;
    transition: transform 0.5s ease;
    display: grid;
    place-items: center;
}

.buy-btn::after {
    content: 'Great Choice 😊';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--buy-btn-hover);
    color: var(--header-text);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    transform: rotateY(180deg);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.5s ease;
    display: grid;
    place-items: center;
}

.buy-btn:hover {
    transform: rotateY(180deg);
}

.buy-btn:hover::after {
    opacity: 1;
}

footer {
    text-align: center;
    padding: 1rem;
    background: var(--footer-bg);
    color: var(--footer-text);
    font-size: 0.9rem;
    font-weight: 400;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loader-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid var(--loader-border);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite, oscillate 2s ease-in-out infinite;
}

.floating-icon {
    position: absolute;
    font-size: 2rem;
    opacity: 0.2;
    z-index: -1;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes oscillate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@media (max-width: 768px) {
    .hero {
        margin-top: 60px;
        padding: 1rem 2rem;
        margin-bottom: 0.5rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .video-container iframe {
        height: 300px;
    }

    .section {
        padding: 1rem 2rem;
        margin-bottom: 0.5rem;
    }

    .instructor, .cta {
        flex-direction: column;
        text-align: center;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 2rem;
        background: var(--quiz-bg);
        backdrop-filter: blur(12px);
        border: 1px solid var(--quiz-border);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.2);
        padding: 2rem;
        border-radius: 15px;
        flex-direction: column;
        gap: 1.2rem;
        min-width: 250px;
        max-width: 300px;
        z-index: 1001;
        transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
        opacity: 0;
        transform: translateY(-10px);
        align-items: center;
        list-style: none;
    }

    .nav-links.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links a {
        font-size: 1rem;
    }

    .nav-links::before,
    .nav-links a:nth-child(1)::after,
    .nav-links a:nth-child(2)::after,
    .nav-links a:nth-child(3)::after,
    .nav-links a:nth-child(4)::after {
        content: '';
        display: block;
        width: calc(100% - 2rem);
        height: 1px;
        background: var(--quiz-border);
        margin: 0.8rem auto;
        opacity: 0.7;
        backdrop-filter: blur(4px);
    }

    .nav-links::before {
        margin-top: 0;
    }

    .nav-links a:nth-child(5)::after {
        content: '';
        display: block;
        width: calc(100% - 2rem);
        height: 1px;
        background: var(--quiz-border);
        margin: 0.8rem auto 0;
        opacity: 0.7;
        backdrop-filter: blur(4px);
    }

    .progress-text {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }

    .quiz-containers {
        grid-template-columns: 1fr;
        justify-content: center;
        align-items: center;
    }

    .quiz-container {
        max-width: 100%;
        padding: 2rem;
        backdrop-filter: blur(8px);
    }

    .quiz-question {
        font-size: 1.1rem;
    }

    .quiz-image img {
        border-radius: 6px;
    }

    .quiz-option {
        font-size: 1rem;
        border-radius: 8px;
    }

    .time-remaining {
        font-size: 1rem;
        border-radius: 8px;
    }

    .next-btn {
        font-size: 1rem;
        border-radius: 8px;
    }

    .quiz-progress-container {
        height: 1rem;
        border-radius: 8px;
    }

    .quiz-feedback {
        font-size: 0.9rem;
        line-height: 1.5;
        padding: 0.8rem;
        border-radius: 8px;
    }

    .logo-main {
        font-size: 1.6rem;
    }

    .logo-sub {
        font-size: 0.7rem;
    }

    .section h2 {
        font-size: 2rem;
    }

    .instructor-info h3, .cta-info h2 {
        font-size: 1.8rem;
    }

    .instructor-info p, .cta-info p {
        font-size: 1rem;
    }

    .floating-icon {
        font-size: 1.5rem;
    }

    .theme-toggle {
        gap: 0.5rem;
    }

    .theme-icon-container {
        padding: 0.5rem;
    }

    .theme-icon {
        font-size: 1.2rem;
    }

    .theme-icon-container[data-tooltip]::after {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }
}

@media (min-width: 769px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 2rem;
        background: var(--quiz-bg);
        backdrop-filter: blur(12px);
        border: 1px solid var(--quiz-border);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.2);
        padding: 2rem;
        border-radius: 15px;
        flex-direction: column;
        gap: 1.2rem;
        min-width: 250px;
        max-width: 300px;
        z-index: 1001;
        transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
        opacity: 0;
        transform: translateY(-10px);
        align-items: center;
        list-style: none;
    }

    .nav-links.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
    }

    .nav-links::before,
    .nav-links a:nth-child(1)::after,
    .nav-links a:nth-child(2)::after,
    .nav-links a:nth-child(3)::after,
    .nav-links a:nth-child(4)::after {
        content: '';
        display: block;
        width: calc(100% - 2rem);
        height: 1px;
        background: var(--quiz-border);
        margin: 0.8rem auto;
        opacity: 0.7;
        backdrop-filter: blur(4px);
    }

    .nav-links::before {
        margin-top: 0;
    }

    .nav-links a:nth-child(5)::after {
        content: '';
        display: block;
        width: calc(100% - 2rem);
        height: 1px;
        background: var(--quiz-border);
        margin: 0.8rem auto 0;
        opacity: 0.7;
        backdrop-filter: blur(4px);
    }
}