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

html {
    font-size: 16px; /* Set base font size for rem units */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #141414;
    color: #fff;
    line-height: 1.6;
}

.hero {
    position: relative;
    height: 74vh;
    min-height: 600px;
    overflow: hidden;
    background: #141414;
}

.hero-actions-bottom-right {
    position: absolute;
    bottom: 80px;
    right: 30px;
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    z-index: 10;
}

.trailer-btn {
    background: rgba(109, 109, 110, 0.7);
    color: white;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.trailer-btn:hover {
    background: rgba(109, 109, 110, 0.9);
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.lightbox-close {
    position: fixed;
    top: 0;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: 35px;
    cursor: pointer;
    z-index: 10001;
    padding: 0;
    width: 50px;
    height: 50px;
    line-height: 44px;
    text-align: center;
    transition: all 0.3s;
    font-weight: bold;
}

.lightbox-close:hover {
    background: #e50914;
    border-color: #e50914;
    transform: rotate(90deg) scale(1.1);
}

.lightbox-video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.lightbox-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
    width: 48px;
    height: 48px;
    position: relative;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.action-btn.active {
    background: rgba(229, 9, 20, 0.8);
    border-color: #e50914;
}

.action-icon {
    width: 24px;
    height: 24px;
}

.action-label {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.action-btn:hover .action-label {
    opacity: 1;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

.hero-bg.bw-filter {
    filter: grayscale(100%);
}

.hero-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 aspect ratio */
    min-height: 200%;
    min-width: 177.77vh; /* 16:9 aspect ratio */
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    transition: opacity 1s ease-in-out;
}

.hero-bg.video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 0;
    transition: opacity 1s ease-in-out;
}

.hero-video-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #000000 0%, transparent 4%, transparent 96%, #000000 100%);
    pointer-events: none;
    z-index: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(20,20,20,0.3) 0%, rgba(20,20,20,0.8) 70%, #141414 100%);
    z-index: 1;
}

.hero-content {
    position: absolute;
    bottom: 80px;
    left: 50px;
    max-width: 800px;
    z-index: 2;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

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

.rating {
    background: #e50914;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
}

.certification {
    border: 1px solid #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.tagline {
    font-style: italic;
    color: #ccc;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.overview {
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 700px;
    margin-bottom: 1px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
}

.overview.expanded {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
}

.read-more {
    color: #e50914;
    cursor: pointer;
    font-weight: 600;
    display: inline-block;
    text-decoration: none;
    font-size: 1rem;
}

.read-more:hover {
    text-decoration: underline;
}

.buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.watch-trailer {
    padding-top: 14px;
}

.placeholder-watch-links {
    /* Empty placeholder for future watch links */
}

.inlineplpaceholder-watch-links {
    /* Empty placeholder for inline watch links above Where to Watch section */
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #e50914;
    color: #fff;
}

.btn-primary:hover {
    background: #f40612;
}

.btn-secondary {
    background: rgba(109,109,110,0.7);
    color: #fff;
}

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

.watch-providers-inline, .placeholder-watch-links {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(109,109,110,0.7);
    padding: 4px 12px 8px 12px;
    border-radius: .3rem;
}
.placeholder-watch-links {
    max-width: 350px;
}

.watch-providers-inline span, .placeholder-watch-links span {
    font-size: 1.1rem;
    font-weight: 600;
}

.placeholder-watch-links a{
    font-size: 1rem;
    color: #FFF;
}


.provider-logos-inline {
    display: flex;
    gap: 8px;
}

.provider-logo-small {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    object-fit: cover;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Country Selector */
.country-selector-container {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    margin: 0 0 30px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 1400px;
}

.country-selector-container label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

#country-search {
    flex: 1;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 1rem;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.3s;
}

#country-search:focus {
    outline: none;
    border-color: #e50914;
}

#country-select {
    flex: 1;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 1rem;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

#country-select:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

#country-select:focus {
    outline: none;
    border-color: #e50914;
}

/* Mobile movie info section with read more */
@media (max-width: 768px) {
    .movie-info-section {
        position: relative;
        max-height: 200px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .movie-info-section.expanded {
        max-height: none;
    }
    
    .movie-info-section::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 80px;
        background: linear-gradient(to bottom, transparent, #000);
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .movie-info-section.expanded::after {
        opacity: 0;
    }
    .section.movie-info-section{
        margin-bottom: 0;
    }
    .read-all-btn {
        display: block;
        width: 100%;
        padding: 12px;
        margin-bottom: 2rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
        color: #fff;
        font-size: 1rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .read-all-btn:hover {
        background: rgba(255, 255, 255, 0.15);
    }
    
    .read-all-btn.hidden {
        display: none;
    }
    
    /* Hide the standalone country-search outside the container */
    .section-title + #country-search {
        display: none;
    }
    
    .country-selector-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
    }
    
    .country-selector-container label {
        white-space: normal;
        text-align: left;
        margin-bottom: 5px;
    }
    
    .country-selector-container #country-search,
    .country-selector-container #country-select {
        max-width: 100%;
        width: 100%;
    }
    
    /* Recommendations grid - 2 items per row on mobile */
    .recommendations-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
}

