:root {
    --primary-color: #6a11cb;
    /* Deep Purple */
    --secondary-color: #2575fc;
    /* Bright Blue */
    --accent-color: #e0aaff;
    --background-color: #f4f7f6;
    /* Soft Gray-Blue Background */
    --surface-color: #ffffff;
    --text-color: #2d3436;
    --text-muted: #636e72;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --border-radius: 12px;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Montserrat', sans-serif;
    color: #2d3436;
    margin-top: 0;
}

/* Navigation - Modern & Sleek */
.navbar {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.navbar-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.user-menu {
    display: flex;
    align-items: center;
}

/* Buttons - Premium Feel */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
    gap: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 15px rgba(37, 117, 252, 0.3);
    color: white;
}

.btn-outline {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
    box-shadow: none;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(106, 17, 203, 0.2);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #00a383;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 184, 148, 0.3);
}

/* Layout & Containers */
.container {
    max-width: 1280px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.course-card {
    border-radius: 16px;
    overflow: hidden;
    background: white;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--hover-shadow);
}

.course-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #ddd;
}

.course-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

/* Auth Pages */
.auth-container {
    max-width: 420px;
    margin: 4rem auto;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: #fdfdfd;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    background-color: white;
    box-shadow: 0 0 0 4px rgba(106, 17, 203, 0.1);
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header-modern {
    /* Style moved to inline in html but base styles here */
    border-radius: 16px;
    padding: 3rem 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

/* Course Content - Stepik Style */
.learn-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    height: calc(100vh - 100px);
    max-width: 1600px;
    margin: 0 auto;
}

.sidebar {
    background: white;
    border-right: 1px solid #eee;
    padding: 1.5rem;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
}

.module-section {
    margin-bottom: 2rem;
}

.module-title {
    font-weight: 800;
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.step-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.step-item {
    padding: 0.9rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.4rem;
    color: var(--text-color);
    font-weight: 500;
}

.step-item:hover {
    background: #f0f2f5;
    color: var(--primary-color);
}

.step-item.active {
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.1), rgba(37, 117, 252, 0.1));
    color: var(--primary-color);
    font-weight: 700;
    border-left: 3px solid var(--primary-color);
}

.content-area {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow-y: auto;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.step-content {
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

/* Quiz Styles */
.quiz-container {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid #e0e0e0;
    box-shadow: var(--card-shadow);
}

.question-block {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 5px solid var(--secondary-color);
    transition: var(--transition);
}

.options-list label {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    transition: background 0.2s;
    background: white;
    border: 1px solid #eee;
    margin-bottom: 0.5rem;
}

.options-list label:hover {
    background: #f1f3f5;
    border-color: #ced4da;
}

.options-list input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
    accent-color: var(--primary-color);
}


/* Editor - Visual Builder Style */
.full-screen-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    background: #f8f9fa;
    display: flex;
    overflow: hidden;
}

.editor-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #eef2f5;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
}

.editor-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.editor-sidebar-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.editor-canvas {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #f0f2f5;
    background-image: radial-gradient(#dee2e6 1px, transparent 1px);
    background-size: 24px 24px;
    overflow: hidden;
}

.editor-top-bar {
    background: transparent;
    padding: 1rem 0;
    height: auto;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: none;
    z-index: 5;
    flex-shrink: 0;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    /* key for centering */
}

.editor-workspace {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
    /* Center the content */
    display: flex;
    justify-content: center;
}

.editor-page {
    background: white;
    width: 100%;
    max-width: 900px;
    min-height: 1000px;
    /* A4-ish ratio feel */
    border-radius: 2px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    padding: 4rem 5rem;
    position: relative;
    transition: var(--transition);
    margin: 3rem auto;
    /* Center with margin */
}

.editor-tools {
    width: 70px;
    background: white;
    border-left: 1px solid #eef2f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    gap: 1.5rem;
    z-index: 10;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.02);
    flex-shrink: 0;
}

.tool-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.1rem;
    background: #f8f9fa;
    position: relative;
}

.tool-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.25);
}

.tool-btn::after {
    /* Tooltip content handled by title attr natively, but could be custom CSS */
}

/* Content Blocks */
.content-block {
    position: relative;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.content-block:hover {
    border-color: rgba(0, 0, 0, 0.05);
}

.content-block:focus-within {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(224, 170, 255, 0.1);
}

/* Typography Blocks */
.block-h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 0.8rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
    outline: none;
}

.block-p {
    font-size: 1.15rem;
    line-height: 1.75;
    color: #333;
    margin-bottom: 0.8rem;
    outline: none;
}

.block-ul {
    padding-left: 1.5rem;
    color: #333;
    font-size: 1.1rem;
    line-height: 1.7;
    outline: none;
}

/* Rich Blocks */
.block-quote {
    border-left: 5px solid var(--primary-color);
    padding: 1.2rem 2rem;
    color: #444;
    font-size: 1.2rem;
    font-style: italic;
    background: #fdfdfd;
    border-radius: 0 8px 8px 0;
    margin: 2rem 0;
    outline: none;
}

