:root {
    --primary-color: #e50914;
    --dark-bg: #141414;
    --light-text: #fff;
    --gray-text: #aaa;
    --input-bg: #333;
}

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

body {
    background-color: var(--dark-bg);
    color: var(--light-text);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--light-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Auth Container (Login/Register) */
.auth-container {
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://assets.nflxext.com/ffe/siteui/vlv3/f841d4c7-10e1-40af-bcae-07a3f8dc141a/f6d7434e-d6de-4185-a6d4-c77a2d08737b/US-en-20220502-popsignuptwoweeks-perspective_alpha_website_medium.jpg');
    background-size: cover;
    background-position: center;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-box {
    background-color: rgba(0, 0, 0, 0.75);
    padding: 60px 68px 40px;
    border-radius: 4px;
    width: 100%;
    max-width: 450px;
    min-height: 500px;
}

.auth-box h1 {
    margin-bottom: 28px;
    font-size: 32px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 16px;
}

.form-control {
    width: 100%;
    background: #333;
    border-radius: 4px;
    border: 0;
    color: #fff;
    height: 50px;
    line-height: 50px;
    padding: 16px 20px;
    font-size: 16px;
}

.btn {
    width: 100%;
    background-color: var(--primary-color);
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    margin: 24px 0 12px;
    padding: 16px;
    cursor: pointer;
}

.btn:hover {
    background-color: #f40612;
}

.auth-footer {
    margin-top: 16px;
    color: #737373;
    font-size: 16px;
}

.auth-footer a {
    color: #fff;
    margin-left: 5px;
}

.error-msg {
    background: #e87c03;
    border-radius: 4px;
    font-size: 14px;
    padding: 10px 20px;
    margin-bottom: 16px;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 4%;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 10%, rgba(0,0,0,0));
    transition: background-color 0.3s;
}

.navbar.scrolled {
    background-color: var(--dark-bg);
}

.logo {
    color: var(--primary-color);
    font-size: 25px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-item {
    margin-left: 20px;
    font-size: 14px;
}

/* Browse Page */
.hero-container {
    height: 80vh;
    position: relative;
    overflow: hidden;
}

.hero {
    /* Deprecated, use hero-container/hero-slide */
    display: none; 
}

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

/* Continue Watching Styles */
.poster-link {
    display: inline-block;
    position: relative;
    margin-right: 10px;
    transition: transform 450ms;
}

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

.poster-wrapper {
    position: relative;
}

/* Override standard poster margin since wrapper handles it */
.poster-link .row-poster {
    margin-right: 0;
    display: block; /* Remove bottom space */
}

.poster-link:hover .row-poster {
    transform: none; /* Disable individual image scale, scale wrapper instead */
}

.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #555;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
}

.hero-slide::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 7.4rem;
    background-image: linear-gradient(180deg, transparent, rgba(20,20,20,0.61), #141414);
}

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

.hero-content {
    z-index: 10;
    max-width: 500px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-in-out 0.5s, transform 1s ease-in-out 0.5s;
}

.hero-slide.active .hero-content {
    opacity: 1;
    transform: translateY(0);
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.hero-desc {
    font-size: 1.2rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.video-row {
    padding: 20px 4%;
}

.row-title {
    font-size: 1.4vw;
    color: #e5e5e5;
    font-weight: bold;
    margin-bottom: 10px;
}

.row-posters {
    display: flex;
    overflow-y: hidden;
    overflow-x: scroll;
    padding: 20px 0;
}

.row-poster {
    height: 150px;
    width: auto;
    aspect-ratio: 2/3;
    object-fit: cover; /* Ensures image fills dimensions without distortion */
    margin-right: 10px;
    transition: transform 450ms;
    border-radius: 4px;
    cursor: pointer;
}

.row-poster-large {
    height: 250px;
    width: auto;
    aspect-ratio: 2/3;
}

.row-poster:hover {
    transform: scale(1.08);
}

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

.row-posters {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* =========================================
   CUSTOM VIDEO PLAYER STYLES (Netflix-Like)
   ========================================= */

.player-body {
    background: #000;
    overflow: hidden; /* Prevent scrollbars in fullscreen */
    margin: 0;
    height: 100vh;
    width: 100vw;
}

.player-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure video fits without cropping */
}

/* Loading Spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none; /* Show via JS when buffering */
    z-index: 5;
}

.spinner-ring {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Controls Overlay */
.controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 15%, transparent 80%, rgba(0,0,0,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.player-container:hover .controls-overlay,
.player-container.show-controls .controls-overlay {
    opacity: 1;
}

/* Top Bar */
.controls-top {
    padding: 20px;
}

.back-btn {
    display: inline-block;
    color: #fff;
    width: 40px;
    height: 40px;
    cursor: pointer;
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.5));
}

.back-btn svg {
    width: 100%;
    height: 100%;
}

/* Bottom Controls */
.controls-bottom {
    padding: 0 20px 20px 20px;
}

/* Scrubber / Timeline */
.scrubber-container {
    position: relative;
    height: 5px;
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    margin-bottom: 15px;
    transition: height 0.1s ease;
    display: flex;
    align-items: center;
}

.scrubber-container:hover {
    height: 8px;
}

.scrubber-track {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    overflow: hidden;
}

.scrubber-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    width: 0%;
    transition: width 0.2s;
}

.scrubber-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary-color);
    width: 0%;
}

.scrubber-thumb {
    position: absolute;
    left: 0%; /* JS will update this */
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.1s;
    margin-left: -8px; /* Center thumb */
    z-index: 2;
}

.scrubber-container:hover .scrubber-thumb {
    transform: scale(1);
}

.scrubber-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    margin: 0;
}

/* Buttons Row */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-left, .controls-right {
    display: flex;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 8px;
    margin-right: 10px;
    transition: transform 0.1s, color 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    transform: scale(1.1);
    color: #fff;
    /* On mobile, remove hover effect to prevent sticky hover states */
}

.icon-btn svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

/* Volume Group */
.volume-group {
    display: flex;
    align-items: center;
    position: relative;
    margin-right: 15px;
}

.volume-slider-container {
    width: 0;
    overflow: hidden;
    transition: width 0.2s;
    display: flex;
    align-items: center;
}

.volume-group:hover .volume-slider-container {
    width: 80px;
    margin-left: 5px;
}

#volumeSlider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

/* Meta Info (Time & Title) */
.meta-info {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.time-text {
    margin-right: 10px;
}

.separator {
    margin-right: 10px;
    color: rgba(255,255,255,0.5);
}

.video-title {
    font-weight: bold;
}

.episode-tag {
    font-weight: normal;
    color: #ccc;
    margin-left: 5px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .controls-bottom {
        padding: 0 10px 15px 10px;
    }
    
    .icon-btn {
        width: 48px; /* Larger touch target */
        height: 48px;
        padding: 10px;
        margin-right: 5px;
    }
    
    .volume-slider-container {
        display: none !important; /* Hide volume slider on mobile */
    }
    
    .volume-group {
        margin-right: 5px;
    }
    
    .time-text {
        font-size: 12px;
    }
    
    .video-title, .episode-tag {
        font-size: 12px;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .scrubber-thumb {
        transform: scale(1); /* Always show thumb on mobile */
        width: 18px;
        height: 18px;
        margin-left: -9px;
    }
    
    .back-btn {
        width: 48px;
        height: 48px;
    }
    
    /* Improve tap handling */
    .icon-btn:hover {
        transform: none;
    }
}