/* Keep 2 columns even on very small screens */
@media (max-width: 480px) {
    .recommendations-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
}

.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.country-section-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
    font-weight: 600;
    color: #fff;
}

.country-section {
    transition: opacity 0.3s, max-height 0.3s;
}

.country-section.hidden {
    display: none;
}

.cast-section {
    position: relative;
}

.cast-grid {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 10px 0;
}

.cast-grid::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.cast-member {
    flex: 0 0 150px;
    text-align: center;
}

.cast-photo {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
}

.cast-name {
    margin-top: 10px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Cast scroll arrows */
.cast-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cast-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
}

.cast-arrow-left {
    left: -25px;
}

.cast-arrow-right {
    right: -25px;
}

.cast-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cast-character {
    color: #999;
    font-size: 0.85rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    background: rgba(255,255,255,0.05);
    padding: 30px;
    border-radius: 8px;
}

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

.info-label {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.genre-link {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s;
}

.genre-link:hover {
    color: #e50914;
    text-decoration: underline;
}

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

.recommendation-card {
    text-align: center;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s;
}

.recommendation-card:hover {
    transform: scale(1.05);
}

.recommendation-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 8px;
    background: #333;
}

.recommendation-title {
    margin-top: 10px;
    font-size: 0.95rem;
    text-align: center;
}

.providers {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.provider-group {
    flex: 1;
    min-width: 200px;
}

.provider-type {
    font-weight: 600;
    color: #e50914;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.provider-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.provider-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16/9;
}

.lightbox-close {
    position: absolute;
    top: 0px;
    right: 0;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 10000;
}

.lightbox-close:hover {
    color: #FFF;
}

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

/* Seasons & Episodes Section */
.seasons-section {
    margin-top: 2rem;
}

.season-selector {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.season-selector label {
    font-size: 1rem;
    font-weight: 600;
}

.season-selector select {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background: #2a2a2a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
}

.season-selector select:hover {
    border-color: #666;
}

.season-content {
    display: none;
}

.season-content.active {
    display: block;
}

.season-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #e5e5e5;
}

.episodes-table-header {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: #0a0a0a;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.header-episode {
    flex-shrink: 0;
    width: 200px;
}

.header-info {
    flex: 1;
}

.header-watch {
    flex-shrink: 0;
    width: 200px;
    text-align: center;
}

.episodes-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.episode-card {
    display: flex;
    gap: 1.5rem;
    background: #1a1a1a;
    border-radius: 0;
    padding: 1rem;
    transition: background 0.3s;
    border-bottom: 1px solid #2a2a2a;
}

.episode-card:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
}

.episode-card:hover {
    background: #222;
}

.episode-still-container {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    height: 113px;
}

.episode-still-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.episode-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

.episode-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.episode-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.25rem 0;
}

.episode-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.episode-air-date {
    color: #999;
}

.episode-runtime {
    color: #999;
}

.episode-separator {
    color: #666;
}

.episode-rating {
    color: #ffd700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.episode-overview {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.episode-watch-container {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}


.episode-watch-providers {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.episode-watch-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Watch provider logos in episode cards - 30% smaller than 40px = 28px */
.episode-watch-providers img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    transition: transform 0.2s;
}

.episode-watch-providers img:hover {
    transform: scale(1.1);
}

.episode-watch-providers a {
    display: inline-block;
    line-height: 0;
}

@media (max-width: 1024px) {
    .hero-actions-bottom-right {
        position: absolute;
        top: 10px;
        right: inherit;
        left: 15px;
        bottom: auto;
        justify-content: flex-end;
    }
}

@media (max-width: 1024px) {
    .hero-video {
        display: none !important;
    }
    
    .video-fallback {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .meta {
        font-size: 0.9rem;
        gap: 10px;
    }
    
    .overview {
        font-size: 1rem;
        margin-bottom: 1px;
    }
    
    .cast-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .lightbox-content {
        width: 95%;
    }
    
    .lightbox-close {
        top: -35px;
        font-size: 1.5rem;
    }
    
    /* Episode cards responsive */
    .episodes-table-header {
        display: none;
    }
    
    .episode-card {
        flex-direction: column;
        gap: 1rem;
    }
    
    .episode-still-container {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
    
    .episode-watch-container {
        width: 100%;
    }
    
    .header-episode,
    .header-info,
    .header-watch {
        width: 100%;
    }
    
    .episode-watch-providers {
        justify-content: flex-start;
    }
}
