/* =========================================
   1. CORE VARIABLES & SETUP
   ========================================= */
:root {
    --bg-color: #0f0f0f;
    --surface-color: #212121;
    --text-primary: #f1f1f1;
    --text-secondary: #aaaaaa;
    --border-color: #3f3f3f;
    --hover-color: #3d3d3d;
    --yv-red: #ffffff; /* Corrected to white per custom request */
}

body {
    margin: 0; padding: 0; 
    background-color: var(--bg-color);
    color: var(--text-primary); 
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    overflow-x: hidden; 
}

/* =========================================
   2. YOUTUBE-STYLE NAVIGATION BAR
   ========================================= */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 16px; height: 56px; 
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: fixed; top: 0; width: 100%; z-index: 1000; box-sizing: border-box;
    gap: 16px;
}

.nav-left { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.hamburger { background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 8px; border-radius: 50%; }
.hamburger:hover { background-color: var(--surface-color); }

.yv-logo {
    width: 36px; height: 36px; background-color: var(--yv-red); color: #000000;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 18px; border-radius: 4px; letter-spacing: -0.5px; cursor: pointer;
}

.nav-center { flex: 1; max-width: 600px; display: flex; align-items: center; }
.nav-spacer { width: 92px; flex-shrink: 0; } 

.search-box {
    display: flex; width: 100%; height: 40px; background-color: var(--bg-color);
    border: 1px solid var(--border-color); border-radius: 40px; overflow: hidden;
}
.search-box input { flex: 1; background: none; border: none; color: var(--text-primary); padding: 0 16px; font-size: 16px; outline: none; }
.search-btn { width: 64px; background-color: var(--surface-color); border: none; border-left: 1px solid var(--border-color); color: var(--text-primary); cursor: pointer; }
.search-btn:hover { background-color: var(--hover-color); }

/* =========================================
   3. SIDEBAR DRAWER
   ========================================= */
.main-layout { display: flex; margin-top: 56px; min-height: calc(100vh - 56px); }

.sidebar {
    position: fixed !important; top: 56px !important; left: -300px !important; 
    width: 240px !important; height: calc(100vh - 56px) !important;
    background-color: var(--bg-color) !important; z-index: 999 !important; 
    transition: left 0.3s ease-in-out !important; padding: 12px !important;
    box-sizing: border-box !important; overflow-y: auto;
}
.sidebar.open { left: 0 !important; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background-color: transparent; border-radius: 4px; }
.sidebar:hover::-webkit-scrollbar-thumb { background-color: var(--border-color); }

.sidebar-link { display: flex; align-items: center; gap: 16px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; margin-bottom: 4px; }
.sidebar-link .icon { font-size: 20px; min-width: 24px; text-align: center; }
.sidebar-link:hover, .sidebar-link.active { background-color: var(--surface-color); }
.divider { border: 0; border-top: 1px solid var(--border-color); margin: 12px 0; }
.sidebar-title { padding: 8px 12px; font-size: 16px; font-weight: bold; }

.sidebar-overlay {
    display: none; position: fixed; top: 56px; left: 0; width: 100%; height: calc(100vh - 56px);
    background: rgba(0, 0, 0, 0.7); z-index: 900; 
}
.sidebar-overlay.active { display: block; }

/* =========================================
   4. MAIN CONTENT AREA & CHIPS
   ========================================= */
.content {
    margin-left: 0 !important; width: 100% !important; padding: 24px;
    background-color: var(--bg-color); box-sizing: border-box !important;
}

.filter-chips { display: flex; gap: 12px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { background-color: var(--surface-color); padding: 6px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background-color 0.2s; }
.chip:hover { background-color: var(--hover-color); }
.chip.active { background-color: #ffffff; color: #000000; }

.section-title { font-size: 20px; font-weight: 700; margin: 24px 0 16px 0; color: var(--text-primary); }
.horizontal-scroll { display: flex; overflow-x: auto; gap: 16px; padding-bottom: 16px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.horizontal-scroll::-webkit-scrollbar { display: none; }

/* =========================================
   5. CHANNELS ROW & PERFECT CIRCLES
   ========================================= */
.channel-circle { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; min-width: 72px; }
.channel-circle .avatar { 
    width: 64px; height: 64px; border-radius: 50%; background-color: var(--surface-color); 
    display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: bold; 
    border: 2px solid transparent; transition: border-color 0.2s ease, transform 0.2s ease;
    overflow: hidden; 
}
.channel-circle .avatar img { width: 100%; height: 100%; object-fit: cover; }
.channel-circle:hover .avatar { border-color: #ffffff; transform: scale(1.05); }
.channel-name-small { font-size: 12px; color: var(--text-secondary); text-align: center; white-space: nowrap; }

/* =========================================
   6. YOUTUBE VIDEO GRID & CARDS
   ========================================= */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; row-gap: 40px; }
.video-card { cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: opacity 0.2s; }
.video-card:hover { opacity: 0.9; }

.thumbnail-container { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background-color: var(--surface-color); }
.thumbnail { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.video-card:hover .thumbnail { transform: scale(1.02); }

.video-details { display: flex; gap: 12px; align-items: flex-start; }
.channel-avatar-small { width: 36px; height: 36px; border-radius: 50%; background-color: #444; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: bold; flex-shrink: 0; margin-top: 4px; }
.video-info { display: flex; flex-direction: column; }
.video-title { margin: 0 0 4px 0; font-size: 16px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.channel-name { margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.4; }

/* =========================================
   7. DEDICATED WATCH PAGE LAYOUT
   ========================================= */
.watch-layout { display: flex; gap: 24px; max-width: 1600px; margin: 0 auto; }
.watch-primary { flex: 1; min-width: 0; }
.watch-secondary { width: 400px; flex-shrink: 0; }
.related-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.player-wrapper {
    width: 100%; aspect-ratio: 16 / 9; background-color: #000; 
    border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: flex;
}
.player-wrapper iframe { width: 100%; height: 100%; border: none; }

.watch-info { padding: 16px 0; border-bottom: 1px solid var(--border-color); margin-bottom: 24px; }
#movieTitle { font-size: 20px; font-weight: 700; margin: 0 0 12px 0; color: var(--text-primary); line-height: 1.3; }

.primary-info-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.channel-block { display: flex; align-items: center; gap: 12px; }
.channel-avatar { width: 40px; height: 40px; border-radius: 50%; background-color: #444; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: bold; }
.channel-text { display: flex; flex-direction: column; }
#movieChannel { font-size: 16px; font-weight: 600; margin: 0; }
.sub-count { font-size: 12px; color: var(--text-secondary); margin: 0; }
.subscribe-btn { background-color: var(--text-primary); color: var(--bg-color); border: none; border-radius: 20px; padding: 10px 16px; font-weight: 600; font-size: 14px; cursor: pointer; margin-left: 12px; transition: opacity 0.2s; }
.subscribe-btn:hover { opacity: 0.8; }

.action-buttons { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.action-buttons::-webkit-scrollbar { display: none; }
.action-pill { background-color: var(--surface-color); border-radius: 20px; display: flex; align-items: center; overflow: hidden; }
.action-btn { background: none; border: none; color: var(--text-primary); padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background-color 0.2s; }
.action-btn:hover { background-color: var(--hover-color); }
.border-right { border-right: 1px solid var(--border-color); }

.description-box { background-color: var(--surface-color); border-radius: 12px; padding: 16px; font-size: 14px; line-height: 1.5; color: #f1f1f1; }

/* =========================================
   8. WELCOME POPUP MODAL
   ========================================= */
.welcome-overlay {
    display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.80); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 999999; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.welcome-overlay.show { opacity: 1; pointer-events: auto; }

.welcome-box {
    background-color: var(--surface-color); border: 1px solid var(--border-color);
    padding: 32px 24px; border-radius: 20px; text-align: center; max-width: 360px; width: 85%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8); transform: translateY(20px); transition: transform 0.3s ease;
}
.welcome-overlay.show .welcome-box { transform: translateY(0); }
.welcome-box h2 { margin-top: 0; color: var(--text-primary); font-size: 24px; margin-bottom: 12px; }
.welcome-box p { color: var(--text-secondary); line-height: 1.5; margin-bottom: 24px; font-size: 15px; }
.welcome-box p strong { color: #ffffff; }

.welcome-btn {
    background-color: var(--text-primary); color: #000000; border: none; border-radius: 30px;
    padding: 14px 24px; font-size: 16px; font-weight: bold; cursor: pointer; 
    transition: opacity 0.2s, transform 0.1s; width: 100%;
}
.welcome-btn:hover { opacity: 0.9; }

/* =========================================
   9. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 1024px) {
    .watch-layout { flex-direction: column; }
    .watch-secondary { width: 100%; }
}

@media (max-width: 768px) {
    .nav-spacer { display: none; }
    .search-btn { width: 50px; }
    .search-box input { padding: 0 12px; font-size: 14px; }
    .content { padding: 16px !important; }
    .video-grid { grid-template-columns: 1fr; row-gap: 24px; }
    
    .player-wrapper { border-radius: 0; width: 100vw; margin-left: -16px; aspect-ratio: 16 / 9; }
    .watch-info { padding: 12px 0; }
    #movieTitle { font-size: 18px; line-height: 1.4; margin-bottom: 8px; }
    .primary-info-row { flex-direction: column; align-items: flex-start; }
    .action-buttons { width: 100vw; padding: 0 16px; margin-left: -16px; }
}
