:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent-neon: #00ff9d;
    --accent-glow: rgba(0, 255, 157, 0.2);
    --border-color: #333333;
    --completed-bg: rgba(0, 255, 157, 0.05);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    
    /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar Styling */
.sidebar {
    position: relative;
    width: 300px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    border: none;
    opacity: 0;
}

.desktop-sidebar-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1050;
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(10px);
    color: var(--accent-neon);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
}

.desktop-sidebar-btn:hover {
    box-shadow: 0 0 15px var(--accent-glow);
    border-color: var(--accent-neon);
    background: rgba(0, 255, 157, 0.1);
}

.close-sidebar-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    z-index: 1010;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.close-sidebar-btn:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
}

.app-container {
    position: relative;
    display: flex;
    height: 100vh;
}

.brand {
    padding-right: 30px;
}

.brand h1 {
    font-weight: 800;
    font-size: 24px;
    color: #fff;
    margin-bottom: 5px;
}

.brand p {
    color: var(--accent-neon);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.progress-container {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.progress-container p {
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.progress-bar {
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-neon);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.5s ease-in-out;
}

/* Navigation List */
h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mt-4 { margin-top: 30px; }

ul {
    list-style: none;
}

li {
    margin-bottom: 10px;
}

.quest-item {
    display: block;
    padding: 12px 15px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 15px;
}

.quest-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.quest-item.active {
    border-color: var(--accent-neon);
    background: rgba(0, 255, 157, 0.15);
    color: var(--accent-neon);
    box-shadow: inset 4px 0 0 var(--accent-neon), 0 0 10px rgba(0, 255, 157, 0.2);
    font-weight: bold;
}

/* Gamified Completed State */
.quest-item.completed {
    border-color: var(--accent-neon);
    background: var(--completed-bg);
    color: var(--accent-neon);
    box-shadow: inset 0 0 10px var(--accent-glow);
}
.quest-item.completed::after {
    content: ' ✓';
    font-weight: bold;
}

/* Main Content Area */
.content-area {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 60px;
    overflow-y: auto;
}

.content-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.content-header h2 {
    font-size: 32px;
    color: #fff;
    margin-bottom: 10px;
}

.meta-info {
    color: var(--accent-neon);
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
}

/* Markdown Rendering Styles */
.markdown-body {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.markdown-body h1 {
    color: #fff;
    margin-top: 2em;
    margin-bottom: 0.5em;
    text-align: center;
}

.markdown-body h2, .markdown-body h3 {
    color: #fff;
    margin-top: 2em;
    margin-bottom: 0.5em;
}

.markdown-body p {
    margin-bottom: 1.2em;
}

.markdown-body ul {
    margin-bottom: 1.2em;
    padding-left: 2em;
    list-style-type: disc;
}

.markdown-body pre {
    background: #000;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5em;
    border: 1px solid var(--border-color);
}

.markdown-body code {
    font-family: 'JetBrains Mono', monospace;
    color: #a5d6ff;
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent-neon);
    padding-left: 15px;
    color: var(--text-secondary);
    background: var(--completed-bg);
    padding: 15px;
    border-radius: 0 8px 8px 0;
    border-radius: 0 8px 8px 0;
    margin-bottom: 1.5em;
}

/* Landing Page Styles */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
}
.hero-title {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #fff, var(--accent-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
}

.how-to-learn h3, .curriculum-preview h3 {
    text-align: center;
    font-size: 24px;
    color: #fff;
    margin-bottom: 20px;
    margin-top: 40px;
}

.steps-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.step-card {
    flex: 1 1 250px;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.3s ease;
}
.step-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-neon);
    box-shadow: 0 5px 15px var(--accent-glow);
}
.step-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    background: var(--accent-neon);
    color: #000;
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 15px;
}
.step-card h4 {
    color: #fff;
    margin-bottom: 10px;
}
.step-card p {
    font-size: 14px;
    color: var(--text-secondary);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.landing-level-card {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-neon);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.landing-level-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-neon);
}
.landing-level-card h4 {
    color: var(--accent-neon);
    font-size: 15px;
    margin-bottom: 5px;
}
.landing-level-card p {
    color: var(--text-secondary);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

/* Navigation Footer */
.navigation-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Outfit', sans-serif;
    text-align: left;
    padding: 10px;
    border-radius: 8px;
    max-width: 45%;
}
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-neon);
}
#nav-next-btn {
    text-align: right;
    margin-left: auto;
}
.nav-arrow {
    font-size: 24px;
}
.nav-text {
    display: flex;
    flex-direction: column;
}
.nav-text.text-right {
    text-align: right;
}
.nav-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 3px;
}
.nav-title {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
}
.nav-btn:hover .nav-title {
    color: var(--accent-neon);
}

