:root {
    --primary-color: #e50914;
    --dark-bg: #141414;
    --darker-bg: #0b0b0b;
    --light-text: #ffffff;
    --gray-text: #b3b3b3;
    --overlay-color: rgba(0, 0, 0, 0.7);
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--dark-bg);
    color: var(--light-text);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 0.5rem;
}

a {
    text-decoration: none;
    color: var(--light-text);
    transition: color 0.3s;
}

a:hover {
    color: var(--gray-text);
}

/* Layout Utilities */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4%;
}

.flex {
    display: flex;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #bd0000;
}

.btn-secondary {
    background-color: rgba(109, 109, 110, 0.7);
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(109, 109, 110, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid white;
    color: white;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7) 10%, rgba(0, 0, 0, 0));
    padding: 1rem 0;
    transition: background-color 0.3s;
}

.navbar.scrolled {
    background-color: var(--darker-bg);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 20px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links li a {
    font-size: 0.9rem;
}

.nav-links li a.active {
    font-weight: bold;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search Bar */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    /* Limit width in center */
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid #444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 5px 10px;
}

.search-icon {
    color: #aaa;
    font-size: 1rem;
    margin-right: 10px;
}

.search-input {
    background: transparent;
    border: none;
    color: white;
    padding: 0;
    font-size: 0.9rem;
    width: 100%;
    opacity: 1;
    /* Always visible now */
    position: relative;
    right: auto;
    top: auto;
}

.search-input:focus {
    outline: none;
}

/* Hero Section */
.hero {
    height: 80vh;
    position: relative;
    background-size: cover;
    background-position: center top;
}

.hero-overlay {
    background: linear-gradient(to top, var(--dark-bg), transparent 50%);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

.hero-content {
    max-width: 600px;
    margin-left: 4%;
    padding-top: 100px;
    padding-bottom: 50px;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-desc {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Movie Rows */
.row {
    margin-left: 4%;
    margin-bottom: 2rem;
}

.row-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.row-posters {
    display: flex;
    overflow-y: hidden;
    overflow-x: scroll;
    padding: 20px 0;
    gap: 10px;
    scroll-behavior: smooth;
}

.row-posters::-webkit-scrollbar {
    display: none;
}

.movie-card {
    position: relative;
    transition: transform 0.3s;
    min-width: 200px;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.movie-card:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.movie-poster {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.movie-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 0.3s;
}

.movie-card:hover .movie-info {
    opacity: 1;
}

.rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.movie-title {
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.action-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}

.action-btn:hover {
    color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--darker-bg);
    margin: auto;
    padding: 2rem;
    border: 1px solid #444;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    text-align: center;
    position: relative;
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: white;
}

/* Forms (Login/Register) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.static-page+.auth-container,
body>.auth-container {
    min-height: 80vh;
    padding-top: 80px;
}

.modal .auth-container {
    min-height: auto;
    padding: 0;
}

.auth-box {
    background: rgba(0, 0, 0, 0.75);
    padding: 2rem;
    border-radius: 4px;
    width: 100%;
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

/* Contact & About */
.static-page {
    padding: 100px 4% 50px 4%;
    max-width: 800px;
    margin: 0 auto;
}

.form-input {
    width: 100%;
    padding: 1rem;
    border-radius: 4px;
    border: none;
    background: #333;
    color: white;
    font-size: 1rem;
}

.form-input:focus {
    background: #444;
    outline: none;
}

.auth-footer {
    margin-top: 2rem;
    color: #737373;
}

.auth-footer a {
    color: white;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Contact & About */
.static-page {
    padding: 100px 4% 50px 4%;
    max-width: 800px;
    margin: 0 auto;
}

.static-page h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
    padding-bottom: 1rem;
}

.static-page p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Footer */
footer {
    padding: 2rem 4%;
    margin-top: 3rem;
    color: #737373;
    font-size: 0.9rem;
    text-align: center;
}

/* Utility */
.hidden {
    display: none !important;
}

/* --- Mobile Responsiveness --- */

/* Hamburger Menu Default State (Hidden on Desktop) */
.hamburger-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
}

/* Mobile Menu Container */
.mobile-menu {
    background-color: var(--darker-bg);
    border-top: 1px solid #333;
    padding: 1rem;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
}

.mobile-nav-links li {
    margin-bottom: 1rem;
    text-align: center;
}

.mobile-nav-links li a {
    font-size: 1.1rem;
    display: block;
    padding: 10px;
    border-bottom: 1px solid #333;
}

.mobile-nav-links li:last-child a {
    border-bottom: none;
}

/* Tablet & Mobile Styles */
@media screen and (max-width: 768px) {

    /* Hide Desktop Nav */
    .desktop-only {
        display: none !important;
    }

    /* Show Hamburger */
    .hamburger-menu {
        display: block;
    }

    /* Adjust Layout */
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-desc {
        font-size: 1rem;
        -webkit-line-clamp: 4;
    }

    .auth-box {
        padding: 1.5rem;
        max-width: 90%;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .search-input {
        width: 150px;
        /* Smaller width on mobile */
    }

    .search-container.active .search-input {
        width: 160px;
    }

    .row {
        margin-left: 2%;
        /* Less margin on mobile */
    }

    .hero-content {
        margin-left: 2%;
        padding-top: 80px;
    }

    .navbar-content {
        padding: 0 1rem;
    }
}

@media screen and (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    .search-container.active .search-input {
        width: 140px;
    }
}

/* --- Added Features --- */

/* Animated Background */
@keyframes animatedGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.animated-background {
    background: linear-gradient(-45deg, #0b0b0b, #300000, #1a0505, #000000);
    background-size: 400% 400%;
    animation: animatedGradient 15s ease infinite;
}

/* Search Results Grid Layout */
#search-results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px 0;
    overflow-x: visible;
    flex-wrap: wrap;
}

#search-results-container .movie-card {
    min-width: auto;
    width: 100%;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    overflow-x: auto;
    margin-bottom: 10px;
    scrollbar-width: none;
    /* Firefox */
}

.category-filters::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: bold;
}