@import url('https://cdn.jsdelivr.net/npm/remixicon@4.3.0/fonts/remixicon.css');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

:root {
    --bg: #0e0e0e;
    --bg2: #161616;
    --bg3: #1e1e1e;
    --card: #1a1a1a;
    --card-hover: #222;
    --border: #2a2a2a;
    --text: #e8e8e8;
    --text2: #999;
    --text3: #666;
    --accent: #e50914;
    --accent-hover: #f40612;
    --accent2: #ff6b35;
    --gold: #f5c518;
    --green: #46d369;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,.6);
    --transition: .2s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(0,0,0,.95) 0%, rgba(0,0,0,.7) 70%, transparent 100%);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
    transition: background var(--transition);
}

.header.scrolled {
    background: rgba(14,14,14,.98);
    border-bottom: 1px solid var(--border);
}

.header-logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.header-logo span { color: var(--text); }

.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text2);
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active { color: var(--text); background: rgba(255,255,255,.07); }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Search in header */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
}

.header-search-input {
    background: rgba(255,255,255,.08);
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 7px 16px 7px 36px;
    color: var(--text);
    font-size: 14px;
    width: 200px;
    transition: all var(--transition);
    outline: none;
}

.header-search-input:focus {
    background: var(--bg3);
    border-color: var(--border);
    width: 260px;
}

.header-search-icon {
    position: absolute;
    left: 11px;
    color: var(--text3);
    font-size: 14px;
    pointer-events: none;
}

/* User avatar */
.header-user {
    position: relative;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color var(--transition);
}

.header-avatar:hover { border-color: var(--accent); }
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Plus avatar golden border */
.header-avatar-plus {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold);
    position: relative;
}

.header-avatar-plus::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5c518, #ff9900, #f5c518);
    z-index: -1;
    opacity: 0.8;
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    min-width: 180px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 999;
}

.header-user-dropdown.open { display: block; }

.dropdown-user-info {
    padding: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.dropdown-username {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.dropdown-role {
    font-size: 12px;
    color: var(--text3);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text2);
    transition: all var(--transition);
    cursor: pointer;
}

.dropdown-link:hover { background: rgba(255,255,255,.06); color: var(--text); }
.dropdown-link.danger { color: #e55; }
.dropdown-link.danger:hover { background: rgba(229,85,85,.1); color: #ff6b6b; }

.btn-login {
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    transition: background var(--transition);
}

.btn-login:hover { background: var(--accent-hover); }

/* ===== HERO ===== */
.hero {
    position: relative;
    height: 80vh;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding-bottom: 80px;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0e1117 0%, #1a0a0a 50%, #0e0e0e 100%);
}

.hero-bg-image {
    position: absolute;
    inset: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
    opacity: .3;
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg) 0%, rgba(14,14,14,.6) 40%, rgba(14,14,14,.1) 100%),
                linear-gradient(to right, rgba(14,14,14,.9) 0%, transparent 60%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    padding: 0 60px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.hero-title {
    font-size: clamp(28px, 4vw, 52px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0,0,0,.5);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text2);
}

.hero-rating { color: var(--gold); font-weight: 600; }
.hero-age { background: var(--bg3); border: 1px solid var(--border); padding: 2px 8px; border-radius: 4px; font-size: 12px; }

.hero-desc {
    font-size: 15px;
    color: var(--text2);
    line-height: 1.6;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-actions { display: flex; gap: 12px; }

.btn-play {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #000;
    padding: 12px 28px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    transition: background var(--transition), transform .1s;
}

.btn-play:hover { background: rgba(255,255,255,.85); }
.btn-play:active { transform: scale(.97); }

.btn-info {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.15);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transition: background var(--transition);
    border: 1px solid rgba(255,255,255,.2);
}

.btn-info:hover { background: rgba(255,255,255,.25); }

/* ===== CONTAINER & SECTIONS ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.section { margin-bottom: 48px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
}

.section-link {
    font-size: 13px;
    color: var(--text2);
    transition: color var(--transition);
}
.section-link:hover { color: var(--accent); }

/* ===== FILM GRID ===== */
.films-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.films-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* ===== FILM CARD ===== */
.film-card {
    flex-shrink: 0;
    scroll-snap-align: start;
    width: 160px;
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card);
    transition: transform .2s, box-shadow .2s;
    position: relative;
}

.films-grid .film-card { width: auto; }

.film-card:hover { transform: scale(1.04); box-shadow: 0 8px 32px rgba(0,0,0,.7); z-index: 2; }

.film-card-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--bg3);
}

.film-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.film-card:hover .film-card-poster img { transform: scale(1.05); }

.film-card-poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text3);
    background: linear-gradient(135deg, var(--bg3), var(--bg2));
}

.film-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .3px;
}

.film-card-age {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,.7);
    color: var(--text2);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.film-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 50%);
    opacity: 0;
    transition: opacity .2s;
    display: flex;
    align-items: flex-end;
    padding: 12px;
}

.film-card:hover .film-card-overlay { opacity: 1; }

.film-card-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 14px;
    margin-left: auto;
}

.film-card-info {
    padding: 10px;
}

.film-card-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.film-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text3);
}

.film-card-rating {
    color: var(--gold);
    font-weight: 600;
}

/* Progress bar on continue-watching */
.film-card-progress {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: rgba(255,255,255,.15);
}

.film-card-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

/* ===== MAIN CONTENT ===== */
.main { padding-top: 80px; }

/* ===== FOOTER ===== */
.footer {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 48px 24px 24px;
    margin-top: 60px;
}

.footer-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

.footer-brand h3 { font-size: 20px; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.footer-brand p { font-size: 13px; color: var(--text3); }

.footer-col h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); margin-bottom: 12px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 13px; color: var(--text3); transition: color var(--transition); }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text3);
}

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
}

/* ===== LOADING ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text3);
    font-size: 14px;
    gap: 10px;
}

.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    animation: toastIn .3s ease;
    max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--accent); }
.toast.info { border-left: 3px solid #4a9eff; }

@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(100%); } }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text3);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; line-height: 1; }
.empty-state-icon i { font-size: 48px; color: var(--text3); }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.empty-state-text { font-size: 14px; }

/* ===== BADGE ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-plus { background: linear-gradient(135deg, #f5c518, #ff9900); color: #000; }
.badge-admin { background: var(--accent); color: #fff; }
.badge-new { background: var(--green); color: #000; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header { padding: 0 16px; gap: 12px; }
    .header-nav { display: none; }
    .header-search-input { width: 160px; }
    .header-search-input:focus { width: 200px; }
    .hero-content { padding: 0 20px; }
    .container { padding: 0 16px; }
    .films-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .film-card { width: 130px; }
}
