:root {
    --primary-color: #6366f1;
    --secondary-color: #a855f7;
    --tertiary-color: #ec4899;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background animated blobs */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: var(--primary-color);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--secondary-color);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 400px;
    height: 400px;
    background: var(--tertiary-color);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, 50px) scale(1.1); }
    100% { transform: translate(-50px, 100px) scale(0.9); }
}

/* Typography & Layout */
h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

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

/* Header & Glassmorphism */
.glass-header {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 2rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #c084fc, #818cf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.dedication {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.5rem;
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
}

/* 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); }
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Grids & Cards */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-chapter-num {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.card-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.card-btn svg {
    transition: transform 0.3s ease;
}

.card-btn:hover svg {
    transform: translateX(4px);
}

/* Mind Map Specific */
.mindmap-container {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.mindmap-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--tertiary-color), var(--secondary-color));
    color: #fff;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    margin-bottom: 2rem;
}

.mindmap-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
}

.iframe-placeholder {
    padding: 2rem;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.iframe-placeholder p {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }
    .container {
        padding: 1rem;
    }
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* Overlay Styles */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--tertiary-color);
}

/* Quiz Styles */
#quiz-title, #flashcard-title {
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.quiz-progress {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.score-text {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

#quiz-results {
    text-align: center;
}

/* Flashcard Styles */
.flashcard-scene {
    perspective: 1000px;
    width: 100%;
    height: 300px;
    margin-bottom: 2rem;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard.is-flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.flashcard-face h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #fff;
}

.flashcard-face p {
    font-size: 1.2rem;
    line-height: 1.6;
}

.tap-hint {
    margin-top: 2rem;
    font-size: 0.9rem !important;
    color: var(--text-muted);
    font-style: italic;
}

.flashcard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

#flashcard-progress {
    font-weight: 600;
    color: var(--text-muted);
}

.hidden {
    display: none !important;
}
