/* CSS Variables for Light Theme */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-card: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --accent-primary: #9f7aea;
    --accent-secondary: #b794f4;
    --border-color: #4a5568;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styles */
header {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 20px;
    margin-bottom: 3rem;
    position: relative;
    box-shadow: var(--shadow-lg);
}

header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.theme-toggle .icon {
    font-size: 1.5rem;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    justify-content: center;
}

.tab-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: 1rem 2.5rem;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

.tab-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-icon {
    font-size: 1.3rem;
}

.tab-text {
    font-size: 1rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Intro Section */
.intro {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--accent-primary);
    transition: var(--transition);
}

.intro p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Theory Cards Container */
.theories-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Individual Theory Card */
.theory-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.theory-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.theory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.theory-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.theory-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.theory-content h3 {
    color: var(--accent-primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.theory-content p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.theory-content ul {
    list-style: none;
    margin-bottom: 1.5rem;
}

.theory-content ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.theory-content ul li::before {
    content: "•";
    color: var(--accent-primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.theory-content ul li strong {
    color: var(--text-primary);
}

/* Practice Section within Cards */
.practice {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 10px;
    margin-top: 1.5rem;
    border-left: 3px solid var(--accent-secondary);
}

.practice h4 {
    color: var(--accent-secondary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.practice p {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.95rem;
}

/* Quiz Section */
.quiz-section {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    margin-bottom: 3rem;
    transition: var(--transition);
}

.quiz-section h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.quiz-section > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Quiz Progress Bar */
.quiz-progress {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 10%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* Question Container */
.question-container {
    min-height: 300px;
    margin-bottom: 2rem;
}

.question {
    margin-bottom: 2rem;
}

.question h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    transform: translateX(5px);
}

.option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.option label {
    flex: 1;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1rem;
}

.option.selected {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.option.correct {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.1);
}

.option.incorrect {
    border-color: #f56565;
    background: rgba(245, 101, 101, 0.1);
}

/* Quiz Controls */
.quiz-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 0.875rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results Container */
.results-container {
    text-align: center;
}

.results-container h3 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 2rem;
}

.score-display {
    margin-bottom: 2rem;
}

.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: var(--shadow-lg);
}

.score-circle span {
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
}

.score-text {
    color: var(--text-primary);
    font-size: 1.2rem;
}

.score-message {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    border-left: 4px solid var(--accent-primary);
}

/* Review Section */
.review-section {
    text-align: left;
    margin: 2rem 0;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 10px;
}

.review-item {
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border-radius: 10px;
    border-left: 4px solid var(--border-color);
}

.review-item.correct {
    border-left-color: #48bb78;
}

.review-item.incorrect {
    border-left-color: #f56565;
}

.review-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.review-answer {
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.review-answer.user-answer {
    color: #f56565;
}

.review-answer.correct-answer {
    color: #48bb78;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: var(--accent-primary);
    color: white;
    text-align: center;
    transition: var(--transition);
}

.message.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .theories-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .theory-card {
        padding: 1.5rem;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        top: 1rem;
        right: 1rem;
    }

    .tabs {
        flex-direction: row;
        gap: 0.5rem;
    }

    .tab-btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .tab-icon {
        font-size: 1.1rem;
    }

    .tab-text {
        font-size: 0.9rem;
    }

    .quiz-section {
        padding: 1.5rem;
    }

    .quiz-controls {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-circle span {
        font-size: 2rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--accent-primary);
    color: white;
}
