/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');

/* Highlighting */
.highlight {
    color: #ffd700;
    font-weight: bold;
    background: rgba(255, 215, 0, 0.1);
    padding: 0 4px;
    border-radius: 4px;
}

.highlight-blue {
    color: var(--accent);
    font-weight: bold;
    background: rgba(88, 166, 255, 0.1);
    padding: 0 4px;
    border-radius: 4px;
}

/* CSS Diagrams */
.diagram-box {
    border: 2px dashed var(--border);
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 12px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

.diagram-node {
    display: inline-block;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    margin: 1rem;
    position: relative;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.diagram-cloud {
    display: inline-block;
    padding: 2rem 3rem;
    border: 3px solid #fff;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    margin: 2rem;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.diagram-line {
    width: 2px;
    height: 30px;
    background: var(--text-secondary);
    margin: 0 auto;
}

.diagram-arrow-down {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    margin: 0 auto;
}

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #010409;
    --card-bg: #161b22;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-glow: rgba(56, 139, 253, 0.4);
    --border: #30363d;
    --success: #238636;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s;
}

h1,
h2,
h3,
h4 {
    color: #fff;
    margin-top: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: #79c0ff;
    text-shadow: 0 0 5px var(--accent-glow);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 2rem;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar h2 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.nav-links {
    list-style: none;
    padding: 0;
}

.nav-links li {
    margin-bottom: 0.8rem;
}

.nav-links a {
    display: block;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(56, 139, 253, 0.1);
    color: #fff;
    border-left-color: var(--accent);
    transform: translateX(5px);
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 2000;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    padding: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1f293a 0%, var(--bg-primary) 60%);
    transition: margin-left 0.3s;
}

/* Hero / Index Styles */
.index-container {
    padding: 5rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.8s ease-out;
}

.index-header {
    text-align: center;
    margin-bottom: 5rem;
}

.index-header h1 {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(to right, #ffffff, #58a6ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    text-shadow: 0 10px 30px rgba(88, 166, 255, 0.2);
    animation: slideDown 0.8s ease-out;
}

.index-header .subtitle {
    font-size: 1.4rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 8px;
    margin-top: 1rem;
    border-bottom: 1px solid rgba(88, 166, 255, 0.3);
    padding-bottom: 5px;
    display: inline-block;
    animation: slideUp 0.8s ease-out 0.2s backwards;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2.5rem;
}

.module-card {
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-out backwards;
}

.module-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(88, 166, 255, 0.1);
    background: rgba(22, 27, 34, 0.9);
}

.module-number {
    font-size: 4rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.03);
    position: absolute;
    top: -10px;
    right: 15px;
    line-height: 1;
    transition: color 0.3s;
}

.module-card:hover .module-number {
    color: rgba(88, 166, 255, 0.1);
}

.module-title {
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 1.5rem;
    font-weight: 700;
    padding-right: 2rem;
}

.module-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* Chapter Content Styles */
.chapter-container {
    padding: 6rem 5rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

.chapter-header-block {
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
}

.chapter-header-block h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
    background: linear-gradient(to right, #fff, #8b949e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.content-card h2 {
    color: var(--accent);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #30363d;
    padding-bottom: 0.5rem;
}

.content-card p {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .index-header h1 {
        font-size: 3rem;
    }

    .chapter-container {
        padding: 3rem 1.5rem;
    }
}

/* Quiz Styles */
.quiz-section {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 2px dashed var(--border);
}

.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #fff;
}

.options-container {
    display: grid;
    gap: 1rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.option-btn:hover:not(.disabled) {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent);
    transform: translateX(5px);
}

.option-btn.correct {
    background: rgba(35, 134, 54, 0.2) !important;
    border-color: var(--success) !important;
    color: #50fa7b !important;
}

.option-btn.wrong {
    background: rgba(248, 81, 73, 0.15) !important;
    border-color: #f85149 !important;
    color: #ff7b72 !important;
}

.option-btn.disabled {
    cursor: default;
    opacity: 0.7;
}

.explanation-box {
    margin-top: 1.5rem;
    padding: 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    display: none;
    animation: fadeIn 0.4s ease;
    line-height: 1.6;
}

.explanation-box.show {
    display: block;
}

.explanation-box.correct-bg {
    background: rgba(35, 134, 54, 0.1);
    border-left: 4px solid var(--success);
}

.explanation-box.wrong-bg {
    background: rgba(248, 81, 73, 0.1);
    border-left: 4px solid #f85149;
}