/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --purple: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-dark: #2d3748;
    --text-mid: #4a5568;
    --text-light: #718096;
    --border: #e2e8f0;
    --bg-light: #f7fafc;
    --white: #ffffff;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f7;
    color: var(--text-mid);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* ==================== BUTTONS ==================== */
.btn {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-block;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
    width: auto;
}

.btn-small:hover {
    background: var(--primary);
    color: #fff;
}

/* ==================== AUTH PAGES ==================== */
.auth-pages {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    padding: 2rem;
}

.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1000px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-card {
    padding: 3rem 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo {
    font-size: 1.9rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.auth-header .tagline {
    color: var(--text-light);
    font-size: 0.95rem;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
}

.form-section h2 {
    font-size: 1.6rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 0.4rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.form-group small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.form-group.checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.form-group.checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-group.checkbox label {
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 1.5rem 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider::before { margin-right: 1rem; }
.divider::after  { margin-left: 1rem; }

.google-signin,
.google-signup {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.form-footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Alert */
.alert {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.alert.info    { background: #ebf8ff; color: #2b6cb0; }
.alert.error   { background: #fff5f5; color: #c53030; }
.alert.success { background: #f0fff4; color: #2f855a; }

/* Auth illustration */
.auth-illustration {
    background: var(--gradient);
    color: #fff;
    padding: 3rem 2.5rem;
    display: flex;
    align-items: center;
}

.illustration-text h3 {
    font-size: 1.7rem;
    margin-bottom: 0.75rem;
}

.illustration-text p {
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.features {
    list-style: none;
}

.features li {
    margin: 0.6rem 0;
    font-size: 1rem;
    opacity: 0.95;
}

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard-pages {
    min-height: 100vh;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 260px;
    background: #1a202c;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.3rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.5rem;
    color: #a0aec0;
    font-size: 0.98rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(102, 126, 234, 0.15);
    color: #fff;
    border-left-color: var(--primary);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem;
    background: rgba(245, 101, 101, 0.15);
    color: #fc8181;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #f56565;
    color: #fff;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-nav {
    height: 70px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 900;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-dark);
    cursor: pointer;
}

.top-nav-right {
    margin-left: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
}

/* ==================== PAGES ==================== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page h1 {
    font-size: 1.9rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

/* ==================== HOME - BANNER ==================== */
.welcome-banner {
    background: var(--gradient);
    color: #fff;
    border-radius: var(--radius);
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.banner-content h1 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.banner-content p {
    opacity: 0.95;
    margin-bottom: 1.5rem;
    max-width: 520px;
}

.banner-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.banner-buttons .btn-primary {
    width: auto;
    background: #fff;
    color: var(--primary);
}

.banner-buttons .btn-secondary {
    background: transparent;
    color: #fff;
    border-color: #fff;
}

.banner-buttons .btn-secondary:hover {
    background: #fff;
    color: var(--primary);
}

.banner-illustration {
    flex-shrink: 0;
}

.illustration-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

/* ==================== HOME - STATS ==================== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-content h3 {
    font-size: 1.5rem;
    color: var(--text-dark);
}

.stat-content p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ==================== HOME - TUTORIAL ==================== */
.tutorial-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.tutorial-section h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.tutorial-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.video-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 16 / 9;
}

.video-wrapper iframe {
    width: 100%;
    height: 100%;
    display: block;
}

.tutorial-info h3 {
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.tutorial-info p {
    color: var(--text-mid);
    margin-bottom: 1rem;
}

.tutorial-steps {
    list-style: none;
}

.tutorial-steps li {
    padding: 0.6rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-mid);
}

.tutorial-steps li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ==================== HOME - FEATURED SUBJECTS ==================== */
.featured-section h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.subject-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.subject-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.subject-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.subject-card h3 {
    color: var(--text-dark);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.subject-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 992px) {
    .auth-container {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .auth-illustration {
        display: none;
    }

    .tutorial-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .top-nav {
        padding: 0 1rem;
    }

    .content-wrapper {
        padding: 1.25rem;
    }

    .welcome-banner {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1.5rem;
    }

    .banner-content h1 {
        font-size: 1.6rem;
    }

    .banner-buttons {
        justify-content: center;
    }

    .banner-illustration {
        order: -1;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .page h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .banner-buttons {
        flex-direction: column;
    }

    .banner-buttons .btn {
        width: 100%;
    }

    .stat-card {
        padding: 1.25rem;
    }
}