/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-hover: #252525;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #777777;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.7);
    --shadow-modal: 0 8px 60px rgba(0, 0, 0, 0.9);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.2s ease;
    --transition-med: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --navbar-height: 64px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    color: inherit;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* ===== NAVBAR ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    height: var(--navbar-height);
    background: transparent;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.navbar.scrolled {
    background: rgba(10, 10, 10, 0.97);
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 36px;
}

.navbar-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.navbar-links {
    display: flex;
    gap: 22px;
}

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

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

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.nav-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-box {
    display: flex;
    align-items: center;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width var(--transition-med), opacity var(--transition-med);
}

.search-box.open {
    max-width: 240px;
    opacity: 1;
}

.search-box input {
    width: 220px;
    padding: 7px 12px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.profile-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
}

/* ===== HERO ===== */
.hero {
    position: relative;
    width: 100%;
    height: 90vh;
    min-height: 550px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 20%;
    transition: opacity 1s ease;
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, var(--bg-primary) 0%, rgba(10,10,10,0.4) 40%, transparent 70%),
        linear-gradient(to right, rgba(10,10,10,0.9) 0%, rgba(10,10,10,0.3) 40%, transparent 70%);
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: 0 4%;
    padding-bottom: 10vh;
    max-width: 640px;
    animation: heroFadeIn 1s ease forwards;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 14px;
    letter-spacing: -1.5px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.hero-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 22px;
    max-width: 500px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}

.meta-badge {
    padding: 2px 7px;
    border: 1px solid var(--text-secondary);
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 26px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(1.03);
}

.btn-secondary {
    background: rgba(109, 109, 110, 0.6);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(109, 109, 110, 0.4);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* ===== CONTENT ROWS ===== */
.content {
    position: relative;
    z-index: 3;
    margin-top: -80px;
    padding-bottom: 60px;
}

.content-row {
    margin-bottom: 44px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.content-row.visible {
    opacity: 1;
    transform: translateY(0);
}

.row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4%;
    margin-bottom: 10px;
}

.row-title {
    font-size: 18px;
    font-weight: 700;
}

.row-see-all {
    font-size: 12px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.row-see-all:hover {
    color: var(--text-primary);
}

.row-slider {
    display: flex;
    gap: 10px;
    padding: 8px 4%;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

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

/* ===== MOVIE CARDS ===== */
.movie-card {
    flex-shrink: 0;
    width: 180px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    transition: transform var(--transition-med), box-shadow var(--transition-med);
    cursor: pointer;
    position: relative;
}

.movie-card:hover {
    transform: scale(1.08) translateY(-6px);
    box-shadow: var(--shadow-card);
    z-index: 10;
}

.movie-card-poster {
    width: 100%;
    aspect-ratio: 2 / 3;
    background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.movie-card-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-med);
}

.movie-card:hover .movie-card-poster img {
    transform: scale(1.06);
}

.movie-card-poster .placeholder-icon {
    opacity: 0.25;
}

.card-type-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    background: var(--accent);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    border-radius: 3px;
}

.movie-card-info {
    padding: 10px 10px 12px;
}

.movie-card-title {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.movie-card-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.movie-card-wide {
    width: 280px;
}

.movie-card-wide .movie-card-poster {
    aspect-ratio: 16 / 9;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 12px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    width: 100%;
    max-width: 960px;
    max-height: 92vh;
    background: #181818;
    border-radius: 14px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 24px 100px rgba(0,0,0,0.95);
    transform: scale(0.92) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.modal::-webkit-scrollbar {
    width: 6px;
}

.modal::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(24, 24, 24, 0.85);
    border-radius: 50%;
    color: #fff;
    transition: background 0.2s, transform 0.2s;
}

.modal-close:hover {
    background: #181818;
    transform: scale(1.1);
}

.modal-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    min-height: 320px;
    display: flex;
    align-items: flex-end;
}

.modal-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: cover;
    background-position: center 15%;
}

.modal-hero-gradient {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, #181818 0%, rgba(24,24,24,0.2) 45%, transparent 75%),
        linear-gradient(to right, rgba(24,24,24,0.6) 0%, transparent 50%);
}

.modal-hero-content {
    position: relative;
    z-index: 5;
    padding: 40px 48px;
    width: 100%;
}