/* Footer Action */
.action-footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.btn-complete {
    background: transparent;
    color: var(--accent-neon);
    border: 2px solid var(--accent-neon);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-complete:hover {
    background: var(--accent-neon);
    color: #000;
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-complete.completed-state {
    background: var(--accent-neon);
    color: #000;
    cursor: default;
}

/* Progressive Reveal Styles */
.markdown-chunk {
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.5s forwards ease-out;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal-btn-container {
    text-align: center;
    margin: 40px 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.reveal-btn-container:hover {
    transform: scale(1.05);
}

.reveal-image-btn {
    width: 250px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 0 20px var(--accent-glow);
    border: 2px solid var(--accent-neon);
    transition: box-shadow 0.3s ease;
}

.reveal-btn-container:hover .reveal-image-btn {
    box-shadow: 0 0 35px var(--accent-neon);
}

.reveal-text {
    color: var(--accent-neon);
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    margin-top: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 5px var(--accent-neon);
}

/* Q&A Styles */
.qa-container {
    background: rgba(0,0,0,0.4);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.qa-question {
    color: #fff;
    font-size: 16px;
    margin-bottom: 15px;
}
.qa-input-wrapper {
    position: relative;
    width: 100%;
}
.enter-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
    pointer-events: none;
    opacity: 0.7;
}
.qa-input {
    width: 100%;
    background: #000;
    border: 1px solid var(--border-color);
    color: var(--accent-neon);
    padding: 12px;
    padding-right: 40px; /* Space for icon */
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    border-radius: 4px;
    outline: none;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}
.qa-input:focus {
    border-color: var(--accent-neon);
    box-shadow: 0 0 10px var(--accent-glow);
}
.qa-error {
    color: #ff4757;
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
}

/* Review Mode */
.review-answer-box {
    background: rgba(0, 255, 157, 0.05);
    border-left: 4px solid var(--accent-neon);
    padding: 15px;
    margin-top: 15px;
    margin-bottom: 30px;
    font-family: 'JetBrains Mono', monospace;
}

/* Highlight Animation */
.highlight-error {
    opacity: 1 !important;
    transform: translateY(0) !important;
    animation: pulseError 2s ease-out;
}
@keyframes pulseError {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); background: rgba(255, 71, 87, 0.1); }
    70% { box-shadow: 0 0 0 20px rgba(255, 71, 87, 0); background: transparent; }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.hint-sentence-box {
    border: 2px dashed #ff4757;
    padding: 15px;
    border-radius: 8px;
    background: rgba(255, 71, 87, 0.05);
    margin: 15px 0;
}
.hint-highlight {
    background-color: #ff4757;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

/* Cyber Divider */
.cyber-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-neon), transparent);
    margin: 40px 0;
    opacity: 0.5;
}

/* Buttons */
.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.3s;
}
.btn-secondary:hover {
    color: #fff;
    border-color: var(--text-secondary);
}
.btn-primary {
    background: var(--accent-neon);
    color: #000;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-primary:hover {
    box-shadow: 0 0 15px var(--accent-glow);
}
.btn-linkedin {
    background: #0077b5;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.3s;
}
.btn-linkedin:hover {
    background: #005582;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--accent-neon);
    box-shadow: 0 0 30px var(--accent-glow);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.btn-close {
    position: absolute;
    top: 15px; right: 15px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-size: 16px;
    cursor: pointer;
}
.btn-close:hover { color: #fff; }

/* Certificate Rendering */
.certificate {
    background: #111;
    border: 2px solid #333;
    padding: 20px;
    margin: 20px 0;
}
.cert-inner {
    border: 4px double var(--accent-neon);
    padding: 40px;
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
}
.cert-title {
    color: var(--accent-neon);
    font-size: 32px;
    letter-spacing: 4px;
    margin-bottom: 20px;
    font-family: 'Outfit', sans-serif;
}
.cert-subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    font-style: italic;
    margin-bottom: 20px;
}
.cert-name {
    color: #fff;
    font-size: 48px;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 20px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}
.cert-text {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 20px;
}
.cert-course {
    color: var(--accent-neon);
    font-size: 24px;
    margin-bottom: 40px;
}
.cert-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #333;
    padding-top: 20px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}
