:root {
    --bg-main: #07090a; /* Very deep dark, like Bawea */
    --bg-secondary: #121418;
    --bg-glass: rgba(18, 20, 24, 0.7);
    --accent: #f5b50a; /* Premium Gold */
    --accent-hover: #d49a05;
    --text-main: #ffffff;
    --text-muted: #a0a5ab;
    --border-color: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Cairo', sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1a1608 0%, #07090a 40%, #030405 100%);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ================= Splash Screen ================= */
.splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.splash-content {
    text-align: center;
    animation: zoomIn 1s ease forwards;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 30px rgba(245, 181, 10, 0.3);
}

.splash-title {
    font-size: 2.5rem;
    font-family: 'Cairo', sans-serif;
    color: var(--accent);
    letter-spacing: 2px;
}

.splash-slogan {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 10px;
    letter-spacing: 1px;
}

.loader-line {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.1);
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-line::after {
    content: '';
    position: absolute;
    top: 0; left: 0; height: 100%;
    width: 40%;
    background: var(--accent);
    animation: loading 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 30px rgba(245, 181, 10, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 50px rgba(245, 181, 10, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 30px rgba(245, 181, 10, 0.3); }
}
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes loading {
    0% { left: -40%; }
    100% { left: 100%; }
}

/* ================= Layout ================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ================= Sidebar ================= */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100vh;
    background: rgba(10, 12, 15, 0.6);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid rgba(255,255,255,0.05);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
}

/* Hide scrollbar for sidebar */
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo-link {
    display: block;
    text-align: center;
    margin-bottom: 15px;
}

.main-logo-large {
    width: 80%;
    max-width: 150px;
    border-radius: 15px;
    transition: transform 0.3s;
}

.main-logo-large:hover {
    transform: scale(1.05);
}

.sidebar-socials {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-socials a {
    color: var(--text-muted);
    font-size: 1.3rem;
    transition: all 0.3s;
    background: rgba(255,255,255,0.05);
    width: 35px; height: 35px;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
}

.sidebar-socials a:hover {
    color: var(--accent);
    background: rgba(245, 181, 10, 0.1);
    transform: translateY(-3px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-heading {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 700;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s ease;
}

.nav-link i {
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

.nav-link:hover, .nav-link.active {
    background: rgba(245, 181, 10, 0.1);
    color: var(--accent);
}

.nav-link.active {
    border-right: 4px solid var(--accent);
}

/* ================= Main Content ================= */
.main-content {
    flex: 1;
    margin-right: 260px; /* Offset for sidebar */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================= Header ================= */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    position: sticky;
    top: 0;
    background: linear-gradient(to bottom, rgba(7,9,10,0.9) 0%, transparent 100%);
    z-index: 50;
}

.search-container {
    position: relative;
    width: 400px;
}

.search-container input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border-radius: 25px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-container input:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.05);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s;
}

.notification-icon:hover { color: var(--accent); }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-size: 1.2rem;
    cursor: pointer;
}

/* ================= Hero Slider ================= */
.hero-slider-container {
    position: relative;
    margin: -80px 0 40px 0; /* Pull up under header */
    height: 60vh;
    min-height: 450px;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    align-items: flex-end;
    padding: 60px 40px;
    background-size: cover;
    background-position: center;
}

.hero-slide.active {
    opacity: 1;
    z-index: 10;
}

.hero-slide::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, var(--bg-main) 0%, rgba(7,9,10,0.5) 50%, transparent 100%),
                linear-gradient(to left, var(--bg-main) 0%, transparent 50%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    animation: slideUp 0.8s ease forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-content h1 {
    font-size: 3.5rem;
    font-family: 'Cairo', sans-serif;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hero-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--text-muted);
}

.hero-meta span {
    background: rgba(255,255,255,0.1);
    padding: 3px 10px;
    border-radius: 5px;
    backdrop-filter: blur(5px);
}

.hero-desc {
    font-size: 1.1rem;
    color: #ddd;
    line-height: 1.6;
    margin-bottom: 30px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.btn-play {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(245, 181, 10, 0.4);
}

.btn-play:hover {
    transform: scale(1.05);
    background: var(--accent-hover);
}

.btn-more {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-more:hover {
    background: rgba(255,255,255,0.2);
}

/* ================= Horizontal Rows (Netflix Style) ================= */
.row-section {
    margin-bottom: 40px;
    padding-right: 40px; /* Aligned with hero */
}

.row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-left: 40px;
}

.row-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.row-header h2 i {
    color: var(--accent);
}

.row-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    padding-left: 40px; /* Keep padding for last item shadow */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

/* Hide scrollbar */
.row-container::-webkit-scrollbar { display: none; }

.movie-card {
    flex: 0 0 200px; /* Fixed width for horizontal scrolling */
    scroll-snap-align: start;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: var(--bg-secondary);
}

.movie-card:hover {
    transform: scale(1.05) translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
    z-index: 5;
}

.movie-card img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.card-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.movie-card:hover .card-overlay {
    opacity: 1;
}

.play-icon-overlay {
    width: 60px;
    height: 60px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-size: 1.5rem;
    margin-bottom: 15px;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.movie-card:hover .play-icon-overlay {
    transform: scale(1);
}

.card-title {
    font-weight: 700;
    text-align: center;
    padding: 0 10px;
    font-size: 1.1rem;
}

.card-rating {
    margin-top: 10px;
    color: var(--accent);
    font-weight: bold;
}

/* ================= Player View ================= */
#player-view {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

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

.back-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.1);
}

.fav-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.fav-btn:hover { background: rgba(255,255,255,0.1); }
.fav-btn.active { color: #000; background: var(--accent); border-color: var(--accent); }

/* --- 70/30 Player Details Layout --- */
.player-details-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.player-main-col {
    flex: 7; /* 70% width */
    min-width: 0; /* Prevents flex items from overflowing */
}

.player-info-panel {
    flex: 3; /* 30% width */
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    backdrop-filter: blur(15px);
}

.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.info-panel-header h2 {
    font-size: 1.8rem;
    font-family: 'Cairo', sans-serif;
    line-height: 1.3;
}

.info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.info-meta span {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.rating-badge { background: rgba(245, 181, 10, 0.15); color: var(--accent); }
.year-badge { background: rgba(255,255,255,0.1); color: #fff; }
.runtime-badge { background: rgba(255,255,255,0.1); color: #ccc; }

.info-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.info-genres span {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
}

.story-heading {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.info-overview {
    color: #bbb;
    line-height: 1.8;
    font-size: 1rem;
}

@media (max-width: 1024px) {
    .player-details-layout {
        flex-direction: column;
    }
    .player-info-panel {
        width: 100%;
    }
}

.player-wrapper {
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.artplayer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
}

.player-loader {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--accent);
    z-index: 10;
}

.artplayer-app {
    width: 100%;
    height: 100%;
}

.tv-controls {
    padding: 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.season-selector select {
    background: var(--bg-main);
    color: #fff;
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    outline: none;
    width: 200px;
}

.episodes-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-top: 15px;
    padding-bottom: 10px;
}

.episodes-container::-webkit-scrollbar { height: 8px; }
.episodes-container::-webkit-scrollbar-track { background: var(--bg-main); border-radius: 4px; }
.episodes-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

.ep-btn {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.ep-btn:hover { background: rgba(255,255,255,0.1); }
.ep-btn.active { background: var(--accent); color: #000; font-weight: bold; border-color: var(--accent); }

/* ================= Pagination Controls ================= */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.page-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.page-btn:hover {
    background: rgba(255,255,255,0.1);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

/* ================= Footer ================= */
footer {
    margin-top: auto;
    padding: 40px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.social-links {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.social-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.social-links a:hover { color: var(--accent); }

/* ================= Mobile Responsiveness ================= */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-right: 0;
    }
    
    /* Need a hamburger menu for mobile - will add via JS if needed, or keep simple for now */
    .top-header {
        padding: 15px 20px;
    }
    
    .search-container { width: 100%; max-width: 250px; }
    
    .hero-content h1 { font-size: 2.2rem; }
}

/* PWA Install Prompt */
.ios-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: center;
    color: white;
}
.ios-prompt-content { position: relative; }
.close-prompt {
    position: absolute;
    top: -10px;
    right: -10px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
}
.prompt-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 10px;
}
.ios-prompt-content h3 { margin: 0 0 10px 0; font-size: 1.1rem; color: #d32f2f; }
.ios-prompt-content p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: #ccc; }
.ios-prompt-content p i { color: #fff; margin: 0 4px; }

/* Hero Slider Fixes */
.hero-slider-container {
    height: 60vh !important;
    min-height: 400px !important;
    max-height: 600px !important;
}
.hero-slide {
    background-size: cover;
    background-position: top center;
}
@media (max-width: 768px) {
    .hero-slider-container {
        height: 45vh !important;
        min-height: 300px !important;
    }
}


/* ================= Mobile PWA Redesign ================= */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
    padding: 10px 0 15px 0; /* Extra padding for iOS home indicator */
    justify-content: space-around;
}
.bottom-nav-item {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    gap: 4px;
    transition: 0.3s ease;
}
.bottom-nav-item i { font-size: 1.2rem; }
.bottom-nav-item.active { color: var(--primary-color); }

@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .main-content { margin-right: 0 !important; padding-bottom: 70px !important; }
    .bottom-nav { display: flex !important; }
    .top-header {
        padding: 10px !important;
        background: rgba(0,0,0,0.8);
        backdrop-filter: blur(10px);
        width: 100%;
        box-sizing: border-box;
    }
    .search-container {
        width: 100%;
    }
    .search-container input {
        width: 100% !important;
        background: rgba(255,255,255,0.1);
        border: 1px solid rgba(255,255,255,0.2);
    }
    .hero-slider-container {
        height: 50vh !important;
        min-height: auto !important;
        margin-top: 60px; /* Space for search header */
    }
    .hero-content h1 { font-size: 1.8rem; }
    .movie-card { min-width: 130px; }
}


/* ================= View All Button ================= */
.view-all-btn {
    background: rgba(245, 181, 10, 0.1);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Plus Jakarta Sans', 'IBM Plex Sans Arabic', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}
.view-all-btn:hover {
    background: var(--primary-color);
    color: #000;
}
@media (max-width: 768px) {
    .row-header {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    .view-all-btn {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
}

/* ================= Multi-Servers ================= */
#servers-list-container {
    background: rgba(20,20,20,0.8);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}
.server-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}
.server-btn:hover {
    background: rgba(255,255,255,0.15);
}
.server-btn.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    font-weight: bold;
}
