:root {
    --primary: #0d253f; --secondary: #01b4e4; --tertiary: #90cea1; --accent: #E53935;
    --light: #f8f9fa; --dark-bg: #0a1a2d; --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2); --lux-text: #F0F0F0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { 
    scroll-behavior: smooth; 
    background-color: var(--primary); /* Prevents white flash on overscroll */
}
body { font-family: 'Roboto', sans-serif; background: linear-gradient(135deg, #0a1a2d, #0d253f); color: var(--light); min-height: 100vh; overflow-x: hidden; line-height: 1.6; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

header { background: linear-gradient(to right, var(--primary), #081624); color: white; padding: 1.2rem 0; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); position: sticky; top: 0; z-index: 1000; border-bottom: 2px solid rgba(229, 57, 53, 0.3); }
.header-container { display: flex; align-items: center; justify-content: space-between; }
.logo-container { cursor: pointer; z-index: 1001; }
.logo { font-family: 'Arial', sans-serif; font-size: 2.5rem; font-weight: bold; background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000); background-size: 400%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: glowing-text 15s linear infinite; }
@keyframes glowing-text { 0% { background-position: 0 0; } 50% { background-position: 400% 0; } 100% { background-position: 0 0; } }

.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-buttons { display: flex; gap: 10px; }
.nav-btn { background: rgba(255, 255, 255, 0.1); color: white; border: none; padding: 8px 20px; border-radius: 20px; cursor: pointer; transition: all 0.3s; font-weight: 500; font-size: 0.95rem; }
.nav-btn.active { background: var(--accent); }
.header-right { display: flex; align-items: center; gap: 15px; }
.auth-button { background: var(--tertiary); color: var(--primary); border: none; padding: 8px 18px; border-radius: 20px; font-weight: 700; cursor: pointer; transition: all 0.3s; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--secondary); display: flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; }
.hamburger { display: none; font-size: 1.8rem; cursor: pointer; z-index: 1001; }

.recent-slider-container { position: relative; width: 100%; height: 60vh; max-height: 550px; margin-bottom: 20px; overflow: hidden; }
.slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; background-size: cover; background-position: center; }
.slide.active { opacity: 1; z-index: 1; }
.slide-content { position: absolute; bottom: 15%; left: 5%; max-width: 50%; color: #fff; z-index: 2; padding: 20px; background: rgba(0,0,0,0.5); border-radius: 10px; backdrop-filter: blur(5px); }
.slide-title { font-size: 2.5rem; font-weight: 900; margin-bottom: 10px; text-shadow: 2px 2px 8px rgba(0,0,0,0.8); }
.slide-overview { font-size: 1rem; margin-bottom: 20px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.watch-now-btn { background: var(--accent); color: white; padding: 12px 25px; border: none; border-radius: 25px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; }
.watch-now-btn:hover { background: #c4302b; transform: scale(1.05); }
.slider-nav { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0,0,0,0.5); color: white; border: none; font-size: 2rem; padding: 10px 15px; cursor: pointer; z-index: 3; transition: background-color 0.3s; border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; }
.slider-nav:hover { background-color: rgba(0,0,0,0.8); }
.slider-nav.prev { left: 20px; }
.slider-nav.next { right: 20px; }
.slider-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 3; display: flex; gap: 10px; }
.dot { width: 12px; height: 12px; background-color: rgba(255,255,255,0.5); border-radius: 50%; cursor: pointer; transition: background-color 0.3s; }
.dot.active { background-color: white; transform: scale(1.2); }

.platforms-container { position: relative; width: 100vw; max-width: 100vw; margin-left: calc(-50vw + 50%); }
.streaming-platforms { background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05)); backdrop-filter: blur(10px); padding: 15px 50px; display: flex; gap: 25px; align-items: center; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; scroll-behavior: smooth; }
.streaming-platforms::-webkit-scrollbar { display: none; }
.platform-logo { width: 85px; height: 85px; min-width: 85px; border-radius: 50%; cursor: pointer; transition: all 0.3s ease; background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 15px; overflow: hidden; }
.platform-logo img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(50%) brightness(1.2); transition: all 0.3s ease; }
.platform-logo:hover { transform: translateY(-5px) scale(1.1); border-color: var(--tertiary); }
.platform-logo:hover img { filter: grayscale(0%) brightness(1); }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, 0.7); color: white; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; border: none; }
.prev-btn { left: 10px; } .next-btn { right: 10px; }

