:root {
    --bg-color: #141414;
    --text-color: #ffffff;
    --primary-color: #E50914;
    --hover-color: #f40612;
    --gray-text: #808080;
    --nav-bg: rgba(20, 20, 20, 0.95);
    --transition: all 0.3s ease;
}

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

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

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 4%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.3s ease;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 10%, rgba(0,0,0,0));
}

.navbar.scrolled {
    background-color: var(--nav-bg);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-links a {
    color: #e5e5e5;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

    .nav-toggle {
        display: none;
        background: transparent;
        border: none;
        cursor: pointer;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 8px;
    }

    .nav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: white;
        border-radius: 999px;
    }

.search-icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s;
    z-index: 2;
}
.search-icon-btn:hover { color: #E50914; }

#search-input {
    width: 0;
    opacity: 0;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0);
    color: white;
    padding: 7px 32px 7px 14px;
    border-radius: 4px;
    outline: none;
    font-size: 0.9rem;
    transition: width 0.35s ease, opacity 0.35s ease, border-color 0.35s ease;
    pointer-events: none;
}

.search-box.open #search-input {
    width: 220px;
    opacity: 1;
    border-color: rgba(255,255,255,0.6);
    pointer-events: all;
}

.search-clear {
    display: none;
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s;
}
.search-clear:hover { color: white; }
.search-box.open .search-clear { display: block; }

/* Search Results Overlay */
#search-results {
    display: none;
    position: fixed;
    top: 70px;
    left: 0; right: 0;
    bottom: 0;
    background: rgba(20,20,20,0.97);
    z-index: 999;
    padding: 30px 4%;
    overflow-y: auto;
}
#search-results.visible { display: block; }
#search-results h3 {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 20px;
}
.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.search-grid .poster-wrapper {
    flex: auto;
    width: 100%;
    margin-right: 0;
}

.profile-icon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
}

/* Hero Section */
.hero {
    position: relative;
    height: 80vh;
    background-size: cover !important;
    background-position: center center !important;
    color: white;
    object-fit: contain;
}

.hero-content {
    position: absolute;
    top: 35%;
    left: 4%;
    width: 45%;
    z-index: 10;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-play {
    background-color: white;
    color: black;
}

.btn-play:hover {
    background-color: rgba(255,255,255,0.7);
}

.btn-more-info {
    background-color: rgba(109, 109, 110, 0.7);
    color: white;
}

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

.hero-description {
    font-size: 1.2rem;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-fade-bottom {
    position: absolute;
    bottom: 0;
    height: 200px;
    width: 100%;
    background: linear-gradient(180deg, transparent, rgba(20,20,20,0.61), #141414);
}

/* Rows Container */
.main-content {
    margin-top: -100px;
    position: relative;
    z-index: 5;
    padding-bottom: 50px;
}

/* Category pages (no hero) */
.main-content.no-hero {
    margin-top: 0;
    padding-top: 80px; /* clear fixed navbar */
}

/* Row Scroll Wrapper */
.row-scroll-wrapper {
    position: relative;
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 80px;
    background: rgba(20, 20, 20, 0.85);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    opacity: 0;
    pointer-events: none;
}
.row-scroll-wrapper:hover .scroll-btn {
    opacity: 1;
    pointer-events: all;
}
.scroll-btn:hover {
    background: rgba(20,20,20,0.97);
    transform: translateY(-50%) scale(1.05);
}
.scroll-btn.left  { left: 0;  border-radius: 0 6px 6px 0; }
.scroll-btn.right { right: 0; border-radius: 6px 0 0 6px; }


.row {
    margin-bottom: 30px;
    padding-left: 4%;
    padding-right: 4%;
}

.row h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    padding-left: 0;
}

.row-posters {
    display: flex;
    overflow-y: hidden;
    overflow-x: scroll;
    padding: 20px 0;
    scroll-behavior: smooth;
}

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

.poster-wrapper {
    margin-right: 14px;
    flex: 0 0 150px;
    width: 150px;
    cursor: pointer;
    transition: transform 300ms cubic-bezier(0.2, 0, 0.2, 1), box-shadow 300ms ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.poster-wrapper:hover {
    transform: translateY(-5px) scale(1.04);
}

.row-poster {
    width: 100%;
    height: 225px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: box-shadow 300ms ease;
}

.poster-wrapper:hover .row-poster {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.7);
}

.poster-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 8px;
    text-align: left;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.poster-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 4px;
    font-size: 0.8rem;
}

.imdb-rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #e5e5e5;
    font-weight: 600;
}

