/* === Base & Variables === */
:root {
    --primary: #7b2eff;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --primary-bg: #de1515;
    --white: #fffbfb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #025ae8;
    --gray-900: #111827;
    --success: #10b981;
    --error: #44ef4f;
    --shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.1), 0 2px 4px -2px rgba(124, 58, 237, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(124, 58, 237, 0.1), 0 4px 6px -4px rgba(124, 58, 237, 0.1);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: var(--primary);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
}

.btn-outline {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary-bg);
}

.btn-full { width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* === Navbar === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    z-index: 1000;
    padding: 0 24px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 25px;
    font-weight: 800;
    color: var(--primary);
}

.logo-icon { font-size: 28px; }

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--gray-700);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: var(--transition);
}

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

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

.nav-auth, .nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-greeting {
    color: var(--gray-700);
    font-size: 14px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-700);
}

/* === Modal === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--gray-500);
    transition: var(--transition);
}

.close-modal:hover { color: var(--gray-900); }

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--gray-900);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 15px;
    transition: var(--transition);
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.modal-switch {
    text-align: center;
    margin-top: 20px;
    color: var(--gray-500);
    font-size: 14px;
}

.modal-switch a {
    font-weight: 600;
}

/* === Hero === */
.hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 24px 80px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-title {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--gray-500);
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
}

.hero-stats {
    display: flex;
    gap: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
}

/* Code Window */
.code-window {
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: float 6s ease-in-out infinite;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
}

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

.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.code-title {
    color: var(--gray-500);
    margin-left: auto;
    font-size: 13px;
}

.code-content {
    padding: 24px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 15px;
    line-height: 1.8;
    color: #e5e7eb;
    overflow-x: auto;
}

.code-content .kw { color: #c084fc; }
.code-content .fn { color: #60a5fa; }
.code-content .str { color: #34d399; }
.code-content .num { color: #f59e0b; }
.code-content .comment { color: #6b7280; }

/* === Features === */
.features {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px;
}

.section-title {
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 48px;
    color: var(--gray-900);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 2px solid transparent;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--gray-900);
}

.feature-card p {
    color: var(--gray-500);
    font-size: 14px;
}

/* === Courses === */
.courses-preview,
.testimonials {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

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

.course-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.course-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
}

.course-thumb {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    position: relative;
}

.course-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.course-info {
    padding: 20px;
}

.course-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--gray-900);
}

.course-info p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.course-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
}

.course-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.course-progress-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 4px;
    margin-top: 12px;
    overflow: hidden;
}

.course-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.center-btn {
    text-align: center;
    margin-top: 16px;
}

/* === Testimonials === */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.testimonial-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.testimonial-card:hover {
    transform: translateY(-4px);
}

.testimonial-stars {
    margin-bottom: 12px;
    font-size: 18px;
}

.testimonial-card p {
    color: var(--gray-700);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 16px;
    font-style: italic;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.testimonial-author strong {
    display: block;
    color: var(--gray-900);
    font-size: 15px;
}

.testimonial-author span {
    font-size: 13px;
    color: var(--gray-500);
}

/* === Courses Page === */
.page {
    display: none;
    padding-top: 70px;
    min-height: 100vh;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.page-header {
    text-align: center;
    padding: 60px 24px 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}

.page-header h1 {
    font-size: 40px;
    font-weight: 800;
    margin-bottom: 12px;
}

.page-header p {
    font-size: 18px;
    opacity: 0.9;
}

.courses-filter {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 2px solid var(--gray-200);
    border-radius: 30px;
    background: var(--white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-700);
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

#coursesPage .courses-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

/* === Lesson Page === */
.lesson-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 70px);
}

.lesson-sidebar {
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 24px;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.lesson-sidebar h3 {
    font-size: 16px;
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-bg);
}

.lesson-list-item {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    gap: 10px;
}

.lesson-list-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.lesson-list-item.active {
    background: var(--primary);
    color: var(--white);
}

.lesson-list-item.completed {
    color: var(--success);
}

.lesson-list-item .check {
    margin-left: auto;
}

.lesson-main {
    padding: 40px 48px;
    max-width: 900px;
}

.lesson-header {
    margin-bottom: 32px;
}

.lesson-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin-top: 16px;
    color: var(--gray-900);
}

.lesson-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.lesson-content h3 {
    font-size: 22px;
    color: var(--gray-900);
    margin: 24px 0 12px;
}

.lesson-content p {
    color: var(--gray-700);
    line-height: 1.8;
    margin-bottom: 16px;
    font-size: 16px;
}

.lesson-content pre {
    background: var(--gray-900);
    color: #e5e7eb;
    padding: 20px 24px;
    border-radius: 12px;
    margin: 16px 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.7;
}

.lesson-content code {
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
}

.lesson-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.lesson-content ul,
.lesson-content ol {
    margin: 12px 0 16px 24px;
    color: var(--gray-700);
}

.lesson-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
}

/* === About Page === */
.about-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.about-text h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin: 28px 0 12px;
}

.about-text h2:first-child { margin-top: 0; }

.about-text p,
.about-text li {
    color: var(--gray-700);
    line-height: 1.8;
    font-size: 16px;
}

.about-text ul {
    list-style: none;
    margin-top: 12px;
}

.about-text li {
    margin-bottom: 10px;
}

.about-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.about-card h3 {
    font-size: 18px;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.about-card p {
    color: var(--gray-700);
    margin-bottom: 10px;
    font-size: 15px;
}

/* === Profile Page === */
.profile-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.profile-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    color: var(--white);
    margin-bottom: 32px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 16px;
}

.profile-card h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.profile-card p {
    opacity: 0.9;
    font-size: 15px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.profile-stat {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow);
}

.profile-stat-number {
    display: block;
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.profile-stat span:last-child {
    color: var(--gray-500);
    font-size: 14px;
}

/* === Footer === */
.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 60px 24px 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section h3 {
    color: var(--white);
    font-size: 18px;
    margin-bottom: 16px;
}

.footer-section p,
.footer-section a {
    color: var(--gray-500);
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding: 24px 0;
    font-size: 14px;
    color: var(--gray-500);
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--gray-900);
    color: var(--white);
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* === Responsive === */
@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 100px 24px 60px;
    }
    .hero-buttons { justify-content: center; }
    .hero-stats { justify-content: center; }
    .hero-visual { max-width: 500px; margin: 0 auto; }
    .hero-title { font-size: 36px; }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .testimonials-grid { grid-template-columns: 1fr; }
    .footer-content { grid-template-columns: 1fr; }
    .lesson-container { grid-template-columns: 1fr; }
    .lesson-sidebar {
        position: relative;
        top: 0;
        height: auto;
        max-height: 300px;
    }
    .lesson-main { padding: 24px; }
    .about-content { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .nav-links, .nav-auth, .nav-user { display: none; }
    .mobile-menu-btn { display: block; }
    .features-grid { grid-template-columns: 1fr; }
    .courses-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: 1fr; }
    .hero-title { font-size: 28px; }
    .section-title { font-size: 26px; }
    .modal-content { padding: 28px; }
}

/* Mobile menu */
.nav-links.open, .nav-auth.open, .nav-user.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 20px 24px;
    box-shadow: var(--shadow-lg);
    z-index: 999;
}
.nav-auth.open { top: auto; }