.main-search-container { display: flex; margin: 20px 0; width: 100%; }
.big-search-bar { position: relative; flex: 1; }
.big-search-input { width: 100%; padding: 22px 70px 22px 30px; border: 2px solid rgba(255,255,255,0.2); border-radius: 50px; background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05)); backdrop-filter: blur(10px); color: var(--light); font-size: 1.2rem; }
.big-search-button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, var(--tertiary), #7bbd8e); color: var(--primary); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.movie-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 25px; padding: 30px 0; }
.movie-card { background: var(--dark-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.5); transition: all 0.4s ease; cursor: pointer; position: relative; aspect-ratio: 2/3; }
.movie-card:hover { transform: translateY(-8px); box-shadow: 0 15px 30px rgba(0,0,0,0.7); }
.content-type-badge { position: absolute; top: 12px; left: 12px; background: var(--accent); color: white; padding: 5px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; z-index: 3; text-transform: uppercase; }
.movie-poster-container { width: 100%; height: 100%; }
.movie-poster { width: 100%; height: 100%; object-fit: cover; }
.movie-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 15px; background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 20%, transparent 100%); }
.movie-title { font-size: 1.1rem; font-weight: 700; color: white; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movie-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); }
.imdb-rating i { color: gold; }
.loading { text-align: center; padding: 40px; display: none; grid-column: 1 / -1; }
.loading-spinner { display: inline-block; width: 60px; height: 60px; border: 4px solid rgba(144, 206, 161, 0.3); border-radius: 50%; border-top-color: var(--tertiary); animation: spin 1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }        

.full-screen-page {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: linear-gradient(135deg, rgb(2, 6, 23), rgb(15, 23, 42)); 
    z-index: 10000; display: none; overflow-y: auto;
    -webkit-overflow-scrolling: touch; 
}
.full-screen-page.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.details-wrapper, .person-details-container { max-width: 1600px; margin: 0 auto; padding: 30px; }
.content-wrapper { display: flex; gap: 30px; align-items: flex-start; margin-bottom: 30px; }
.poster-container { position: relative; flex-shrink: 0; }
.poster-container img { width: 320px; height: 480px; border-radius: 20px; object-fit: cover; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.close-btn { position: absolute; top: 15px; right: 15px; width: 45px; height: 45px; background: rgba(255, 68, 68, 0.9); color: white; border: none; border-radius: 50%; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; z-index: 100; }
.movie-details { flex: 1; padding-left: 20px; }
#movieDetailsPage .movie-title, #personDetailsPage .person-name { font-size: 2.5rem; font-weight: 700; margin-bottom: 20px; color: white; }
.movie-overview { font-size: 1.1rem; line-height: 1.7; margin-bottom: 10px; color: rgba(255, 255, 255, 0.95); background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 15px; padding: 20px; }
.meta-section { margin-bottom: 30px; width: 100%; }
.meta-section h3 { color: var(--tertiary); margin-bottom: 20px; font-size: 1.5rem; border-bottom: 1px solid rgba(144, 206, 161, 0.3); padding-bottom: 10px; }

#personDetailsPage .person-info-header { display: flex; gap: 30px; margin-bottom: 40px; }
#personDetailsPage .person-info-header img { width: 250px; height: 375px; object-fit: cover; border-radius: 15px; }
#personDetailsPage .person-bio-data h3 { color: var(--tertiary); font-size: 1.4rem; margin: 15px 0; }

.video-player-wrapper { 
    position: relative; width: 100%; height: 0;
    padding-bottom: 56.25%; background: #000; border-radius: 12px; 
    overflow: hidden; margin-bottom: 20px; border: 3px solid var(--accent); 
    box-shadow: 0 0 25px rgba(229, 57, 53, 0.6); animation: player-glow 2s infinite alternate; 
}
@keyframes player-glow { from { box-shadow: 0 0 15px rgba(229, 57, 53, 0.4); } to { box-shadow: 0 0 35px rgba(229, 57, 53, 0.8); } }
.video-player-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.video-player-loading-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 5; }

