:root {
    --bg-color: #0f0f0f;
    --surface-color: #1a1a1a;
    --surface-hover: #2a2a2a;
    --primary-color: #E50914;
    --text-primary: #FFFFFF;
    --text-secondary: #a1a1a1;
    --sidebar-width: 240px;
    --header-height: 70px;
    --border-radius: 12px;
    --card-radius: 8px;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

/* --- LAYOUT STRUCTURE --- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR (Desktop) --- */
.app-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--surface-color);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 40px;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo span {
    color: var(--primary-color);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.sidebar-link svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    opacity: 0.7;
}

.sidebar-link:hover,
.sidebar-link.active {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.sidebar-link:hover svg,
.sidebar-link.active svg {
    opacity: 1;
    fill: var(--primary-color);
}

.sidebar-link.active {
    background-color: rgba(229, 9, 20, 0.1);
    color: var(--primary-color);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* User Profile in Sidebar */
.user-mini-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--border-radius);
    background-color: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.2s;
}

.user-mini-profile:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-info-text {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* --- MAIN CONTENT AREA --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 0;
    min-height: 100vh;
    position: relative;
}

/* --- TOP HEADER (Inside Main Content) --- */
.content-header {
    position: sticky;
    top: 0;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 900;
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.95) 0%, rgba(15, 15, 15, 0) 100%);
    backdrop-filter: blur(2px);
}

.search-container {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    background-color: var(--surface-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 10px 20px 10px 45px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    background-color: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.3);
    width: 320px;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;
    margin-top: -80px;
    mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.hero-backdrop {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: brightness(0.6);
    transition: transform 10s ease;
}

.hero-section:hover .hero-backdrop {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, var(--bg-color) 0%, transparent 60%);
    display: flex;
    align-items: flex-end;
    padding: 0 40px 60px 40px;
}

.hero-info {
    max-width: 600px;
    z-index: 10;
}

.hero-badge {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(90deg, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.btn-primary:hover {
    background-color: #ff0f1f;
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6);
}

.btn-glass {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-glass:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

/* --- CONTENT GRID --- */
.content-section {
    padding: 20px 40px 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    position: relative;
    padding-left: 16px;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.media-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    aspect-ratio: 2/3;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.media-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    z-index: 5;
}

.card-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.media-card:hover .card-poster {
    transform: scale(1.05);
}

.card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 40%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.media-card:hover .card-gradient {
    opacity: 1;
}

.card-info {
    transform: translateY(20px);
    transition: transform 0.3s;
}

.media-card:hover .card-info {
    transform: translateY(0);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
    line-height: 1.3;
}

.card-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.meta-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- AUTH PAGES (Restored) --- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('assets/banner_hero_v1.png');
    background-size: cover;
    background-position: center;
    position: relative;
    padding: 20px;
}

.auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 15, 0.85);
    /* Darker overlay */
    backdrop-filter: blur(8px);
    z-index: 1;
}

.auth-box {
    background-color: var(--surface-color);
    padding: 60px 50px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 450px;
    z-index: 2;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 30px;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-input {
    background: #000;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    height: 50px;
    padding: 0 20px;
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    border-radius: 8px;
    font-size: 1rem;
    margin-top: 10px;
    width: 100%;
    padding: 16px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3);
}

.auth-footer {
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

.auth-footer a {
    color: white;
    font-weight: 600;
    margin-left: 5px;
}

.auth-header-logo {
    position: absolute;
    top: 30px;
    left: 40px;
    z-index: 10;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: -1px;
}

/* --- MISC & COMPATIBILITY --- */
/* For Watch Page */
.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: -1px;
    text-transform: uppercase;
}