.cert-actions {
    margin-top: 20px;
}

/* Floating Clapping Emoji */
.floating-clap {
    position: fixed;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 64px;
    z-index: 1001;
    pointer-events: none;
    animation: floatClap 3s ease-in forwards;
}
@keyframes floatClap {
    0% { bottom: -50px; opacity: 0; transform: translateX(-50%) scale(0.5); }
    20% { opacity: 1; transform: translateX(-50%) scale(1.2); }
    80% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { bottom: 100vh; opacity: 0; transform: translateX(-50%) scale(1); }
}

/* Mobile Responsive Design */
.mobile-nav {
    display: none;
}

/* Auth Nav Styles */
.auth-nav {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#login-sync-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 15px;
    font-size: 13px;
}

#login-helper-text {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: right;
}

.user-badge {
    background: rgba(0,255,157,0.1);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--accent-neon);
    align-items: center;
    gap: 10px;
}

.user-badge img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.user-badge .info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-badge .name {
    font-size: 13px;
    font-weight: bold;
    color: var(--accent-neon);
}

.badge-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.badge-actions span {
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        display: block;
        height: auto;
        min-height: 100vh;
        overflow: auto; /* Enable native document scrolling */
    }
    
    .mobile-nav {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        gap: 15px;
        padding: 15px 20px;
        background: var(--bg-panel);
        border-bottom: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    .desktop-sidebar-btn {
        display: none;
    }
    
    .mobile-nav h1 {
        font-size: 20px;
        color: #fff;
        font-weight: 800;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 160px);
    }
    
    #mobile-menu-btn {
        background: rgba(30, 30, 30, 0.6);
        color: var(--accent-neon);
        border: 1px solid rgba(0, 255, 157, 0.3);
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        transition: all 0.3s ease;
    }
    
    .app-container {
        display: block;
        height: auto;
        min-height: 100vh;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        border-right: 1px solid var(--border-color);
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    /* Ensure brand shows in mobile drawer */
    .sidebar .brand {
        display: block;
        margin-top: 10px;
    }
    
    .content-area {
        display: block;
        padding: 20px 15px;
        overflow: visible; /* Content area no longer scrolls itself */
    }
    
    .content-header h2 {
        font-size: 24px;
    }
    
    .reveal-image-btn {
        width: 100%;
    }
    
    .modal-content {
        padding: 25px 15px;
    }
    
    .cert-inner {
        padding: 20px 10px;
    }
    
    .cert-title {
        font-size: 20px;
        letter-spacing: 2px;
    }
    
    .cert-name {
        font-size: 28px;
    }
    
    .cert-course {
        font-size: 18px;
    }
    
    .cert-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-secondary, .btn-primary, .btn-linkedin, .btn-complete {
        margin-left: 0;
        width: 100%;
    }
    
    #login-sync-btn {
        width: auto;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .auth-nav {
        position: fixed;
        top: 12px;
        right: 15px;
        z-index: 1500;
    }
    
    #login-helper-text {
        display: none;
    }
}

.quest-item.sub-item {
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 6px 10px;
    font-size: 0.9em;
    border-left: 2px solid transparent;
    background: transparent;
    border: none;
    border-left: 2px solid transparent;
}
.quest-item.sub-item:hover {
    color: var(--text-secondary);
    background: transparent;
}
.quest-item.sub-item.active {
    color: var(--accent-neon);
    border-left: 2px solid var(--accent-neon);
    background: transparent;
    box-shadow: none;
    font-weight: bold;
}
