/* Global Variables */
:root {
    --primary-red: #E50914;
    --primary-glow: rgba(229, 9, 20, 0.5);
    --background-dark: #141414;
    --background-black: #000000;
    --text-white: #ffffff;
    --text-gray: #b3b3b3;
    --card-hover-scale: 1.05;
    --navbar-height: 70px;
    --font-heading: 'Bebas Neue', sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background-dark);
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-white);
    letter-spacing: 1px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
}

/* Trigger animation on scroll (handled via JS or simple delay) */
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}


/* Navbar */
.navbar {
    padding: 15px 4%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
    height: var(--navbar-height);
}

.navbar.bg-black {
    background-color: var(--background-black) !important;
    background-image: none !important;
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: #050505;
        padding: 1.5rem;
        border-radius: 12px;
        margin-top: 15px;
        border: 1px solid #333;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
    }
}

.navbar-brand {
    font-family: var(--font-heading);
    color: var(--primary-red) !important;
    font-size: 2rem;
    font-weight: 700;
}

.profile-img {
    width: 35px;
    height: 35px;
    border-radius: 90%;
    object-fit: cover;
}

.nav-link {
    color: var(--text-gray) !important;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-white) !important;
}

/* Search Box - Improved and Refined */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    min-width: 40px;
}

.search-icon {
    color: var(--text-white);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 10;
    padding: 5px;
    transition: transform 0.2s;
}

.search-icon:hover {
    transform: scale(1.1);
}

.search-input {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 15px 6px 35px;
    border-radius: 20px;
    outline: none;
    width: 0;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: absolute;
    right: 0;
    font-size: 0.85rem;
}

.search-box.active .search-input {
    width: 200px;
    opacity: 1;
    position: relative;
}

.search-input:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--primary-red);
    box-shadow: 0 0 10px rgba(229, 9, 20, 0.3);
}

@media (max-width: 576px) {
    .search-box.active .search-input {
        width: 130px;
    }

    .navbar-brand {
        font-size: 1.5rem !important;
    }
}

.search-box.active .search-input {
    width: 200px;
    opacity: 1;
}

/* Hero Section */
.hero-wrapper {
    position: relative;
    height: 80vh;
    width: 100%;
    overflow: hidden;
}

.hero-slide {
    height: 100%;
    width: 100%;
    background-size: cover;
    background-position: center top;
    position: relative;
}

/* Vignette overlay for text readability */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, #141414 0%, rgba(20, 20, 20, 0) 50%);
}

.hero-content {
    position: absolute;
    bottom: 35%;
    left: 4%;
    max-width: 500px;
    z-index: 10;
}

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

.hero-description {
    font-family: var(--font-body);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.btn-hero {
    background-color: var(--primary-red);
    color: white;
    padding: 0.6rem 1.4rem;
    border-radius: 4px;
    font-weight: 600;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-hero:hover {
    background-color: #c10811;
    color: white;
}

/* Section Titles */
.section-title {
    font-size: 1.5rem;
    color: var(--text-gray);
    margin: 4rem 4% 1.5rem;
    /* Increased top margin from 2rem to 4rem */
    font-weight: 600;
    font-family: var(--font-body);
    border-left: 4px solid var(--primary-red);
    padding-left: 10px;
}

.page-container {
    padding-top: 100px;
    /* Spacing for fixed navbar */
}

/* Horizontal Carousel */
.carousel-container {
    padding: 0 4% 2rem;
    position: relative;
    overflow: hidden;
    margin-top: -10px;
    /* Adjust for title margin */
}

.carousel-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    gap: 1.5rem;
    padding: 2.5rem 0.5rem;
    margin: -2rem -0.5rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}

.carousel-scroll.two-rows {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    gap: 1.5rem;
    padding-bottom: 3rem;
}

.carousel-scroll.two-rows #loader {
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.carousel-scroll .movie-unit {
    flex: 0 0 auto;
    width: 160px;
    background: transparent;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.carousel-scroll::-webkit-scrollbar {
    display: none;
}

/* Global Movie Unit (Wrapper for Card + Text) */
.movie-unit {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
    transition: transform 0.3s ease;
    scroll-snap-align: start;
}

.carousel-scroll .movie-unit {
    flex: 0 0 auto;
    width: 180px;
}

/* Mobile Responsiveness for Carousel */
@media (max-width: 768px) {
    .carousel-scroll {
        gap: 10px;
    }

    .carousel-scroll .movie-unit {
        width: 130px;
    }
}



/* Layout Grid for Cards - Standardized to match Carousel Card Size */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding: 0 4% 4rem;
}

/* Ensure premium card fills the unit */
.movie-unit .premium-card {
    width: 100%;
}


/* Movie/Show Card */
/* Premium Movie Card Styles */
.premium-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background-color: transparent;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
    aspect-ratio: 2 / 3;
}

.premium-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.premium-card:hover {
    transform: scale(1.05);
    /* Slightly larger scale */
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.premium-card:hover img {
    transform: scale(1.05);
    /* Image zoom effect */
}

.premium-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    z-index: 200;
}

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

