:root {
    --bg-color: #0f0f13;
    --sidebar-bg: rgba(20, 20, 28, 0.95);
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-color: #e50914;
    /* Netflix Red-ish or Gold? User said no blue text. Let's go generic premium white/red or gold. Let's use a Vibrant Purple/Pink gradient for active states maybe? Or keep it clean. Let's try Gold/Orange for a change or stick to White + Glows. Let's go with a Vibrant Gradient (Purple-Blue-ish but not text). */
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(100, 100, 255, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(200, 50, 50, 0.05) 0%, transparent 20%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Auth Page Redesign with 3D feel */
.auth-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    background: radial-gradient(circle at center, #1a1a24 0%, #000000 100%);
}

.auth-box {
    background: rgba(30, 30, 40, 0.6);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 20px;
    width: 420px;
    border: var(--glass-border);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    text-align: center;
    transform: rotateX(0deg);
    transition: transform 0.5s ease;
}

@media (max-width: 768px) {
    .auth-box {
        width: 90%;
        padding: 2rem;
    }
}

.auth-box:hover {
    transform: translateY(-5px) rotateX(2deg);
}

.auth-box h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 2rem;
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: left;
}

.form-control {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.form-control:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: white;
    /* High contrast */
    color: black;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.btn-primary:hover,
.btn-primary:focus {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

.auth-link {
    display: block;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.auth-link:hover {
    color: white;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Collapsible Sidebar */
.sidebar {
    width: 80px;
    /* Collapsed width */
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 2rem 0;
    border-right: var(--glass-border);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar:hover {
    width: 250px;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    white-space: nowrap;
    opacity: 1;
    /* Hidden when collapsed initially? No, icon should show */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    background: linear-gradient(45deg, #fff, #888);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s;
}

/* Show Logo properly on expand, just icon on collapse */
.sidebar .logo i {
    font-size: 2rem;
    color: white;
    /* Gradients on text don't apply to icons easily */
    -webkit-text-fill-color: white;
    margin-right: 0;
    transition: margin 0.3s;
}

.sidebar:hover .logo {
    opacity: 1;
    /* Actually we want to show text only on hover */
}

.sidebar:hover .logo i {
    margin-right: 15px;
}

.logo span {
    display: none;
}

.sidebar:hover .logo span {
    display: inline-block;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center icons */
}

.sidebar:hover .nav-links {
    align-items: stretch;
    /* Stretch to fill width on expand */
}

.nav-item {
    width: 100%;
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    height: 60px;
    white-space: nowrap;
    justify-content: center;
    /* Center icons when collapsed */
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar:hover .nav-link {
    justify-content: flex-start;
    padding-left: 2rem;
}

.nav-link i {
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
    transition: color 0.3s;
}

.nav-link span {
    display: none;
    margin-left: 1.5rem;
    font-size: 1rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease 0.1s;
}

.sidebar:hover .nav-link span {
    display: inline-block;
    opacity: 1;
    transform: translateX(0);
}

.nav-link:hover,
.nav-link.active,
.nav-link:focus {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: white;
    /* White accent bar */
}

.nav-link:hover i,
.nav-link.active i {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}


/* Content & 3D Cards */
.content-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 3rem;
    background: radial-gradient(circle at top right, #1a1a1f 0%, #000000 100%);
    perspective: 1000px;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 2.5rem;
    color: white;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: var(--glass-border);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    height: 250px;
    text-decoration: none;
    color: white;
    transform-style: preserve-3d;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover,
.card:focus {
    transform: translateY(-10px) scale(1.05) rotateX(5deg);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.4s;
}

.card:hover .card-icon {
    transform: translateZ(20px);
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    transform: translateZ(10px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Alert Styles */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff8080;
    display: flex;
    align-items: center;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Playlist Page Specifics */
.playlist-container {
    display: flex;
    flex-wrap: wrap;
    /* Responsive wrapping */
    gap: 2rem;
    margin-bottom: 4rem;
}

.playlist-form {
    flex: 1 1 400px;
    /* Grow, shrink, base width */
    background: var(--card-bg);
    border: var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.playlist-form:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.playlist-form h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: white;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.playlist-form h3 i {
    margin-right: 1rem;
    color: var(--accent-color);
    /* Need to ensure accent color is defined or use fallback */
    background: linear-gradient(135deg, #fff, #aaa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search & Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 2rem;
    border-radius: 15px;
    border: var(--glass-border);
}

.search-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    width: 300px;
    font-size: 0.95rem;
    transition: all 0.3s;
}

@media (max-width: 768px) {
    .search-input {
        width: 100%;
        margin-bottom: 1rem;
    }
}

.search-input:focus {
    width: 400px;
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* Horizontal Movie Rows (Netflix Style) */
.category-row {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 4px solid #e50914;
    /* Netflix Red logic */
    display: flex;
    align-items: center;
}

.category-title small {
    margin-left: 1rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.row-container {
    display: flex;
    overflow-x: auto;
    padding: 1rem 0 2rem 0;
    /* Space for hover effects */
    gap: 1.5rem;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.row-container::-webkit-scrollbar {
    display: none;
}

.movie-card {
    min-width: 160px;
    max-width: 160px;
    height: 240px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    flex-shrink: 0;
    background: #111;
}

.movie-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-card:hover {
    transform: scale(1.15);
    /* Pop out effect */
    z-index: 10;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8);
    border: 2px solid white;
}

.movie-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.movie-card:hover .movie-info-overlay {
    opacity: 1;
}

.movie-title {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Loader for Rows */
.row-loader {
    min-width: 160px;
    height: 240px;
    background: linear-gradient(90deg, #1f1f1f 25%, #2a2a2a 50%, #1f1f1f 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    flex-shrink: 0;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}



/* 3-Pane Layout for Live TV */
.layout-3pane {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg-color);
}

/* Category Pane (Left) */
.pane-categories {
    width: 20%;
    background: rgba(15, 15, 20, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.pane-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.category-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.category-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.category-item:hover,
.category-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.category-item.active {
    border-left-color: var(--accent-color);
    font-weight: 600;
}

/* Channels Pane (Middle) */
.pane-channels {
    width: 25%;
    /* Slightly larger for names */
    background: rgba(20, 20, 25, 0.8);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.channel-search-box {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.channel-search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
}

.channel-list {
    flex-grow: 1;
    overflow-y: auto;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}

.channel-item:hover,
.channel-item.active {
    background: rgba(255, 255, 255, 0.08);
}

.channel-item.active {
    border-left: 3px solid var(--accent-color);
    /* Highlight active channel */
}

.channel-icon {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    object-fit: contain;
    background: #000;
    margin-right: 1rem;
    flex-shrink: 0;
}

.channel-info {
    overflow: hidden;
}

.channel-name {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.channel-number {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 0.8rem;
    min-width: 20px;
}

/* Player Pane (Right) */
.pane-player {
    width: 55%;
    background: black;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center player vertically if needed */
    position: relative;
    padding-bottom: 0px;
    /* Reset */
}

#videoPlayerContainer {
    width: 100%;
    height: 100%;
    /* Full height player */
    /* aspect-ratio: 16/9; */
    /* Standard aspect, but we want full fill usually */
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-selection-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.no-selection-placeholder i {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}


/* --- Mobile Responsiveness --- */

@media (max-width: 768px) {

    /* Global Adjustments */
    body {
        flex-direction: column;
        /* Stack main body? No, sidebar absolute/fixed */
        overflow: hidden;
        /* Manage scroll internally */
    }

    /* Dashboard Layout: Content + Bottom Nav */
    .dashboard-container {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
    }

    .content-area {
        padding: 1.5rem;
        /* Reduce padding */
        padding-bottom: 80px;
        /* Space for bottom nav */
        width: 100%;
        height: 100%;
        overflow-y: auto;
    }

    .page-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    /* Sidebar -> Bottom Navigation */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        /* Fixed height for bottom bar */
        flex-direction: row;
        /* Horizontal icons */
        background: rgba(10, 10, 15, 0.95);
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0;
        z-index: 1000;
        justify-content: space-around;
        /* Spread items */
        align-items: center;
        overflow: visible;
        /* Allow popups if needed */
        backdrop-filter: blur(15px);
    }

    .sidebar:hover {
        width: 100%;
        /* No expansion width logic */
    }

    .logo {
        display: none;
        /* Hide logo on bottom nav */
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        padding: 0;
        margin: 0;
    }

    .nav-item {
        width: auto;
        margin: 0;
        flex: 1;
        /* Distribute evenly */
    }

    .nav-link {
        height: 70px;
        flex-direction: column;
        justify-content: center;
        padding: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
        /* Bottom indicator */
    }

    .sidebar:hover .nav-link {
        padding-left: 0;
        /* Reset hover logic */
    }

    .nav-link i {
        font-size: 1.4rem;
        width: auto;
        margin-bottom: 4px;
    }

    .nav-link span {
        display: block;
        /* Always show text on mobile? or Icon only? Icon + Text small */
        font-size: 0.7rem;
        margin: 0;
        opacity: 0.7;
        transform: none;
        position: static;
    }

    .sidebar:hover .nav-link span {
        display: block;
        /* Keep visible */
    }

    .nav-link:hover,
    .nav-link.active {
        border-left: none;
        border-bottom-color: var(--accent-color);
        background: transparent;
        color: var(--accent-color);
    }

    .nav-link.active i {
        color: var(--accent-color);
    }

    /* Hide Logout on bottom nav to save space? Or put it in profile/settings page?
       For now, let's keep it or hide it. */
    .user-menu {
        display: none;
        /* Hide explicit logout button on nav, user can go to profile/settings if we had one. Or just leave it out for space */
    }

    /* Dashboard Grid */
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile */
        gap: 1rem;
    }

    .card {
        height: 180px;
        /* Smaller cards */
        padding: 1rem;
    }

    .card-icon {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* 3-Pane Layout for Mobile (Stacked) */
    .layout-3pane {
        flex-direction: column;
        height: 100vh;
        width: 100vw;
        position: relative;
    }

    /* Pane 1: Categories (Drawer Mode/Hidden or Top Bar)
       Review: Let's make Player STICKY TOP.
       Channels List: Main View.
       Categories: Dropdown/Overlay Trigger.
    */

    .pane-player {
        width: 100%;
        height: 35vh;
        /* Top 35% is player */
        order: 1;
        /* First */
        flex-shrink: 0;
        z-index: 50;
    }

    .pane-channels {
        width: 100%;
        height: auto;
        flex-grow: 1;
        /* Fill rest */
        order: 2;
        border-right: none;
        background: var(--bg-color);
        padding-bottom: 0;
        /* No bottom nav here usually, or yes? layout-3pane implies fullscreen. */
    }

    .pane-categories {
        position: absolute;
        top: 35vh;
        /* Below player */
        left: 0;
        width: 250px;
        /* Drawer width */
        height: 65vh;
        /* Rest of height */
        z-index: 100;
        /* Above channels */
        transform: translateX(-100%);
        /* Hidden by default */
        transition: transform 0.3s ease;
        background: rgba(15, 15, 20, 0.98);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5);
    }

    /* Toggle Class via JS */
    .pane-categories.show-mobile {
        transform: translateX(0);
    }

    /* Add a toggle button for categories inside pane-channels header? */
    /* We'll handle that in HTML/JS */

    /* Category List Items */
    .category-item {
        padding: 1rem;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* Filter Bar/Search */
    .filter-bar {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }

    .search-input {
        width: 100%;
    }

    .playlist-form {
        padding: 1.5rem;
    }
}

/* More specific for very small screens */
@media (max-width: 380px) {
    .content-grid {
        grid-template-columns: 1fr;
        /* 1 column for tiny screens */
    }
}