/* ============================================
   STREAMIFY - PREMIUM NETFLIX CLONE
   Updated Version - Fixed Top 5 & Popup
============================================ */

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

body {
    font-family: 'Inter', sans-serif;
    background: #0a0a0a;
    color: #fff;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* ============ WELCOME POPUP ============ */
.welcome-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.welcome-popup.active {
    opacity: 1;
    visibility: visible;
}

.popup-box {
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border: 1px solid #333;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.4s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.welcome-popup.active .popup-box {
    transform: scale(1);
}

.popup-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #e50914 0%, #b20710 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    font-size: 32px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(229,9,20,0.4);
}

.popup-box h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
}

.popup-box > p {
    font-size: 15px;
    color: #b3b3b3;
    line-height: 1.6;
    margin-bottom: 25px;
}

.popup-box p strong {
    color: #e50914;
}

.popup-instructions {
    background: rgba(255,255,255,0.03);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #222;
}

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

.instruction-item i.fab {
    font-size: 24px;
    width: 30px;
    text-align: center;
}

.instruction-item i.fa-windows {
    color: #00a4ef;
}

.instruction-item i.fa-apple {
    color: #a2aaad;
}

.instruction-item i.fa-android {
    color: #3ddc84;
}

.instruction-item span {
    font-size: 14px;
    color: #b3b3b3;
    line-height: 1.5;
}

.instruction-item strong {
    color: #fff;
    font-weight: 600;
}

