:root {
    --bg-color: #050505;
    --glass: rgba(30, 30, 35, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent: #00A4DC; /* The main Blue color */
    --text: #fff;
    --text-muted: #a0a0a0;
    --danger: #ff453a;
}

body {
    margin: 0; 
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at top, #1a202c 0%, #000 70%);
    color: var(--text); 
    min-height: 100vh;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* --- NAVIGATION --- */
#top-nav {
    display: flex; 
    justify-content: center; 
    padding: 20px 0;
    position: sticky; 
    top: 0; 
    z-index: 100;
    background: linear-gradient(to bottom, #000 0%, transparent 100%);
}

.pill-container {
    background: rgba(50,50,50,0.6); 
    backdrop-filter: blur(12px);
    border-radius: 50px; 
    padding: 5px; 
    display: flex; 
    gap: 5px;
    border: 1px solid var(--glass-border);
}

.nav-pill {
    padding: 8px 24px; 
    border-radius: 40px; 
    font-size: 14px;
    font-weight: 600; 
    cursor: pointer; 
    color: var(--text-muted);
    transition: 0.2s ease;
}

.nav-pill.active { background: rgba(255,255,255,0.15); color: white; }

/* --- PROFILE DROPDOWN --- */
.profile-wrapper { position: absolute; right: 20px; top: 20px; z-index: 200; }
.profile-icon {
    width: 35px; height: 35px; background: var(--accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; cursor: pointer;
}
#profile-dropdown {
    position: absolute; top: 45px; right: 0; width: 220px;
    background: #1a1a1a; border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 15px; display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
#profile-dropdown p { margin: 5px 0; font-size: 0.9rem; color: #ccc; }
#profile-dropdown button {
    width: 100%; margin-top: 10px; padding: 8px;
    background: var(--danger); border: none; border-radius: 6px; color: white; cursor: pointer;
}

/* --- MAIN LAYOUT --- */
#main-content { padding: 20px 40px; max-width: 1600px; margin: 0 auto; padding-bottom: 100px; }

/* Bigger Category Headers */
.section-header {
    font-size: 28px; 
    font-weight: 900; 
    margin: 40px 0 15px 0;
    display: flex; 
    justify-content: space-between; 
    align-items: flex-end;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    color: #fff;
}

.view-all-btn { 
    font-size: 0.85rem; 
    color: var(--accent); 
    cursor: pointer; 
    text-transform: uppercase; 
    font-weight: 700;
    letter-spacing: 1px;
}

/* --- SCROLL & GRIDS --- */
.h-scroll {
    display: flex; gap: 15px; overflow-x: auto; padding-bottom: 20px;
    scroll-behavior: smooth;
}
.h-scroll::-webkit-scrollbar { display: none; } 

.full-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
    gap: 15px;
}

/* --- VIDEO CARDS (Thumbnails) --- */
.video-card {
    flex: 0 0 140px; 
    position: relative; 
    border-radius: 12px; 
    overflow: hidden;
    aspect-ratio: 9/16; 
    background: #111; 
    transition: transform 0.2s ease; 
    cursor: pointer;
}
.video-card:hover { transform: scale(1.05); z-index: 10; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

.thumb-img { width: 100%; height: 100%; object-fit: cover; }
.progress-bar-card { position: absolute; bottom: 0; left: 0; height: 3px; background: var(--accent); z-index: 5; }

.card-title {
    position: absolute; bottom: 0; width: 100%; 
    padding: 40px 8px 10px 8px;
    background: linear-gradient(to top, black, transparent); 
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- REELS PLAYER UI --- */
#reels-modal {
    position: fixed; inset: 0; background: #000; z-index: 5000;
    display: none; flex-direction: column;
}

#reels-scroller {
    width: 100%; height: 100%; overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}
#reels-scroller::-webkit-scrollbar { display: none; }

.reel-slide {
    width: 100%; height: 100dvh; 
    scroll-snap-align: start;
    position: relative;
    background: #000;
    display: flex; align-items: center; justify-content: center;
}

/* Ensure landscape videos have black bars (contain) */
.reel-video { 
    width: 100%; height: 100%; 
    object-fit: contain; 
    cursor: pointer; 
    background: #000; 
}

/* --- CENTER PLAY ICON (PAUSE STATE) --- */
.center-state-icon {
    position: absolute; top: 50%; left: 50%; 
    transform: translate(-50%, -50%) scale(0.8);
    width: 80px; height: 80px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 15;
    opacity: 0; 
    transition: opacity 0.2s, transform 0.2s;
}
.center-state-icon svg { width: 40px; height: 40px; fill: white; margin-left: 4px; }

/* Show when paused */
.reel-slide.is-paused .center-state-icon { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* --- BUFFERING SPINNER --- */
.reel-loader {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 50px; height: 50px;
    border: 5px solid rgba(255,255,255,0.2); 
    border-top: 5px solid var(--accent);
    border-radius: 50%; 
    animation: spin 1s linear infinite;
    pointer-events: none; display: none; z-index: 10;
}
@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* --- SWIPE HINT ANIMATION --- */
.swipe-hint-overlay {
    position: absolute; inset: 0;
    display: none; /* Controlled by JS */
    flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 20;
    pointer-events: none;
    transition: opacity 0.5s ease;
    opacity: 0;
}
.swipe-hint-overlay.visible { opacity: 1; display: flex; }

.swipe-hint-icon {
    width: 60px; height: 60px; fill: white;
    animation: bounce 1.5s infinite;
    filter: drop-shadow(0 2px 10px black);
}
.swipe-hint-text {
    margin-top: 15px; font-weight: 800; font-size: 1.2rem;
    text-transform: uppercase; letter-spacing: 2px;
    text-shadow: 0 2px 10px black;
}
@keyframes bounce { 
    0%, 100% { transform: translateY(0); opacity: 0.6; } 
    50% { transform: translateY(-20px); opacity: 1; } 
}

/* --- REEL OVERLAYS --- */
#reel-cat-header {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 5010; font-weight: 800; font-size: 1rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    pointer-events: none; opacity: 0.8;
    background: rgba(0,0,0,0.3); padding: 5px 15px; border-radius: 20px;
    backdrop-filter: blur(5px);
}

#reel-close-btn {
    position: absolute; top: 20px; left: 20px; z-index: 5010;
    background: var(--accent);
    color: white; border: none;
    padding: 10px 20px; border-radius: 30px;
    font-weight: 700; font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 164, 220, 0.4);
    transition: transform 0.2s;
}
#reel-close-btn:active { transform: scale(0.95); }