.btn-back {
    color: var(--text-secondary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.btn-back:hover {
    color: white;
}


/* --- MOBILE & RESPONSIVE --- */
.mobile-nav {
    display: none;
}

.mobile-brand {
    display: none;
}

.visible-mobile {
    display: none !important;
}

.hidden-mobile {
    display: flex;
}

/* --- HORIZONTAL CAROUSEL (Used on Mobile) --- */
.carousel-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px;
    padding-bottom: 10px;
}

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

.carousel-row .media-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 80px;
    }

    .sidebar-logo span,
    .sidebar-link span,
    .user-info-text {
        display: none;
    }

    .app-sidebar {
        align-items: center;
        padding: 30px 10px;
    }

    .sidebar-logo {
        margin-bottom: 30px;
        font-size: 1.2rem;
    }

    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }

    .content-header,
    .hero-overlay,
    .content-section {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* FULL MOBILE OVERRIDE */
    .app-sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding-bottom: 90px;
    }

    .hidden-mobile {
        display: none !important;
    }

    .visible-mobile {
        display: block !important;
    }

    /* Mobile Brand Logo */
    .mobile-brand {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        font-weight: 900;
        font-size: 1.3rem;
        color: var(--primary-color);
        padding: 15px 20px;
        background: linear-gradient(to bottom, rgba(15, 15, 15, 0.95) 0%, transparent 100%);
        text-transform: uppercase;
        letter-spacing: -0.5px;
    }

    /* Hero Section - Mobile */
    .hero-section {
        height: 55vh;
        margin-top: 0;
        mask-image: none;
        -webkit-mask-image: none;
    }

    .hero-backdrop {
        filter: brightness(0.5);
    }

    .hero-overlay {
        background: linear-gradient(0deg, var(--bg-color) 20%, transparent 80%);
        padding: 0 20px 30px 20px;
    }

    .hero-info {
        max-width: 100%;
    }

    .hero-badge {
        font-size: 0.65rem;
        padding: 4px 8px;
        margin-bottom: 10px;
    }

    .hero-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        margin-bottom: 20px;
    }

    .hero-buttons {
        gap: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: 6px;
    }

    .btn svg {
        width: 18px;
        height: 18px;
    }

    /* Content Section - Mobile */
    .content-section {
        padding: 15px 15px 60px;
    }

    .section-header {
        margin-bottom: 15px;
    }

    .section-title {
        font-size: 1.1rem;
        padding-left: 12px;
    }

    .section-title::before {
        width: 4px;
        height: 18px;
    }

    /* Mobile Search Inside Content */
    .search-container.visible-mobile {
        width: 100%;
        margin-bottom: 20px;
    }

    .search-container.visible-mobile .search-input {
        width: 100%;
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    /* GRID TO CAROUSEL ON MOBILE */
    .grid-container {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px;
        padding: 0 0 15px 0;
    }

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

    .grid-container .media-card {
        flex: 0 0 auto;
        width: 130px;
        scroll-snap-align: start;
        aspect-ratio: 2/3;
        border-radius: 8px;
    }

    .media-card:hover {
        transform: none;
        box-shadow: none;
    }

    .media-card:active {
        transform: scale(0.97);
    }

    .card-gradient {
        opacity: 1;
        padding: 10px;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    }

    .card-info {
        transform: translateY(0);
    }

    .card-title {
        font-size: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.2;
    }

    .card-meta {
        display: none;
    }

    /* Bottom Navigation - Enhanced */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background-color: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--text-secondary);
        font-size: 0.65rem;
        gap: 4px;
        padding: 10px 15px;
        text-decoration: none;
        transition: color 0.2s;
    }

    .nav-item.active {
        color: white;
    }

    .nav-item.active svg {
        fill: var(--primary-color);
    }

    .nav-item svg {
        width: 24px;
        height: 24px;
        fill: currentColor;
        transition: fill 0.2s;
    }

    /* Auth pages mobile */
    .auth-box {
        padding: 40px 30px;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .auth-header-logo {
        top: 20px;
        left: 20px;
        font-size: 1.5rem;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        display: none;
    }

    .grid-container .media-card {
        width: 110px;
    }

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

    .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}