/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    --bg-body: #f0f2f5;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --primary: #1877f2;
    --text-main: #050505;
    --text-gray: #65676b;
    --border-radius: 8px;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

img {
    max-width: 100%;
    display: block;
    border-style: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* HEADER */
header {
    background-color: transparent;
    height: 68px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: background-color 0.3s;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    height: 60px;
}

header.scrolled {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-container {
    padding: 0 4%;
    /* Netflix style padding */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: var(--primary);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -1px;
    padding: 0;
    background: none;
    -webkit-text-fill-color: initial;
    text-shadow: none;
}

.search-box {
    background: #f0f2f5;
    border: none;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    transition: 0.2s;
    border-radius: 20px;
}

.search-box:focus-within {
    background: #f0f2f5;
    box-shadow: none;
    padding-left: 15px;
}

.search-box input {
    background: transparent;
    border: none;
    color: #050505;
    width: 200px;
    padding: 5px;
    font-size: 15px;
}

.search-box button {
    background: transparent;
    color: #606770;
    font-size: 16px;
}

.search-box button:hover {
    color: var(--primary);
    transform: none;
}

/* HERO SECTION */
.hero {
    position: relative;
    height: 60vh;
    width: 100%;
    margin-bottom: 20px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, var(--bg-body) 0%, transparent 100%),
        linear-gradient(to right, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    display: flex;
    align-items: center;
    padding-left: 4%;
}

.hero-content {
    max-width: 600px;
    padding-top: 60px;
}

.hero-badge {
    color: #fff;
    background: var(--primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    text-transform: capitalize;
    margin-bottom: 10px;
    display: inline-block;
    box-shadow: none;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.1;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-desc {
    color: #f0f2f5;
    font-size: 1rem;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.hero-btn {
    background: #fff;
    color: #000;
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: 0.2s;
}

.hero-btn:hover {
    background: #e4e6eb;
    transform: none;
    box-shadow: none;
}

/* SECTIONS */
.section {
    padding: 30px 4%;
    position: relative;
    z-index: 10;
    margin-top: -50px;
    /* Pull up to overlay Hero fade */
}

.section-common {
    padding: 30px 4%;
}

.section-title {
    font-size: 1.25rem;
    color: #050505;
    margin-bottom: 15px;
    font-weight: 700;
    border-left: none;
    padding-left: 0;
    background: none;
    -webkit-text-fill-color: initial;
    display: block;
}

/* CARDS (Netflix Poster Style) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.card {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
    background-color: var(--bg-card);
    border: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    backdrop-filter: none;
}

.card:hover {
    transform: none;
    z-index: 1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: #ccc;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info-hover {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    opacity: 0;
    transition: 0.2s;
}

.card:hover .card-info-hover {
    opacity: 1;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #050505;
    text-shadow: none;
}

.card-eps {
    font-size: 12px;
    color: var(--text-gray);
    text-align: center;
    margin-top: 5px;
}

/* DETAIL PAGE */
.detail-main {
    padding-top: 100px;
    padding-bottom: 50px;
    padding-left: 4%;
    padding-right: 4%;
    display: flex;
    gap: 40px;
}

@media (max-width: 768px) {
    .detail-main {
        flex-direction: column;
        align-items: center;
    }
}

.poster-box img {
    width: 300px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.info-box {
    flex: 1;
}

.info-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 15px;
}

.meta-row {
    display: flex;
    gap: 20px;
    color: var(--text-gray);
    margin-bottom: 20px;
    font-size: 1rem;
}

.meta-item {
    border: 1px solid #ddd;
    color: #65676b;
    padding: 4px 12px;
    font-size: 0.8rem;
    background: #fff;
    border-radius: 15px;
}

.eps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    margin-top: 30px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar */
.eps-grid::-webkit-scrollbar {
    width: 5px;
}

.eps-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
}

.ep-btn {
    background: #e4e6eb;
    color: #050505;
    border: none;
    padding: 10px 0;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.ep-btn:hover {
    background: #d8dadf;
    color: #050505;
    transform: none;
    box-shadow: none;
}

/* PLAYER POPUP */
.player-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.player-modal.active {
    display: flex;
}

.player-scaler {
    width: 100%;
    /* Default vertical Aspect Ratio roughly 9:16 for proper fitting */
    max-width: 50vh;
    /* Scale based on viewport height so it fits */
    aspect-ratio: 9/16;
    background: #000;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.player-scaler.wide {
    max-width: 1000px;
    aspect-ratio: 16/9;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Ensure full video visible */
    background: #000;
}

.close-btn {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    text-align: center;
    border-radius: 50%;
}