@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-dark: #0a0a0f;
    --bg-darker: #05050a;
    --bg-card: #0f0f1a;
    --glass-bg: rgba(15, 15, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.07);
    --primary-color: #e11d48;
    --primary-hover: #be123c;
    --primary-glow: rgba(225, 29, 72, 0.35);
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --text-main: #f0f0ff;
    --text-muted: #6b7280;
    --text-secondary: #9ca3af;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --navbar-height: 72px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

html { scroll-behavior: smooth; }

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-darker); }
::-webkit-scrollbar-thumb { background: rgba(225,29,72,0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ===== BACKGROUND ===== */
.background-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 10% 20%, rgba(225,29,72,0.12) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 80%, rgba(59,130,246,0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(139,92,246,0.05) 0%, transparent 60%);
    animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0%   { opacity: 0.8; transform: scale(1); }
    100% { opacity: 1;   transform: scale(1.05); }
}

/* ===== GENRE FILTER ===== */
.genre-list-container {
    margin: 30px 5%;
    padding: 24px;
    border-radius: 20px;
    background: rgba(15, 15, 30, 0.4);
}
.genre-list-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.genre-list-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 4px;
    box-shadow: 0 0 10px var(--primary-glow);
}
.genre-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.genre-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}
.genre-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-main);
}
.genre-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px var(--primary-glow);
    font-weight: 600;
}
.hidden-by-genre {
    display: none !important;
}

/* ===== GLASS PANEL ===== */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ===== NAVBAR ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: var(--navbar-height);
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(5,5,10,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
}

.nav-brand {
    font-weight: 900;
    font-size: 1.5rem;
    color: white;
    letter-spacing: -1px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.nav-brand::before {
    content: '';
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    background-color: var(--primary-color);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' clip-rule='evenodd' d='M22 2l-6.5 4.5c-1-1-2.5-1.5-4-1.5s-3 .5-4 1.5L1 2v10c0 6 5 11 11 11s11-5 11-11V2zM10 9v8l6-4-6-4z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' clip-rule='evenodd' d='M22 2l-6.5 4.5c-1-1-2.5-1.5-4-1.5s-3 .5-4 1.5L1 2v10c0 6 5 11 11 11s11-5 11-11V2zM10 9v8l6-4-6-4z'/%3E%3C/svg%3E") no-repeat center / contain;
    box-shadow: 0 0 20px var(--primary-glow);
}
.nav-brand:hover { opacity: 0.85; }

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
}
.nav-user span { color: var(--text-secondary); }
.nav-user strong { color: var(--text-main); }

.btn-logout {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04);
    transition: all 0.25s ease;
}
.btn-logout:hover {
    background: rgba(225,29,72,0.15);
    border-color: rgba(225,29,72,0.4);
    color: var(--primary-color);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 5%;
    margin: 16px 0;
    position: relative;
    z-index: 10;
}
.breadcrumb a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--primary-color); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text-main); font-weight: 500; }

/* ===== LOGIN PAGE ===== */
body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    border-radius: 28px;
    text-align: center;
    animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 10;
}

.brand {
    font-weight: 900;
    font-size: 2.2rem;
    color: white;
    letter-spacing: -1.5px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.brand::before {
    content: '';
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    background-color: var(--primary-color);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' clip-rule='evenodd' d='M22 2l-6.5 4.5c-1-1-2.5-1.5-4-1.5s-3 .5-4 1.5L1 2v10c0 6 5 11 11 11s11-5 11-11V2zM10 9v8l6-4-6-4z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' fill-rule='evenodd' clip-rule='evenodd' d='M22 2l-6.5 4.5c-1-1-2.5-1.5-4-1.5s-3 .5-4 1.5L1 2v10c0 6 5 11 11 11s11-5 11-11V2zM10 9v8l6-4-6-4z'/%3E%3C/svg%3E") no-repeat center / contain;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.login-container h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-container > p {
    color: var(--text-muted);
    margin-bottom: 36px;
    font-size: 0.95rem;
}

.input-group { text-align: left; margin-bottom: 18px; }
.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.input-group input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.4);
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}
.input-group input::placeholder { color: var(--text-muted); }
.input-group input:focus {
    outline: none;
    border-color: rgba(225,29,72,0.6);
    box-shadow: 0 0 0 4px rgba(225,29,72,0.12);
    background: rgba(0,0,0,0.6);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-color), #be123c);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    margin-top: 12px;
    letter-spacing: 0.3px;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -5px var(--primary-glow);
}
.btn-primary:active { transform: translateY(0); }

.error-message {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(239,68,68,0.2);
    margin-bottom: 24px;
    font-size: 0.875rem;
}

/* ===== DASHBOARD PAGE ===== */
body.dashboard-body {
    display: block;
    background: var(--bg-darker);
}

.dashboard-container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 0 80px;
    animation: fadeIn 0.6s ease-out;
}