.imdb-rating .star {
    color: #f5c518; /* IMDb gold star */
    font-size: 0.85rem;
}

.release-year {
    color: #808080;
    font-weight: 500;
}

.imdb-logo {
    background-color: #f5c518;
    color: #000000;
    font-weight: 900;
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: -0.5px;
    display: inline-block;
    line-height: 1.2;
    margin-right: 2px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-color);
    margin: 5% auto;
    width: 60%;
    max-width: 850px;
    border-radius: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 90vh;
    position: relative;
    animation: slideUp 0.4s ease;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

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

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2010;
    background: rgba(0,0,0,0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-btn:hover {
    background: white;
    color: black;
}

.modal-header {
    position: relative;
    width: 100%;
    height: 450px;
}

.modal-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    /* Hide the text "Play" in index.html, we only want the SVG */
    font-size: 0;
}

.modal-play svg {
    width: 40px;
    height: 40px;
    margin-left: 5px; /* visually center the play triangle */
}

.modal-play:hover {
    background: rgba(255, 255, 255, 0.9);
    color: black;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.modal-fade {
    position: absolute;
    bottom: 0;
    height: 150px;
    width: 100%;
    background: linear-gradient(180deg, transparent, var(--bg-color));
}

.modal-body {
    padding: 0 40px 40px;
}

.modal-details-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.modal-details-left h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.modal-meta {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--gray-text);
}

.match-score {
    color: #46d369;
    font-weight: bold;
    margin-right: 15px;
}

.modal-details-left p {
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-details-right p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--gray-text);
    margin-bottom: 15px;
}

.modal-details-right p strong {
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    .nav-links {
        position: absolute;
        top: 70px;
        right: 4%;
        background: rgba(10, 10, 10, 0.95);
        flex-direction: column;
        gap: 12px;
        padding: 15px 18px;
        border-radius: 12px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
        display: none;
        width: auto;
        z-index: 1001;
    }
    .nav-links.open {
        display: flex;
    }
    .nav-links a {
        font-size: 1rem;
    }
    .navbar {
        padding: 16px 4%;
    }
    .hero-content {
        width: 90%;
        top: 30%;
    }
    .hero-title {
        font-size: 2rem;
    }
    .hero-buttons {
        flex-direction: column;
        gap: 12px;
    }
    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 18px;
    }
    .hero-description {
        font-size: 1rem;
    }
    .main-content {
        margin-top: -90px;
        padding-bottom: 60px;
    }
    .row {
        padding-left: 4%;
        padding-right: 4%;
    }
    .row h2 {
        font-size: 1.2rem;
    }
    .row-posters {
        gap: 12px;
        padding: 16px 0;
    }
    .poster-wrapper {
        flex: 0 0 130px;
        width: 130px;
    }
    .row-poster {
        height: 195px;
    }
    .poster-title {
        font-size: 0.85rem;
    }
    .poster-meta {
        font-size: 0.75rem;
    }
    .modal-content {
        width: 95%;
        margin: 8% auto;
    }
    .modal-header {
        height: 320px;
    }
    .modal-body {
        padding: 20px;
    }
    .modal-details-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .modal-details-left h2 {
        font-size: 1.8rem;
    }
    .modal-details-left p,
    .modal-details-right p {
        font-size: 1rem;
    }
}
