:root {
    --bg-main: #090d16;
    --bg-card: #111827;
    --bg-card-hover: #1e293b;
    --bg-elevated: #0f172a;
    --border-color: rgba(148, 163, 184, 0.14);
    --border-highlight: rgba(56, 189, 248, 0.45);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-cyan: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-purple: #a855f7;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 12% 10%, rgba(56, 189, 248, 0.09), transparent 32%),
        radial-gradient(circle at 88% 15%, rgba(168, 85, 247, 0.09), transparent 35%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #090d16;
    font-weight: 900;
    font-family: monospace;
    font-size: 1.1rem;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.brand span {
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 6px 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-cyan);
    border-radius: 2px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    color: #090d16;
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.28);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(56, 189, 248, 0.42);
}

.btn-outline {
    background: rgba(30, 41, 59, 0.55);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.08);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #052e16;
    font-weight: 700;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-cyan {
    background: rgba(56, 189, 248, 0.14);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-purple {
    background: rgba(168, 85, 247, 0.14);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.14);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.xp-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.84rem;
}

/* Hero Section */
.hero {
    padding: 72px 0 64px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
    align-items: center;
}

.hero-title {
    font-size: clamp(2.2rem, 4vw, 3.35rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    margin: 18px 0 20px;
}

.gradient-text {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.12rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 580px;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 36px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.stat-item strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-item span {
    font-size: 0.84rem;
    color: var(--text-secondary);
}

/* Code Window Preview */
.code-window {
    background: #0d1322;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.code-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #131c31;
    border-bottom: 1px solid var(--border-color);
}

.window-dots {
    display: flex;
    gap: 7px;
}

.window-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.code-window-body {
    padding: 22px;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.7;
    color: #e2e8f0;
    overflow-x: auto;
}

/* Cards & Grids */
.section {
    padding: 56px 0;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.section-desc {
    color: var(--text-secondary);
    margin-top: 6px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.course-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.course-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.course-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.35;
}

.course-subtitle {
    color: var(--text-secondary);
    font-size: 0.93rem;
    margin-bottom: 20px;
}

.course-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #1e293b;
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* Interactive Lesson Workspace */
.lesson-layout {
    display: grid;
    grid-template-columns: 280px 1fr 1.1fr;
    gap: 20px;
    padding: 20px 24px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.lesson-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    height: fit-content;
}

.lesson-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    border: 1px solid transparent;
}

.lesson-nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.lesson-nav-item.active {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    color: var(--accent-cyan);
    font-weight: 600;
}

.lesson-nav-item.done .status-dot {
    background: var(--accent-emerald);
    color: #052e16;
}

.status-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1e293b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-theory-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    overflow-y: auto;
}

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

.theory-content p {
    color: #cbd5e1;
    margin-bottom: 14px;
}

.theory-content ul,
.theory-content ol {
    padding-left: 20px;
    margin-bottom: 16px;
    color: #cbd5e1;
}

.theory-content li {
    margin-bottom: 6px;
}

.theory-content pre {
    background: #090d16;
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 14px 0;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.86rem;
    color: #38bdf8;
}

.theory-content code {
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.theory-content pre code {
    background: transparent;
    padding: 0;
}

.task-box {
    margin-top: 22px;
    padding: 16px 18px;
    background: rgba(99, 102, 241, 0.12);
    border-left: 4px solid var(--accent-indigo);
    border-radius: var(--radius-sm);
}

.lesson-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #0d1322;
    border-bottom: 1px solid var(--border-color);
}

.code-textarea {
    width: 100%;
    min-height: 260px;
    background: #090d16;
    color: #f8fafc;
    border: none;
    padding: 16px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
}

.preview-iframe {
    width: 100%;
    height: 210px;
    border: none;
    background: #ffffff;
}

.validation-feedback {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    display: none;
}

.validation-feedback.success {
    display: block;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.validation-feedback.error {
    display: block;
    background: rgba(244, 63, 94, 0.14);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: #fb7185;
}

/* Forms & Auth */
.auth-card {
    max-width: 460px;
    margin: 56px auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 34px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #cbd5e1;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-cyan);
}

/* Quiz options */
.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #090d16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.quiz-option:hover {
    border-color: var(--accent-cyan);
}

/* Footer */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding: 36px 0;
    background: #070a12;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Academy LMS v7.3 Style Admin Layout */
.admin-shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 24px;
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

.admin-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    height: fit-content;
    position: sticky;
    top: 90px;
}

.admin-user-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 10px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.admin-nav-group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 10px 12px 6px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 3px;
    transition: all 0.15s ease;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.admin-nav-link.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.18));
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--accent-cyan);
    font-weight: 600;
}

.admin-subnav {
    padding-left: 16px;
    margin-bottom: 6px;
    border-left: 1px dashed rgba(148, 163, 184, 0.2);
    margin-left: 16px;
}

.admin-subnav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 0.83rem;
    color: var(--text-secondary);
    border-radius: 6px;
}

.admin-subnav a:hover,
.admin-subnav a.active {
    color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.08);
    font-weight: 600;
}

.admin-main {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.admin-page-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.admin-widget-inline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.admin-widget-cell {
    padding: 24px 18px;
    text-align: center;
    border-right: 1px solid var(--border-color);
    transition: background 0.2s;
}

.admin-widget-cell:last-child {
    border-right: none;
}

.admin-widget-cell:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-widget-cell h3 {
    font-size: 1.85rem;
    font-weight: 800;
    margin: 8px 0 4px;
    color: var(--text-primary);
}

.admin-widget-cell p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.89rem;
}

.admin-table th {
    text-align: left;
    padding: 12px 14px;
    background: #0b101d;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 1080px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .lesson-layout {
        grid-template-columns: 1fr;
    }
    .admin-shell {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
    }
    .admin-widget-inline {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 720px) {
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .nav-links {
        display: none;
    }
    .admin-widget-inline {
        grid-template-columns: 1fr;
    }
}