/* Bottom Content Area */
.reel-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 150px 20px 20px 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
    pointer-events: none; 
}

.reel-info { margin-bottom: 25px; pointer-events: auto; }
.reel-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 5px; text-shadow: 0 2px 5px black; line-height: 1.2; }
.reel-meta { font-size: 0.95rem; color: #ddd; font-weight: 500; text-shadow: 0 1px 3px black;}

/* Side Controls */
.reel-side-bar {
    position: absolute; right: 10px; bottom: 100px;
    display: flex; flex-direction: column; gap: 25px;
    pointer-events: auto;
}
.reel-icon-btn {
    background: none; border: none; color: white;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    transition: 0.2s;
}
.reel-icon-btn svg { width: 34px; height: 34px; fill: white; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); transition: 0.2s; }
.reel-icon-btn span { font-size: 11px; margin-top: 5px; font-weight: 700; }
.reel-icon-btn:active { transform: scale(0.8); }
.reel-icon-btn.liked svg { fill: var(--danger); animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }

/* Floating Seek Bar (Responsive & Touchable) */
.reel-seek-wrapper {
    pointer-events: auto;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; 
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}
.curr-time, .dur-time { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 35px; color: #eee; }

/* Expanded Hit Area for Seek Bar */
.reel-scrub-container {
    flex-grow: 1; height: 40px; /* Big touch target */
    cursor: pointer; display: flex; align-items: center; position: relative;
    touch-action: none; /* Prevents scroll interference on mobile */
}
.reel-scrub-bg { width: 100%; height: 4px; background: rgba(255,255,255,0.3); position: relative; border-radius: 2px; }
.reel-scrub-fill { height: 100%; background: var(--accent); width: 0%; position: relative; border-radius: 2px; }
.reel-scrub-head { 
    width: 16px; height: 16px; background: white; border-radius: 50%; 
    position: absolute; right: -8px; top: -6px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.5); 
    transform: scale(1); transition: transform 0.1s; 
}
.reel-scrub-container:active .reel-scrub-head { transform: scale(1.3); }