.premium-btn {
    width: 100%;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 0;
    text-align: center;
    transition: all 0.2s;
    margin-top: 5px;
    margin-bottom: 5px;
    display: block;
    text-decoration: none;
    white-space: nowrap;
}

.premium-btn-play {
    background: white;
    color: black;
    border: none;
}

.premium-btn-play:hover {
    background: #e6e6e6;
    color: black;
    transform: scale(1.02);
}

.premium-btn-list {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.premium-btn-list:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-color: white;
    transform: scale(1.02);
}

.premium-btn-remove {
    background: rgba(229, 9, 20, 0.2);
    backdrop-filter: blur(10px);
    color: var(--primary-red);
    border: 1px solid rgba(229, 9, 20, 0.4);
}

.premium-btn-remove:hover {
    background: rgba(229, 9, 20, 0.4);
    color: white;
    border-color: var(--primary-red);
    transform: scale(1.02);
}

.premium-btn-danger {
    background: rgba(229, 9, 20, 0.6);
    backdrop-filter: blur(5px);
    color: white;
    border: 1px solid rgba(229, 9, 20, 0.8);
}

.premium-btn-danger:hover {
    background: rgba(229, 9, 20, 0.8);
    color: white;
    border-color: #ff0f1f;
}

.media-info {
    margin-top: 10px;
}

.media-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

.media-meta {
    font-size: 0.8rem;
    color: #999;
}

/* Footer */
.main-footer {
    padding: 4rem 4%;
    color: var(--text-gray);
    font-size: 0.8rem;
    text-align: center;
    border-top: 1px solid #333;
}

.footer-link {
    color: var(--text-gray);
    margin: 0 10px;
}

.footer-link:hover {
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    gap: 5px;
}

.page-link {
    background-color: var(--background-dark);
    color: var(--text-white);
    border: 1px solid var(--primary-red);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
}

.page-link:hover {
    background-color: var(--primary-red);
    color: white;
}

.current {
    color: var(--primary-red);
    font-weight: bold;
    margin: 0 1rem;
}

/* Authentication Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://i.ibb.co/gFjvq14B/nextflix.jpg') no-repeat center center;
    background-size: cover;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(15px);
    border-radius: 8px;
    padding: 60px 68px 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 28px;
    color: #fff;
}

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

.auth-form .form-label {
    display: block;
    font-size: 0.9rem;
    color: #8c8c8c;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.auth-input {
    width: 100%;
    background: #333;
    border: none;
    border-radius: 4px;
    color: #fff;
    padding: 12px 20px;
    font-size: 1rem;
    transition: background 0.2s;
}

.auth-input:focus {
    background: #454545;
    outline: none;
    box-shadow: none;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 24px;
    background-color: var(--primary-red);
    border: none;
    color: #fff;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.auth-btn:hover {
    background-color: #c10811;
}

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

.auth-footer-link {
    color: #fff;
    font-weight: 500;
    margin-left: 5px;
}

.auth-footer-link:hover {
    text-decoration: underline;
}

.auth-tip {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #8c8c8c;
}

.auth-error-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    color: var(--primary-red);
    font-size: 0.85rem;
}

/* Auth Page Entry Animation */
.auth-card {
    animation: authCardSlideUp 0.6s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes authCardSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #737373;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #404040;
}

.auth-divider span {
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 4px;
    padding: 12px;
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-google:hover {
    background-color: #e6e6e6;
    color: #000;
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Watch Party Modal - Mobile Optimization */
@media (max-width: 576px) {
    #watchPartyModal .modal-dialog {
        margin: 0.5rem;
    }

    #watchPartyModal .modal-content {
        border-radius: 12px;
    }

    /* Prevent iOS zoom on input focus */
    #watchPartyModal .form-control {
        font-size: 16px !important;
    }

    #watchPartyModal .modal-title {
        font-size: 1.25rem;
    }

    #watchPartyModal .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Watch Party Modal - General Improvements */
#watchPartyModal .modal-content {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

#watchPartyModal .form-control:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 0.2rem rgba(229, 9, 20, 0.25);
}

#watchPartyModal .form-check-input:checked {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
}

/* Watchlist Grid - Kept from duplicates */
.watchlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

/* Profile Page Specific Styles */
.profile-main {
    padding-top: 80px;
}

.profile-header {
    background: linear-gradient(135deg, #1f1f1f 0%, #141414 100%);
    padding: 60px 0;
    border-radius: 12px;
    margin-bottom: 40px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

/* Add a subtle shine effect to profile header */
.profile-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.03) 50%, transparent 60%);
    pointer-events: none;
}

.avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--primary-red);
    margin-bottom: 20px;
    object-fit: cover;
    box-shadow: 0 0 20px rgba(229, 9, 20, 0.3);
}

/* Ensure media titles in profile view matched the intent */
.media-info .media-title {
    color: white;
    font-weight: 700;
    margin-top: 8px;
}

.media-info .media-meta {
    color: #999;
}