/* --- GLOBAL VARIABLES & RESET --- */
:root {
    --primary: #e50914;       
    --dark: #0f1014;          
    --card-bg: #1f2125;       
    --text: #ffffff;
    --gray: #a3a3a3;
    --glass: rgba(20, 20, 20, 0.9);
    --border: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', sans-serif; }
body { background-color: var(--dark); color: var(--text); overflow-x: hidden; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
button { font-family: inherit; }

/* --- HEADER --- */
header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 5%; background: var(--glass); backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 1000; border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.logo { font-size: 23px; font-weight: 900; color: var(--primary); letter-spacing: 1px; text-transform: uppercase; }
.search-box { display: flex; background: #333; border-radius: 30px; padding: 5px 15px; border: 1px solid #444; }
.search-box input { background: transparent; border: none; color: #fff; padding: 8px; outline: none; width: 150px; transition: 0.4s; }
.search-box input:focus { width: 200px; }
.search-btn { background: transparent; border: none; color: var(--gray); cursor: pointer; font-size: 16px; }

/* --- LANDING PAGE --- */
.hero-landing {
    height: 100vh;
    background: linear-gradient(to top, var(--dark), transparent), url('https://assets.nflxext.com/ffe/siteui/vlv3/f841d4c7-10e1-40af-bcae-07a3f8dc141a/f6d7434e-d6de-4185-a6d4-c77a2d08737b/US-en-20220502-popsignuptwoweeks-perspective_alpha_website_medium.jpg') center/cover;
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 20px;
}
.hero-landing h1 { font-size: 3.5rem; margin-bottom: 20px; text-shadow: 2px 2px 10px #000; font-weight: 800; }
.hero-landing p { font-size: 1.5rem; margin-bottom: 30px; text-shadow: 1px 1px 5px #000; }
.cta-btn {
    padding: 15px 50px; font-size: 1.5rem; background: var(--primary); color: white;
    border: none; border-radius: 5px; cursor: pointer; transition: 0.3s; font-weight: bold;
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.5);
}
.cta-btn:hover { transform: scale(1.05); background: #f40612; }

/* --- HOME & SEARCH PAGE (Grid Layout) --- */
.category-section { padding: 30px 4%; }
.cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-left: 5px solid var(--primary); padding-left: 15px; }
.cat-header h2 { font-size: 1.5rem; color: #eee; }

.grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}
.card {
    background: var(--card-bg); border-radius: 8px; overflow: hidden; position: relative;
    transition: transform 0.3s, box-shadow 0.3s; cursor: pointer; border: 1px solid #333;
    display: block; /* Ensure anchor tags behave like blocks */
}
.card:hover { transform: scale(1.05); box-shadow: 0 10px 20px rgba(0,0,0,0.5); z-index: 10; border-color: var(--primary); }
.card img { width: 100%; height: 270px; object-fit: cover; }
.card-info { padding: 12px; }
.card-title { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; color: #fff; }
.card-meta { font-size: 0.8rem; color: var(--gray); display: flex; justify-content: space-between; margin-top: 8px; }

/* Watched Badge */
.watched-badge {
    position: absolute; top: 10px; right: 10px; background: rgba(39, 174, 96, 0.95);
    color: white; padding: 4px 8px; font-size: 0.75rem; border-radius: 4px; font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 5;
}

/* --- MORE MOVIES CARD (New Feature) --- */
.more-card {
    background: #1a1a1a;
    border: 2px dashed #444;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--primary); font-weight: bold; cursor: pointer; transition: 0.3s;
    min-height: 270px; border-radius: 8px;
}
.more-card:hover { background: #222; border-color: var(--primary); transform: scale(1.05); }
.more-card i { font-size: 2rem; margin-bottom: 10px; }

/* --- DETAILS PAGE --- */
.details-hero {
    position: relative; width: 100%; min-height: 85vh;
    display: flex; align-items: center; justify-content: center;
    padding: 100px 5% 50px; background-size: cover; background-position: center top;
}
.details-hero::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, var(--dark) 10%, rgba(15, 16, 20, 0.85) 50%, rgba(15, 16, 20, 0.8) 100%);
    z-index: 1;
}
.hero-content {
    position: relative; z-index: 2; display: flex; gap: 50px;
    max-width: 1300px; width: 100%; align-items: flex-start;
}
.poster-wrapper {
    flex-shrink: 0; width: 320px; border-radius: 12px; overflow: hidden;
    box-shadow: 0 0 50px rgba(0,0,0,0.8); border: 1px solid rgba(255,255,255,0.2);
}
.poster-wrapper img { width: 100%; display: block; }

.info-wrapper { flex: 1; padding-top: 10px; }
.movie-title { font-size: 3.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 15px; text-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.meta-tags { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; color: #ccc; font-size: 1rem; margin-bottom: 25px; }
.tag-badge { background: rgba(255,255,255,0.1); padding: 5px 12px; border-radius: 4px; border: 1px solid var(--border); }
.rating-star { color: #ffd700; font-weight: bold; font-size: 1.1rem; }
.overview-text { line-height: 1.8; color: #ddd; font-size: 1.1rem; margin-bottom: 30px; max-width: 800px; }

/* Action Buttons */
.action-btns { display: flex; gap: 20px; flex-wrap: wrap; }
.btn-lg {
    padding: 15px 35px; border-radius: 8px; font-weight: bold; font-size: 1.1rem;
    display: flex; align-items: center; gap: 10px; border: none; cursor: pointer; transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); text-transform: uppercase; letter-spacing: 1px;
}
.btn-play { background: var(--primary); color: white; }
.btn-play:hover { background: #b20710; transform: translateY(-3px); }
.btn-dl { background: rgba(100, 100, 100, 0.4); color: white; backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.2); }
.btn-dl:hover { background: rgba(255,255,255,0.2); transform: translateY(-3px); }

/* --- TV SERIES SECTION --- */
.tv-container { max-width: 1300px; margin: 0 auto; padding: 20px 5%; position: relative; z-index: 5; }
.section-title { font-size: 1.8rem; margin-bottom: 25px; border-left: 5px solid var(--primary); padding-left: 15px; color: #fff; }

.season-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.season-btn {
    padding: 10px 20px; background: #222; color: #aaa; border: 1px solid #333;
    border-radius: 4px; cursor: pointer; transition: 0.3s; font-size: 0.95rem; font-weight: 600;
}
.season-btn:hover { background: #333; color: #fff; }
.season-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 10px rgba(229, 9, 20, 0.4); }

.ep-list { display: flex; flex-direction: column; gap: 12px; }
.ep-card {
    background: #1a1a1a; border-radius: 8px; padding: 15px; border: 1px solid #333;
    transition: 0.3s; display: flex; flex-direction: column;
}
.ep-card:hover { background: #222; border-color: #555; }
.ep-header { display: flex; justify-content: space-between; align-items: center; width: 100%; flex-wrap: wrap; gap: 15px; }
.ep-title { font-weight: 600; font-size: 1.05rem; color: #eee; flex: 1; }
.ep-actions { display: flex; gap: 10px; }
.ep-btn {
    padding: 8px 18px; font-size: 0.9rem; border-radius: 4px; border: none; cursor: pointer; 
    font-weight: bold; display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.ep-play { background: #fff; color: #000; }
.ep-dl { background: #333; color: #fff; border: 1px solid #555; }
.ep-play:hover { background: #ddd; transform: scale(1.05); } 
.ep-dl:hover { background: #555; }

.ep-card.watched { border-color: #27ae60; background: #152018; }
.ep-card.watched .ep-title::after { content: ' ✔ Watched'; color: #27ae60; font-size: 0.8rem; margin-left: 10px; font-weight: bold; }

.inline-player {
    width: 100%; margin-top: 15px; background: #000; border-radius: 6px; overflow: hidden;
    position: relative; padding-bottom: 56.25%; height: 0; display: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5); border: 1px solid #333;
    animation: slideDown 0.5s ease;
}
.inline-player iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 5000; display: none;
    justify-content: center; align-items: center; flex-direction: column;
}
.modal-overlay iframe { width: 90%; height: 80vh; border: none; box-shadow: 0 0 50px rgba(255,255,255,0.1); background: #000; }
.close-modal {
    position: absolute; top: 20px; right: 20px; background: var(--primary); color: white;
    border: none; padding: 10px 25px; cursor: pointer; font-weight: bold; border-radius: 5px; font-size: 1rem;
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

footer { text-align: center; padding: 40px; background: #080808; color: #555; margin-top: 50px; border-top: 1px solid #222; }

@media (max-width: 900px) {
    .search-box input { width: 100px; } .search-box input:focus { width: 130px; }
    .hero-landing h1 { font-size: 2.5rem; }
    .category-section, .tv-container { padding: 20px 2.5%; } 
    .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .card img { height: 160px; }
    .card-title { font-size: 0.8rem; }
    .card-meta { font-size: 0.7rem; }
    .details-hero { padding: 80px 2.5% 40px; min-height: auto; display: block; }
    .hero-content { flex-direction: column; align-items: center; text-align: center; gap: 25px; }
    .poster-wrapper { width: 200px; margin-top: 10px; box-shadow: 0 5px 30px rgba(0,0,0,0.8); }
    .movie-title { font-size: 2rem; margin-top: 10px; }
    .meta-tags { justify-content: center; gap: 10px; }
    .overview-text { font-size: 0.95rem; text-align: center; margin-bottom: 25px; }
    .action-btns { justify-content: center; width: 100%; gap: 15px; }
    .btn-lg { width: 100%; justify-content: center; padding: 12px; }
    .ep-header { flex-direction: row; align-items: center; }
    .ep-title { font-size: 0.9rem; text-align: left; }
    .ep-actions { margin-left: auto; }
    .ep-btn { padding: 6px 12px; font-size: 0.8rem; }
    .ep-btn span { display: none; }
    .modal-overlay iframe { width: 100%; height: 35vh; }
}