:root {
    --bg-color: #141414;
    --card-bg: #1f1f1f;
    --primary-color: #e50914;
    /* Netflix-like Red */
    --text-color: #ffffff;
    --text-muted: #b3b3b3;
    --font-main: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: black;
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
}

/* Header */
header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 5px 4% 5px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: linear-gradient(to bottom, rgb(0 0 0 / 65%) 0%, rgba(0, 0, 0, 0) 100%);
    transition: background 0.3s ease;
}

header>img {
    justify-self: start;
}

header>nav {
    justify-self: center;
}

header>.search-bar {
    justify-self: end;
}

header.scrolled {
    background-color: white;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    margin: 0 15px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--text-muted);
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    /* Initially transparent */
    border-radius: 20px;
    padding: 5px;
    transition: all 0.3s ease;
}

.search-bar.active {
    background: rgba(0, 0, 0, 0.5);
    border-color: #333;
}

.search-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: #fff;
    padding: 0;
    width: 0;
    opacity: 0;
    outline: none;
    transition: all 0.3s ease;
    visibility: hidden;
    /* Hide from tab index when closed */
}

.search-bar.active input {
    width: 250px;
    /* Expanded width */
    padding: 5px 10px;
    opacity: 1;
    visibility: visible;
}

/* Optional: Make the button disappear or stay? usually stays as the "magnifier" */

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    /* Matches input width effectively if parent is sized, or we might want to match expanded input */
    min-width: 300px;
    /* Ensure it's wide enough */
    background-color: #1f1f1f;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    margin-top: 5px;
}

.search-results.active {
    display: block;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background-color: #333;
}

.search-item img {
    width: 40px;
    height: 60px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
}

.search-item-info {
    display: flex;
    flex-direction: column;
}

.search-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.search-item-year {
    font-size: 0.8rem;
    color: #b3b3b3;
}

/* Hero Section */
.hero-container {
    width: 100%;
    height: 80vh;
    /* Premium height */
    position: relative;
    margin-bottom: -110px;
}

.swiper {
    width: 100%;
    height: 100%;
}

.swiper-slide {
    text-align: center;
    font-size: 18px;
    background: #00000000;
    display: flex;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-position: center;
    position: relative;
}

/* Overlay for text readability */
.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #000000 5%, rgba(0, 0, 0, 0.8) 10%, rgba(20, 20, 20, 0) 100%);
    display: flex;
    align-items: center;
    padding-left: 5%;
}

.slide-content {
    text-align: left;
    max-width: 600px;
    z-index: 10;
}

.slide-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.1;
}

.slide-logo {
    max-width: 500px;
    max-height: 150px;
    width: auto;
    margin-bottom: 20px;
    display: block;
    object-fit: contain;
}

.slide-rating {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 20px;
}

.slide-overview {
    font-size: 1rem;
    color: #ddd;
    line-height: 1.5;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-watch {
    padding: 12px 30px;
    background: white;
    color: black;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    transition: transform 0.2s;
}

.btn-watch:hover {
    background: #ddd;
    transform: scale(1.05);
}

/* Content Sections */
.content-wrapper {
    padding: 0 2% 50px 2%;
}

.category-section {
    margin-bottom: 10px;
    position: relative;
    z-index: 10;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 22px;
}

.section-title-swiper-heading {
    padding-bottom: 20px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header-row .section-title {
    margin-bottom: 0;
}

/* Genres Tabs */
.genre-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.genre-tab {
    background: transparent;
    border: 1px solid #444;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-main);
}

.genre-tab:hover,
.genre-tab.active {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* Grid System */
.media-grid {
    margin-bottom: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    justify-content: center;
    /* Center items if they don't fill width */
    grid-auto-rows: 1fr;
    /* Uniform height */
}

.movie-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    cursor: pointer;
    aspect-ratio: 2/3;
}

@media (hover: hover) {
    .movie-card:hover {
        transform: scale(1.25);
        z-index: 2;
        box-shadow: 0 0px 20px rgb(37, 37, 37);
    }
}

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

@media (hover: hover) {
    .movie-card:hover .movie-info {
        opacity: 1;
    }
}

.movie-title {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.movie-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.rating-badge {
    color: #46d369;
    /* Green like match rate */
    font-weight: bold;
}

/* Swiper Nav adjustments */
.swiper-button-next,
.swiper-button-prev {
    color: white;
    text-shadow: 0 0 5px black;
}

/* Responsive */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .slide-title {
        font-size: 1.8rem;
    }

    .slide-logo {
        max-width: 80%;
        max-height: 100px;
    }

    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Mobile Header Optimization */
    header {
        padding: 0 4%;
        height: 60px;
        /* Fixed height to prevent scroll jump */
    }

    header img {
        width: 35px;
        /* Smaller logo */
    }

    .logo {
        font-size: 1.2rem;
        /* Smaller text logo */
    }

    /* Mobile Search Active State */
    header.search-active {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    header.search-active>a,
    header.search-active>nav {
        display: none;
    }

    header.search-active .search-bar {
        width: 100%;
    }

    header.search-active .search-bar input {
        width: 100%;
        max-width: 300px;
        /* Optional cap */
    }
}

@media (max-width: 480px) {
    .slide-title {
        font-size: 1.5rem;
    }

    .slide-logo {
        max-width: 90%;
        max-height: 80px;
    }
}

/* Details Page Styles */
.details-hero {
    height: auto;
    position: relative;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
}

.details-overlay {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, #000000 10%, rgba(0, 0, 0, 0.8) 50%, rgba(20, 20, 20, 0) 100%);
    display: flex;
    align-items: center;
    /* Center content vertically */
    padding: 55px 4% 33px 4%;
}

.details-content {
    display: flex;
    gap: 40px;
    margin-top: 80px;
    /* Offset for header */
    max-width: 1200px;
    align-items: flex-end;
    margin-bottom: 50px;
}

.details-poster {
    width: 300px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    /* Hide on small screens if needed, but good for desktop */
}

@media (min-width: 768px) {
    .details-poster {
        display: block;
    }
}

.details-info {
    color: white;
}

.details-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.1;
}

.details-logo {
    max-width: 400px;
    max-height: 200px;
    width: auto;
    margin-bottom: 20px;
    display: block;
    /* Managed by JS, but block layout */
}

.details-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #ccc;
}

.genre-tag {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 0.9rem;
    margin-right: 8px;
    margin-bottom: 15px;
}

.details-overview {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 700px;
    color: #ddd;
}

/* Cast Swiper */
.cast-slide {
    text-align: center;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.cast-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.cast-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}


/* Player Modal */
.player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.player-container {
    width: 100%;
    height: 100%;
    position: relative;
}

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

.close-player {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}


.close-player:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Series Section */
.series-section {
    padding: 20px 4%;
}

.season-list-container {
    overflow-x: auto;
    white-space: nowrap;
    margin-bottom: 20px;
    padding-bottom: 10px;
    /* Hide scrollbar for Chrome/Safari/Opera */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.season-list-container::-webkit-scrollbar {
    display: none;
}

.season-list {
    display: inline-flex;
    gap: 15px;
}

.season-chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.season-chip:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
}

.season-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.episode-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
    position: relative;
}