.instruction-item kbd {
    background: #333;
    padding: 3px 10px;
    border-radius: 5px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

.popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    background: linear-gradient(90deg, #e50914 0%, #b20710 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(229,9,20,0.4);
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(229,9,20,0.5);
}

/* ============ NAVBAR ============ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 50px;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
    transition: background 0.3s;
}

.navbar.scrolled {
    background: rgba(10,10,10,0.98);
    backdrop-filter: blur(10px);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 50px;
}

.logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    color: #e50914;
    letter-spacing: 2px;
}

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

.nav-links a {
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

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

/* Download Button */
.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: linear-gradient(90deg, #3ddc84 0%, #2da565 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(61,220,132,0.4);
}

.download-btn i {
    font-size: 16px;
}

.nav-btn {
    color: #fff;
    font-size: 20px;
    transition: transform 0.2s;
}

.nav-btn:hover {
    transform: scale(1.1);
}

.menu-toggle {
    display: none;
}

.profile-img {
    width: 35px;
    height: 35px;
    border-radius: 5px;
}

/* ============ MOBILE MENU ============ */
.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    z-index: 200;
    padding: 25px;
    transition: left 0.3s ease;
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

.mobile-menu-top button {
    color: #fff;
    font-size: 26px;
}

.mobile-menu ul {
    list-style: none;
}

.mobile-menu li {
    margin-bottom: 8px;
}

.menu-divider {
    height: 1px;
    background: #333;
    margin: 20px 0;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: #aaa;
    font-size: 16px;
    border-radius: 10px;
    transition: all 0.2s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background: linear-gradient(90deg, #e50914 0%, #b20710 100%);
    color: #fff;
}

.mobile-menu a i {
    width: 24px;
    font-size: 18px;
}

.download-link {
    background: linear-gradient(90deg, #3ddc84 0%, #2da565 100%) !important;
    color: #fff !important;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============ SEARCH MODAL ============ */
.search-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 200;
    padding: 30px;
    display: none;
    flex-direction: column;
}

.search-modal.active {
    display: flex;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 650px;
    margin: 60px auto 30px;
    width: 100%;
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 50px;
    padding: 12px 25px;
    transition: border-color 0.2s;
}

.search-wrapper:focus-within {
    border-color: #e50914;
}

.search-wrapper i {
    color: #666;
    font-size: 20px;
}

.search-wrapper input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 18px;
}

.search-wrapper button {
    color: #888;
    font-size: 22px;
    transition: color 0.2s;
}

.search-wrapper button:hover {
    color: #fff;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 0;
}

/* ============ HERO ============ */
.hero {
    position: relative;
    height: 85vh;
    min-height: 550px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 120px;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.hero-bg.fade-out {
    opacity: 0;
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(0deg, #0a0a0a 0%, transparent 50%),
        linear-gradient(90deg, rgba(10,10,10,0.95) 0%, transparent 60%);
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 0 50px;
    max-width: 650px;
}

.hero-content > * {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

.hero-content.fade-out > * {
    opacity: 0;
    transform: translateY(20px);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, #e50914 0%, #b20710 100%);
    padding: 6px 15px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 18px;
}

.hero h1 {
    font-size: 52px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 18px;
    text-shadow: 2px 4px 20px rgba(0,0,0,0.8);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 15px;
    margin-bottom: 18px;
}

.green {
    color: #46d369;
    font-weight: 600;
}

.green i {
    color: #ffd700;
    margin-right: 5px;
}

.badge {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.hero-desc {
    font-size: 16px;
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-btns {
    display: flex;
    gap: 15px;
}

.btn-play {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 35px;
    background: #fff;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px;
    transition: all 0.2s;
}

.btn-play:hover {
    background: #e5e5e5;
    transform: scale(1.02);
}

.btn-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 35px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
}

.btn-info:hover {
    background: rgba(255,255,255,0.3);
}

/* ============ MAIN CONTENT ============ */
.main-content {
    position: relative;
    z-index: 20;
    margin-top: -100px;
    padding-bottom: 50px;
}

.content-section {
    padding: 0 50px;
    margin-bottom: 45px;
}

#continueSection {
    display: none;
}

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

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: #e50914;
    font-size: 20px;
}

.see-all-btn {
    color: #888;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.2s;
}

.see-all-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ============ CONTENT ROW WITH SCROLL ARROWS ============ */
.row-wrapper {
    position: relative;
}

.content-row {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 15px 0;
    scrollbar-width: none;
    scroll-behavior: smooth;
}

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

.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 100%;
    max-height: 320px;
    background: rgba(10,10,10,0.8);
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}

.row-wrapper:hover .scroll-arrow {
    opacity: 1;
}

.scroll-arrow:hover {
    background: rgba(10,10,10,0.95);
}

.scroll-arrow.left {
    left: 0;
    border-radius: 0 5px 5px 0;
}

.scroll-arrow.right {
    right: 0;
    border-radius: 5px 0 0 5px;
}

/* ============ TOP 5 RANKING CARDS - IMPROVED ============ */
.top-5-row {
    gap: 35px;
}

.top-5-card {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    cursor: pointer;
    transition: transform 0.3s;
    position: relative;
}

.top-5-card:hover {
    transform: scale(1.05);
    z-index: 5;
}

.rank-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 240px;
    font-weight: 900;
    line-height: 0.75;
    color: transparent;
    -webkit-text-stroke: 3px #2a2a2a;
    margin-right: -35px;
    z-index: 1;
    text-shadow: 0 0 40px rgba(0,0,0,0.9);
    position: relative;
}

.top-5-card:nth-child(1) .rank-number {
    background: linear-gradient(180deg, #ffd700 0%, #ff8c00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 2px #b8860b;
    filter: drop-shadow(0 0 15px rgba(255,215,0,0.5));
}

.top-5-card:nth-child(2) .rank-number {
    background: linear-gradient(180deg, #e8e8e8 0%, #9a9a9a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 2px #707070;
    filter: drop-shadow(0 0 15px rgba(192,192,192,0.4));
}

.top-5-card:nth-child(3) .rank-number {
    background: linear-gradient(180deg, #d4915d 0%, #8b4513 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 2px #6b3410;
    filter: drop-shadow(0 0 15px rgba(205,127,50,0.4));
}

.top-5-poster {
    width: 180px;
    height: 270px;
    object-fit: cover;
    border-radius: 10px;
    z-index: 2;
    box-shadow: 0 15px 40px rgba(0,0,0,0.7);
    position: relative;
}

/* ============ REGULAR CARDS ============ */
.card {
    flex-shrink: 0;
    width: 200px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: scale(1.08);
    z-index: 10;
}

.card-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    background: #1a1a1a;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

.card-info {
    padding: 12px 5px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #888;
}

.card-rating {
    color: #46d369;
    font-weight: 600;
}

.card-type {
    background: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.card-progress {
    height: 4px;
    background: #333;
    border-radius: 0 0 8px 8px;
    margin-top: -4px;
    overflow: hidden;
}

.card-progress-fill {
    height: 100%;
    background: #e50914;
}

.skeleton {
    flex-shrink: 0;
    width: 200px;
    height: 300px;
    background: linear-gradient(90deg, #1a1a1a 25%, #252525 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ SEE ALL MODAL ============ */
.see-all-modal {
    position: fixed;
    inset: 0;
    background: #0a0a0a;
    z-index: 200;
    display: none;
    flex-direction: column;
    overflow-y: auto;
}

.see-all-modal.active {
    display: flex;
}

.see-all-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 50px;
    background: #0a0a0a;
    border-bottom: 1px solid #1a1a1a;
    z-index: 10;
}

.see-all-header h2 {
    font-size: 28px;
}

.see-all-header button {
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 22px;
    border-radius: 50%;
    transition: all 0.2s;
}

.see-all-header button:hover {
    background: #e50914;
    transform: rotate(90deg);
}

.see-all-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    padding: 35px 50px 60px;
}

.see-all-card {
    cursor: pointer;
    transition: transform 0.3s;
}

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

.see-all-card img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
    background: #1a1a1a;
}

.see-all-card-info {
    padding: 12px 5px;
}

.see-all-card-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.see-all-card-meta {
    font-size: 12px;
    color: #888;
}

/* ============ DETAIL MODAL ============ */
.detail-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 30px;
    overflow-y: auto;
}

.detail-modal.active {
    display: flex;
}

.detail-box {
    background: #181818;
    border-radius: 12px;
    max-width: 850px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.detail-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 20px;
    border-radius: 50%;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.detail-close:hover {
    background: #e50914;
    transform: rotate(90deg);
}

.detail-banner {
    width: 100%;
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.detail-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(transparent, #181818);
}

.detail-info {
    padding: 25px 35px 35px;
    margin-top: -50px;
    position: relative;
}

.detail-info h1 {
    font-size: 32px;
    margin-bottom: 12px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 18px;
    font-size: 15px;
}

.detail-info > p {
    color: #b3b3b3;
    line-height: 1.7;
    margin-bottom: 18px;
    font-size: 15px;
}

.detail-genres {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.detail-genres span {
    color: #fff;
}

.detail-btns {
    display: flex;
    gap: 15px;
}

/* ============ FOOTER ============ */
.footer {
    padding: 60px 50px;
    text-align: center;
    border-top: 1px solid #1a1a1a;
}

.footer-logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    color: #e50914;
    margin-bottom: 20px;
}

.footer-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 30px;
    background: linear-gradient(90deg, #3ddc84 0%, #2da565 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 50px;
    margin-bottom: 25px;
    transition: all 0.3s;
}

.footer-download:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 25px rgba(61,220,132,0.4);
}

.footer-download i {
    font-size: 20px;
}

.footer p {
    color: #555;
    font-size: 14px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .navbar { padding: 15px 30px; }
    .hero-content { padding: 0 30px; }
    .content-section { padding: 0 30px; }
    .see-all-header, .see-all-grid { padding-left: 30px; padding-right: 30px; }
}

@media (max-width: 768px) {
    .nav-links, .profile-img, .download-btn { display: none; }
    .menu-toggle { display: block; }
    .navbar { padding: 12px 20px; }
    .logo { font-size: 26px; }
    
    .popup-box { padding: 30px 25px; max-width: 95%; }
    .popup-icon { width: 60px; height: 60px; font-size: 24px; }
    .popup-box h2 { font-size: 22px; }
    .popup-instructions { padding: 15px; }
    .instruction-item { padding: 10px 0; }
    .instruction-item i.fab { font-size: 20px; width: 25px; }
    .instruction-item span { font-size: 13px; }
    .popup-btn { padding: 12px 30px; font-size: 14px; }
    
    .hero { height: 65vh; min-height: 450px; padding-bottom: 80px; }
    .hero-content { padding: 0 20px; max-width: 100%; }
    .hero h1 { font-size: 30px; }
    .hero-meta { font-size: 13px; }
    .hero-desc { display: none; }
    .btn-play, .btn-info { padding: 12px 22px; font-size: 14px; }
    
    .main-content { margin-top: -60px; }
    .content-section { padding: 0 15px; margin-bottom: 35px; }
    .section-header h2 { font-size: 18px; }
    .section-header h2 i { font-size: 16px; }
    
    .card { width: 150px; }
    .card-img { height: 225px; }
    .card-title { font-size: 13px; }
    .skeleton { width: 150px; height: 225px; }
    
    .rank-number { font-size: 150px; margin-right: -20px; -webkit-text-stroke: 2px #2a2a2a; }
    .top-5-poster { width: 120px; height: 180px; }
    .top-5-row { gap: 25px; }
    
    .scroll-arrow { display: none; }
    
    .see-all-header { padding: 18px 20px; }
    .see-all-header h2 { font-size: 22px; }
    .see-all-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; padding: 25px 15px 40px; }
    
    .detail-modal { padding: 15px; }
    .detail-banner { height: 220px; }
    .detail-info { padding: 20px; }
    .detail-info h1 { font-size: 24px; }
    .detail-btns { flex-direction: column; }
    
    .footer { padding: 40px 20px; }
}

@media (max-width: 480px) {
    .card { width: 130px; }
    .card-img { height: 195px; }
    .skeleton { width: 130px; height: 195px; }
    
    .rank-number { font-size: 120px; margin-right: -15px; }
    .top-5-poster { width: 100px; height: 150px; }
    .top-5-row { gap: 20px; }
    
    .see-all-grid { grid-template-columns: repeat(2, 1fr); }
    
    .instruction-item { flex-direction: column; text-align: center; gap: 8px; }
    .instruction-item i.fab { margin: 0 auto; }
}
