:root {
    --bg-main: #070a12;
    --bg-card: #0f172a;
    --bg-card-hover: #1c2742;
    --border-color: #1e293b;
    --primary: #38bdf8;
    --primary-hover: #0284c7;
    --primary-glow: rgba(56, 189, 248, 0.15);
    --accent-gold: #f59e0b;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-width: 260px;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.12);
    --accent-gold: #d97706;
    --accent-green: #059669;
    --accent-red: #dc2626;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar Styles */
/* Mobile Topbar & Overlay */
.mobile-topbar {
    display: none;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 80;
}

.mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-menu-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-menu-toggle:hover {
    background: var(--primary-glow);
    color: var(--primary);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 50;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 1rem;
    padding-right: 0.25rem;
}

.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-item a:hover, .nav-item.active a {
    background-color: var(--primary-glow);
    color: var(--primary);
}

.nav-item.active a {
    font-weight: 700;
}

.user-profile {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #ffffff;
    font-size: 1.1rem;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem 2.5rem;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.welcome-title h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.welcome-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.theme-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Banner / Cards */
.hero-card {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

[data-theme="light"] .hero-card {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
}

.hero-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
}

.progress-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.progress-info {
    flex: 1;
}

.progress-info h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: var(--bg-main);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 0.75rem;
}

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

/* Continue Watching Card */
.section-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.continue-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-soft);
}

.continue-thumbnail {
    width: 180px;
    height: 100px;
    background: #000;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, var(--bg-card-hover), #000);
}

.play-icon-overlay {
    width: 48px;
    height: 48px;
    background: rgba(56, 189, 248, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.continue-details {
    flex: 1;
}

.continue-details h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.continue-details p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Grid Layouts */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    position: relative;
}

.card-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 35px var(--primary-glow);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-glow);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.card-item h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-item p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

/* Player Screen */
.player-container {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1.5rem;
    aspect-ratio: 16/9;
    width: 100%;
}

.player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.player-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-main);
}

.btn-success {
    background: var(--accent-green);
    color: #ffffff;
}

.btn-gold {
    background: var(--accent-gold);
    color: #ffffff;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); border: 1px solid var(--accent-green); }
.badge-gold { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid var(--accent-gold); }

/* Responsive Adjustments */
@media (max-width: 992px) {
    body {
        flex-direction: column;
    }

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

    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
        padding: 1.25rem;
        overflow: hidden;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        padding: 1.5rem 1.25rem;
    }
}

@media (max-width: 600px) {
    .top-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .welcome-title h1 {
        font-size: 1.4rem !important;
    }

    .progress-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .continue-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1.25rem !important;
        padding: 1.25rem !important;
    }

    .continue-thumbnail {
        width: 100% !important;
        height: 160px !important;
    }

    .player-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        padding: 1.25rem 1rem !important;
    }

    .player-actions > div {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.75rem !important;
    }

    .player-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .grid-cards {
        grid-template-columns: 1fr !important;
    }

    .btn {
        word-break: break-word;
        white-space: normal;
        max-width: 100%;
    }

    .form-control {
        font-size: 16px !important;
    }
}