.episode-card:hover {
    transform: translateY(-5px);
}

.episode-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #222;
}

.episode-info {
    padding: 10px;
}

.episode-number {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 4px;
}

.episode-title {
    font-size: 0.95rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.episode-overview {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* --- Top 10 Custom Slider Styles --- */
.top10Swiper {
    padding: 0px 40px 51px;
    /* Increased vertical padding for shadows */
    overflow: hidden;
    position: relative;
}

.top10-slide {
    width: auto;
    /* Allow auto sizing based on content */
    display: flex;
    justify-content: center;
}

.top10-card {
    width: 240px;
    /* Slightly bigger than typical 200px grid min */
    height: 360px;
    /* Aspect 2:3 */
    border-radius: 16px;
    /* More rounded */
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

@media (hover: hover) {
    .top10-card:hover {
        transform: scale(1.15);
        z-index: 2;
        box-shadow: 0 0px 20px rgb(92, 91, 91);
    }
}

.top10-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Custom Navigation Buttons */
.sw-button-next-custom,
.sw-button-prev-custom {
    color: white;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    transition: background 0.3s;
}

.sw-button-next-custom:hover,
.sw-button-prev-custom:hover {
    background: var(--primary-color);
}

.sw-button-next-custom {
    right: 0;
}

.sw-button-prev-custom {
    left: 0;
}

.sw-button-next-custom::after,
.sw-button-prev-custom::after {
    font-size: 1.2rem;
    font-weight: bold;
    font-family: swiper-icons;
}

.sw-button-next-custom::after {
    content: 'next';
}

.sw-button-prev-custom::after {
    content: 'prev';
}

@media (max-width: 768px) {
    .top10-card {
        width: 160px;
        height: 240px;
    }

    .top10Swiper {
        padding: 20px 2%;
    }

    .sw-button-next-custom,
    .sw-button-prev-custom {
        display: none;
        /* Hide custom arrows on mobile, rely on swipe */
    }
}

/* Details Page Mobile Responsive */
@media (max-width: 768px) {
    .details-hero {
        min-height: 70vh;
        height: auto;
        align-items: flex-end;
    }

    .details-content {
        margin-top: 60px;
        margin-bottom: 30px;
        padding-bottom: 40px;
        flex-direction: column;
        gap: 20px;
    }

    .details-logo {
        max-width: 80%;
        height: auto;
    }

    .details-title {
        font-size: 2rem;
        line-height: 1.2;
        word-wrap: break-word;
    }

    .details-overview {
        -webkit-line-clamp: 4;
        font-size: 0.95rem;
    }

    .search-bar a {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .details-title {
        font-size: 1.8rem;
    }

    .details-logo {
        max-width: 90%;
    }
}

/* Footer Styles */
.site-footer {
    background-color: #000;
    padding: 40px;
    margin-top: 10px;
    border-top: 1px solid #333;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer-container {
    display: flex;
}

.footer-left,
.footer-right {
    flex: 1;
    min-width: 300px;
}

.footer-logo {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-disclaimer {
    line-height: 1.6;
}

.footer-right {
    text-align: right;
}

.footer-credit-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.footer-credits {
    list-style: none;
}

.footer-credits li {
    margin-bottom: 5px;
    color: var(--text-color);
}

.roll-no {
    color: var(--text-muted);
    margin-left: 10px;
    font-family: monospace;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-right {
        text-align: left;
        margin-top: 20px;
    }
}

/* Mobile Landscape */
@media (max-height: 778px) and (orientation: landscape) {
    .hero-container {
        height: 100vh;
        min-height: 300px;
        margin-bottom: -50px;
    }

    .slide-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .slide-logo {
        max-width: 300px;
        max-height: 80px;
        margin-bottom: 10px;
    }

    .slide-rating {
        padding: 3px 8px;
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .slide-overview {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        margin-bottom: 15px;
        max-width: 500px;
    }

    .btn-watch {
        padding: 8px 20px;
        font-size: 0.9rem;
    }

    .slide-content {
        max-width: 80%;
    }
}