.modal-title {
    font-size: clamp(28px, 4.5vw, 48px);
    font-weight: 900;
    line-height: 1.05;
    margin-bottom: 24px;
    letter-spacing: -1.5px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.7);
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-body {
    padding: 32px 48px 48px;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 15px;
    color: #b3b3b3;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.meta-match {
    color: #46d369;
    font-weight: 700;
}

.meta-hd {
    padding: 2px 7px;
    border: 1px solid #666;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.modal-description {
    font-size: 16px;
    color: #e0e0e0;
    line-height: 1.8;
    margin-bottom: 32px;
    max-width: 700px;
}

.modal-details {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 24px;
    display: grid;
    gap: 14px;
}

.detail-row {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.detail-label {
    color: #777;
    min-width: 80px;
    flex-shrink: 0;
}

.detail-value {
    color: #d2d2d2;
}

@media (max-width: 640px) {
    .modal-overlay {
        padding: 0;
    }

    .modal {
        max-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .modal-hero {
        aspect-ratio: 16 / 10;
        min-height: 240px;
    }

    .modal-hero-content {
        padding: 24px;
    }

    .modal-body {
        padding: 24px;
    }

    .modal-title {
        font-size: 24px;
    }
}

/* ===== PLAYER OVERLAY ===== */
.player-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: #000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.player-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.player-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.player-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
}

.player-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-iframe-wrapper {
    width: 100%;
    height: 100%;
}

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

/* ===== FOOTER ===== */
.footer {
    padding: 50px 4% 36px;
    border-top: 1px solid var(--border-subtle);
}

.footer-content {
    max-width: 900px;
}

.footer-social {
    display: flex;
    gap: 18px;
    margin-bottom: 24px;
}

.footer-social a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.footer-social a:hover {
    color: var(--text-primary);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-secondary);
}

.footer-copy {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar-links {
        display: none;
    }

    .hero {
        height: 75vh;
        min-height: 420px;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn {
        justify-content: center;
        padding: 11px 20px;
    }

    .movie-card {
        width: 130px;
    }

    .movie-card-wide {
        width: 220px;
    }

    .modal-body {
        padding: 18px;
    }
}

/* ===== SEARCH RESULTS ===== */
.search-results {
    position: fixed;
    top: calc(var(--navbar-height) + 8px);
    right: 4%;
    width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    background: #1a1a1a;
    border-radius: 10px;
    box-shadow: 0 12px 50px rgba(0,0,0,0.8);
    z-index: 1500;
    padding: 8px;
    animation: fadeIn 0.2s ease;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: rgba(255,255,255,0.08);
}

.search-result-item img {
    width: 44px;
    height: 64px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.search-result-placeholder {
    width: 44px;
    height: 64px;
    background: #333;
    border-radius: 5px;
    flex-shrink: 0;
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: #888;
}

@media (max-width: 640px) {
    .search-results {
        left: 12px;
        right: 12px;
        width: auto;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== POSTER PLACEHOLDER ===== */
.poster-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: var(--text-muted);
    padding: 12px;
    text-align: center;
}

.poster-placeholder svg {
    opacity: 0.4;
    margin-bottom: 8px;
}

.poster-placeholder .placeholder-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* ===== CATEGORY MODAL ===== */
.category-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2500;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.category-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.category-modal {
    width: 100%;
    max-width: 1200px;
    background: #141414;
    border-radius: 12px;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-modal-overlay.active .category-modal {
    transform: scale(1) translateY(0);
}

.category-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 20, 0.9);
    border-radius: 50%;
    color: #fff;
    transition: background 0.2s, transform 0.2s;
}

.category-modal-close:hover {
    background: #1a1a1a;
    transform: scale(1.1);
}

.category-modal-header {
    padding: 32px 40px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.category-modal-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.category-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 24px 40px 40px;
}

.category-modal-grid .movie-card {
    width: 100%;
}

@media (max-width: 768px) {
    .category-modal-overlay {
        padding: 20px 12px;
    }
    
    .category-modal-header {
        padding: 24px 20px 16px;
    }
    
    .category-modal-title {
        font-size: 22px;
    }
    
    .category-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        padding: 16px 20px 24px;
    }
}