/* Hero Banner */
.hero-banner {
    position: relative;
    z-index: 10;
    padding: 48px 5% 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.hero-text h1 {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.1;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.65) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-text h1 span {
    background: linear-gradient(135deg, var(--primary-color), #fb7185);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-text p {
    color: var(--text-muted);
    margin-top: 10px;
    font-size: 1rem;
}

/* Search Bar */
.search-bar {
    position: relative;
    flex-shrink: 0;
}
.search-bar input {
    padding: 12px 18px 12px 44px;
    border-radius: 100px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 0.9rem;
    width: 280px;
    transition: all 0.3s;
    outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus {
    border-color: rgba(225,29,72,0.5);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 3px rgba(225,29,72,0.1);
    width: 320px;
}
.search-bar .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

/* Divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07) 20%, rgba(255,255,255,0.07) 80%, transparent);
    margin: 0 0 40px;
}

/* Category & Genre Sections */
.category-section { margin-bottom: 60px; }
.category-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}
.category-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-color), #f43f5e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 16px var(--primary-glow);
}
.category-title {
    color: var(--text-main);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.genre-section { margin-bottom: 36px; padding-left: 0; }
.genre-title {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.82rem;
}
.genre-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--primary-glow);
}

/* Series Grid */
.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* Series Card */
.series-card {
    border-radius: 16px;
    cursor: pointer;
    display: block;
    overflow: hidden;
    text-decoration: none;
    color: white;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
    animation: fadeInCard 0.5s ease-out both;
}

.series-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 24px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(225,29,72,0.25);
    border-color: rgba(225,29,72,0.3);
}

.series-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-card);
}

.series-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.4s ease;
}

.series-card:hover .series-thumb img {
    transform: scale(1.06);
}

/* Shimmer skeleton */
.cover-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.04) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    opacity: 0.25;
    gap: 8px;
    color: white;
}

/* Overlay gradient on thumb */
.thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    z-index: 2;
}

/* Episode badge */
.ep-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.15);
    z-index: 3;
    letter-spacing: 0.3px;
}

.series-info {
    padding: 12px 14px 14px;
}
.series-info h3 {
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    line-height: 1.3;
}
.series-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Search highlight hidden cards */
.series-card.hidden {
    display: none;
}

/* No results message */
.no-results {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 20px 0;
    display: none;
}
.no-results.visible { display: block; }

/* ===== STREAM PAGE ===== */
.stream-body {
    display: block;
    background: var(--bg-darker);
}

.main-content {
    display: flex;
    gap: 24px;
    width: 92%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 24px 0 60px;
    animation: fadeIn 0.6s ease-out;
    position: relative;
    z-index: 10;
}

.player-section {
    flex: 3;
    min-width: 0;
    border-radius: 24px;
    overflow: hidden;
    padding: 20px;
}

.video-wrapper {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 16/9;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}

video {
    width: 100%;
    height: 100%;
    display: block;
}

.video-info { margin-top: 20px; }

.now-playing-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(225,29,72,0.15);
    border: 1px solid rgba(225,29,72,0.35);
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.now-playing-label::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: blink 1.2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.video-info h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    line-height: 1.25;
}
.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.meta .dot { opacity: 0.4; }

/* Sidebar */
.sidebar {
    flex: 0 0 320px;
    border-radius: 24px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: calc(100vh - var(--navbar-height) - 48px);
    overflow-y: auto;
    position: sticky;
    top: calc(var(--navbar-height) + 12px);
    align-self: flex-start;
}

.sidebar-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar-series-name {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.25;
}
.sidebar-ep-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.ep-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-bottom: 4px;
    border: 1px solid transparent;
}
.ep-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}
.ep-item.active {
    background: rgba(225,29,72,0.12);
    border-color: rgba(225,29,72,0.3);
    color: white;
}

.ep-num {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--text-muted);
}
.ep-item.active .ep-num {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 10px var(--primary-glow);
}
.ep-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 0 2px 10px var(--primary-glow);
}
.ep-detail { min-width: 0; }
.ep-detail .ep-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    margin-bottom: 2px;
}
.ep-detail .ep-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Next Episode Banner */
.next-ep-banner {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(225,29,72,0.1);
    border: 1px solid rgba(225,29,72,0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-decoration: none;
    color: white;
    transition: background 0.25s;
}
.next-ep-banner:hover { background: rgba(225,29,72,0.18); }
.next-ep-banner .next-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.next-ep-banner .next-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.next-ep-banner .next-arrow {
    font-size: 1.2rem;
    opacity: 0.6;
    flex-shrink: 0;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .main-content { flex-direction: column; }
    .sidebar {
        flex: none;
        width: 100%;
        max-height: 400px;
        position: static;
    }
}
@media (max-width: 768px) {
    .hero-banner { padding: 32px 5% 24px; flex-direction: column; align-items: flex-start; }
    .hero-text h1 { font-size: 2rem; }
    .search-bar input { width: 100%; }
    .series-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    .dashboard-container { width: 95%; }
    .main-content { width: 95%; }
}