.block-code {
    background: #282c34;
    color: #abb2bf;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    outline: none;
}

.block-callout {
    background: #fff8e1;
    border-left: 5px solid #ffc107;
    padding: 1.5rem;
    border-radius: 4px;
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    align-items: start;
}

.block-callout i {
    font-size: 1.5rem;
    color: #ffca28;
    margin-top: 0.2rem;
}

.block-image {
    width: 100%;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.block-video {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.block-file {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #eee;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-color);
}

.block-file:hover {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.1);
    color: var(--primary-color);
}

/* General UI Components */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 17, 203, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid #eee;
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-link {
    background: none;
    padding: 0.5rem;
    color: var(--text-muted);
}

.btn-link:hover {
    color: var(--primary-color);
    background: rgba(106, 17, 203, 0.05);
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    border: 2px solid #f0f2f5;
    background: #f8f9fa;
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(224, 170, 255, 0.2);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Footer */
.footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4rem;
    border-top: 1px solid #eee;
    background: white;
}


/* Module Add Button */
.module-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f3f5;
    color: var(--text-muted);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.module-add-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 5px 15px rgba(106, 17, 203, 0.3);
}

.module-add-btn i {
    font-size: 0.9rem;
}

/* Navbar Enhancements */
.navbar-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
    height: 20px;
    width: 25px;
    padding: 0;
    z-index: 1100;
}

.navbar-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--text-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.user-menu-mobile {
    display: contents;
    /* Default for desktop */
}

.auth-buttons-mobile {
    display: contents;
    /* Default for desktop */
}

/* Mobile Responsive Styles - Polished */
@media (max-width: 900px) {
    .navbar {
        padding: 1rem 1.5rem;
    }

    .navbar-toggle {
        display: flex;
    }

    /* Close button removed as requested, using backdrop instead */
    .nav-mobile-header {
        display: none !important;
    }

    .navbar-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        /* Revert to partial width so backdrop is visible */
        max-width: 300px;
        height: 100vh;
        background: white;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 5rem 2rem;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        gap: 1.5rem;
        z-index: 1000;
        overflow-y: auto;
    }

    .navbar-nav.active {
        right: 0;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
        /* Slightly stronger shadow */
    }

    /* Dedicated Backdrop */
    .navbar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        /* Semi-transparent black */
        z-index: 990;
        /* Behind navbar-nav (1000) but above content */
        backdrop-filter: blur(3px);
        /* Glassmorphism effect */
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .navbar-backdrop.active {
        display: block;
        opacity: 1;
    }

    .nav-link {
        font-size: 1.1rem;
        width: 100%;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .nav-link:hover {
        padding-left: 10px;
        /* Slight movement on hover */
    }

    .user-menu-mobile,
    .auth-buttons-mobile {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1rem;
    }

    .btn-sm-mobile {
        width: 100%;
        justify-content: center;
        margin: 0 !important;
    }

    /* Container Spacing */
    .container {
        padding: 0 1.2rem;
        margin: 1.5rem auto;
    }

    /* Typography Scaling */
    h1 {
        font-size: 1.8rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* Dashboard Header */
    .dashboard-header-modern {
        padding: 2rem 1.5rem;
        border-radius: 12px;
        text-align: left;
    }

    .dashboard-header-modern i {
        opacity: 0.05;
        font-size: 6rem;
        bottom: -10px;
        right: -10px;
    }

    /* Cards */
    .course-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .course-card {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.06);
    }

    .card {
        padding: 1.5rem;
    }

    /* Footer */
    .footer {
        padding: 2rem 1rem;
        margin-top: 2rem;
    }

    /* Editor Adjustments */
    .full-screen-editor {
        flex-direction: column;
    }

    .editor-sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #eee;
        position: relative;
        overflow-y: auto;
    }

    .editor-tools {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        padding: 1rem;
        border-left: none;
        border-top: 1px solid #eee;
        order: 3;
        justify-content: flex-start;
    }

    .editor-canvas {
        flex-grow: 1;
        overflow-y: auto;
        padding-bottom: 80px;
    }

    .editor-page {
        padding: 2rem 1.5rem;
        margin: 1rem auto;
        width: 95%;
        min-height: 60vh;
    }

    /* Learning View Mobile Optimizations */
    .learn-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        /* Allow scroll on body for mobile if needed, or maintain fixed */
        height: 100vh;
        overflow: hidden;
    }

    .learn-layout .sidebar {
        width: 100%;
        height: auto;
        max-height: 25vh;
        border-right: none;
        border-bottom: 1px solid #eee;
        flex-shrink: 0;
        order: 2;
        /* Move navigation to bottom or top? Top is standard for context. */
        order: 1;
    }

    .learn-layout .content-area {
        width: 100%;
        padding: 1.5rem;
        flex-grow: 1;
        overflow-y: auto;
        order: 2;
        border-radius: 0;
        box-shadow: none;
    }
}