/* --- LOGIN & ADMIN PANELS --- */
#login-view {
    position: fixed; inset: 0; display: flex; flex-direction: column;
    justify-content: center; align-items: center; background: #000; z-index: 2000;
}
.glass-panel {
    background: var(--glass); border: 1px solid var(--glass-border);
    padding: 40px; border-radius: 20px; width: 350px; text-align: center;
    display: flex; flex-direction: column; align-items: center;
}
.glass-panel img { width: 150px; height: auto; margin-bottom: 25px; display: block; }
.glass-panel input { 
    width: 100%; padding: 12px; margin-bottom: 10px; 
    background: rgba(0,0,0,0.3); border: none; color: white; border-radius: 8px; box-sizing: border-box;
}

/* --- UTILS --- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 3000;
    display: none; align-items: center; justify-content: center;
}
button.primary { 
    width: 100%; padding: 12px; background: var(--accent); 
    border: none; color: white; border-radius: 8px; cursor: pointer; font-weight: bold;
}
button.btn-danger { 
    padding: 5px 10px; background: rgba(255, 69, 58, 0.2); 
    color: var(--danger); border: 1px solid rgba(255, 69, 58, 0.4); 
    border-radius: 6px; cursor: pointer; 
}
.text-btn { background: none; border: none; color: #ccc; cursor: pointer; margin-left: 10px; }
.browser-item { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer; }
.browser-item:hover { background: rgba(255,255,255,0.1); }

/* Admin Grid */
#admin-path-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.admin-cat-card { background: rgba(40, 40, 45, 0.9); border: 1px solid var(--glass-border); border-radius: 12px; padding: 20px; }
.admin-cat-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; margin-bottom: 10px; }
.admin-path-item { font-size: 0.85rem; color: #aaa; background: rgba(0,0,0,0.3); padding: 8px; border-radius: 6px; margin-bottom: 5px; display: flex; justify-content: space-between; align-items: center; }

/* Category Cards */
.cat-card { height: 140px; border-radius: 12px; position: relative; overflow: hidden; cursor: pointer; transition: transform 0.2s; border: 1px solid var(--glass-border); }
.cat-card:hover { transform: scale(1.03); border-color: var(--accent); }
.cat-bg { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.6); transition: 0.3s;}
.cat-card:hover .cat-bg { filter: brightness(0.4); }
.cat-title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,0.8); pointer-events: none; }
.floating-back { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); padding: 12px 24px; border-radius: 30px; background: rgba(0, 164, 220, 0.8); backdrop-filter: blur(10px); cursor: pointer; border: 1px solid rgba(255,255,255,0.2); font-weight: 600; z-index: 90; box-shadow: 0 5px 20px rgba(0,0,0,0.5); }

/* --- MOBILE TWEAKS --- */
@media (max-width: 768px) {
    #main-content { padding: 15px; padding-bottom: 80px; }
    
    /* Horizontal Scroll Cards (Bigger on mobile) */
    .video-card { flex: 0 0 38vw; } 
    
    /* 2-Column Grid */
    .full-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    
    /* Adjust Headers */
    .section-header { font-size: 20px; margin: 30px 0 10px 0; }
    
    /* Adjust Seek Bar for Mobile Reachability */
    .reel-seek-wrapper { bottom: 20px; width: 90%; margin: 0 auto 20px auto; }
}