.player-controls-panel { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 15px; padding: 20px; margin: 0 0 30px 0; }
.player-controls-top-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.player-controls-top-row .slider-toggle { display: flex; align-items: center; gap: 8px; background: rgba(13,37,63,0.7); border-radius: 20px; padding: 5px 12px; font-size: 14px; color: var(--lux-text); }
.lux-switch { position: relative; display: inline-block; width: 50px; height: 26px; margin-left: 10px; }
.lux-switch input { opacity: 0; width: 0; height: 0; }
.lux-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #2ecc71; transition: 0.4s; border-radius: 34px; }
.lux-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 3px; background-color: white; transition: 0.4s; border-radius: 50%; }
.lux-switch input:checked + .lux-slider { background-color: #e74c3c; }
.lux-switch input:checked + .lux-slider:before { transform: translateX(24px); }

#languageOptions { display: none; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--glass-border); }
#languageOptions h3 { color: var(--tertiary); margin-bottom: 10px; }
.lang-btn { background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: var(--light); padding: 10px 15px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 1rem; }
.lang-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.lang-btn.active { background: var(--tertiary); color: var(--primary); font-weight: 700; box-shadow: 0 0 15px rgba(144, 206, 161, 0.5); }
.lang-btn .flag-icon { font-size: 1.5rem; margin-right: 8px; }

.player-episodes-section { margin-bottom: 20px; display: none; }
.player-episodes-section.show { display: block; }
.player-episodes-selectors { display: flex; gap: 15px; flex-wrap: wrap; }
.player-episodes-selectors select { background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: var(--light); padding: 10px; border-radius: 8px; font-size: 14px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23F0F0F0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; padding-right: 35px; flex-grow: 1; }
.player-episodes-selectors select option { background-color: var(--primary); }

.player-server-list h3 { margin-top: 0; margin-bottom: 15px; color: var(--tertiary); }
#playerServerOptions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.server-option-btn { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: var(--light); padding: 10px 15px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 1rem; }
.server-option-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.server-option-btn.active { background: var(--tertiary); color: var(--primary); font-weight: 700; box-shadow: 0 0 15px rgba(144, 206, 161, 0.5); }

.movie-metadata { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 15px; margin: 15px 0 25px 0; }
.metadata-action-btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; }
.metadata-action-btn:hover { transform: translateY(-2px); }
.trailer-btn { background: linear-gradient(135deg, #ff6b6b, #ff5252); color: white; }
.trailer-btn.close-mode { background: linear-gradient(135deg, #6c757d, #495057); }
.download-btn { background: linear-gradient(135deg, var(--tertiary), var(--secondary)); color: white; }
.download-btn.disabled { background: #666; cursor: not-allowed; opacity: 0.7; }
.share-btn { background: linear-gradient(90deg, #7e0000, #008b1e); color: white; }

.edit-url-icon { position: absolute; bottom: 20px; right: 20px; background: rgba(13, 37, 63, 0.7); backdrop-filter: blur(5px); border: 1px solid var(--glass-border); color: white; border-radius: 50%; width: 45px; height: 45px; cursor: pointer; font-size: 18px; z-index: 50; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transform: scale(0.8); transition: opacity 0.3s ease, transform 0.3s ease; }
.edit-url-icon.show { opacity: 1; visibility: visible; transform: scale(1); }

.url-edit-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 11000; }
.url-edit-modal.active { display: flex; }
.url-edit-container { background: rgba(30, 41, 59, 0.95); border: 1px solid var(--glass-border); padding: 30px; border-radius: 20px; max-width: 600px; width: 90%; }
.url-edit-container h3 { margin-bottom: 10px; }
.url-input { width: 100%; padding: 12px; border-radius: 8px; margin-top: 5px; margin-bottom: 20px; background: rgba(255,255,255,0.1); color: white; border: 1px solid var(--glass-border); }
.url-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.url-save-btn, .url-cancel-btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; }
.url-save-btn { background: var(--tertiary); color: var(--primary); } .url-cancel-btn { background: #ff6b6b; color: white; }

.scroll-to-top-btn { position: fixed; bottom: 20px; right: 20px; width: 50px; height: 50px; background: var(--tertiary); color: var(--primary); border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; z-index: 9999; opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.3s; }
.scroll-to-top-btn.visible { opacity: 1; visibility: visible; transform: translateY(0); }

#toast-container { position: fixed; top: 80px; right: 20px; z-index: 12000; }
.toast { min-width: 250px; padding: 12px 20px; border-radius: 8px; color: white; box-shadow: 0 5px 15px rgba(0,0,0,0.3); opacity: 0; transform: translateX(100%); transition: all 0.4s; background: #333; margin-bottom: 10px; }
.toast.show { opacity: 1; transform: translateX(0); }

.auth-popup-wrapper { position: relative; }
.auth-popup { display: none; position: absolute; top: 120%; right: 0; background: var(--glass-bg); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); border-radius: 12px; padding: 20px; width: 300px; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.auth-popup.show { display: block; }
.auth-form input { width: 100%; padding: 10px; margin-bottom: 10px; border-radius: 6px; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.1); color: white; }
.auth-buttons { display: flex; gap: 10px; }
.auth-btn { flex: 1; padding: 10px; border: none; border-radius: 6px; cursor: pointer; background: var(--tertiary); color: var(--primary); font-weight: 700; }
#logoutBtn { background: var(--accent); color: white; }
.auth-toggle-link { text-align: center; margin-top: 15px; font-size: 0.9rem; }
.auth-toggle-link span { color: var(--tertiary); cursor: pointer; text-decoration: underline; }

.blocked-message {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: black; color: red;
    display: flex; justify-content: center; align-items: center;
    font-size: 2em; font-weight: bold; text-align: center;
    z-index: 999999;
}

@media (max-width: 768px) {
    .logo { font-size: 2rem; }
    .header-nav { position: fixed; top: 0; right: -100%; width: 70%; height: 100vh; background: var(--primary); flex-direction: column; align-items: center; justify-content: center; gap: 30px; transition: right 0.4s ease-in-out; }
    .header-nav.active { right: 0; box-shadow: -10px 0 30px rgba(0,0,0,0.5); }
    .nav-buttons { flex-direction: column; gap: 20px; text-align: center; }
    .nav-btn { font-size: 1.2rem; }
    .hamburger { display: block; }
    
    .recent-slider-container { height: 50vh; }
    .slide-content { max-width: 80%; left: 5%; bottom: 10%; }
    .slide-title { font-size: 1.8rem; }
    .slide-overview { display: none; }
    .watch-now-btn { padding: 10px 20px; font-size: 0.9rem; }
    .movie-container { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }

    .streaming-platforms {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .details-wrapper { padding: 15px; }
    .content-wrapper, #personDetailsPage .person-info-header { flex-direction: column; align-items: center; }
    .movie-details { padding-left: 0; width: 100%; }
    .poster-container img { width: 240px; height: 360px; }
    #movieDetailsPage .movie-title, #personDetailsPage .person-name { font-size: 1.8rem; text-align: center; }
    
    .player-controls-top-row { flex-direction: column; gap: 15px; }
    .player-controls-panel { padding: 15px; }
    #playerServerOptions { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .server-option-btn, .lang-btn { font-size: 0.9rem; padding: 8px 12px; }
    
    /* --- START: MOBILE AUTH POPUP FIX --- */
    .header-right { 
        flex-direction: column; 
        gap: 20px;
        width: 100%;
        padding: 0 20px;
    }
    .auth-popup-wrapper {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .auth-popup {
        position: static;
        width: 100%;
        max-width: 320px;
        margin-top: 15px;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .auth-form input {
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
    /* --- END: MOBILE AUTH POPUP FIX --- */
}