:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #38bdf8;
    --secondary: #c084fc;
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --green: #008000;
    --bright-fern: #38b000;
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    overflow-x: hidden;
    min-height: 100vh;
}

.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(56, 189, 248, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: pulse 10s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

/* Header */
.glass-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-top: 4px solid var(--bright-fern);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    text-decoration: none;
}

.logo span {
    color: var(--bright-fern);
}

/* Back Link */
.back-link {
    color: var(--bright-fern);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Search Bar */
.search-bar {
    position: relative;
    width: 300px;
}

.search-bar svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    color: var(--text-white);
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bright-fern);
    border-radius: 99px;
    color: var(--text-white);
    outline: none;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.gradient-text {
    background: linear-gradient(135deg, var(--bright-fern), var(--green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-gray);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Movie Grid */
/* Movie Grid */
/* Movie Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Mobile default */
    gap: 1rem;
    padding: 2rem 0;
    /* Removed overflow-x: auto to fit in view */
}

@media (min-width: 768px) {
    .movies-grid {
        grid-template-columns: repeat(4, 1fr);
        /* Tablet */
    }
}

@media (min-width: 1200px) {
    .movies-grid {
        grid-template-columns: repeat(6, 1fr);
        /* Desktop: 6 in a row */
    }
}

.movie-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--glass-border);
    position: relative;
    display: block;
    /* Removed fixed dimensions to let grid control width */
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.poster-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    /* Restore aspect ratio */
    width: 100%;
    overflow: hidden;
    /* Removed fixed height */
}

.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.movie-card:hover .poster-wrapper img {
    transform: scale(1.05);
}

.quality-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: var(--bright-fern);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.movie-info {
    padding: 0.75rem;
    /* Auto height */
    display: block;
}

.movie-info h3 {
    color: var(--text-white);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: var(--text-gray);
}

.rating {
    color: var(--bright-fern);
}

/* Movie Detail Page */
.movie-detail {
    padding-top: 0;
}

.hero-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70vh;
    background-size: cover;
    background-position: center;
    z-index: -1;
    filter: brightness(0.6);
}

.content-wrapper {
    display: flex;
    gap: 3rem;
    margin-top: 20vh;
    align-items: flex-start;
}

.poster-large {
    flex-shrink: 0;
    width: 300px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.poster-large img {
    width: 100%;
    display: block;
}

.info-panel {
    flex: 1;
}

.info-panel h1 {
    font-size: 4rem;
    margin: 1rem 0;
    line-height: 1;
}

.info-panel .year {
    font-weight: 300;
    color: var(--text-gray);
}

.tags {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tags span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.quality-badge {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
}

.rating-badge {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.lang-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.genres {
    color: var(--secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.description {
    line-height: 1.6;
    color: var(--text-gray);
    font-size: 1.1rem;
    max-width: 800px;
    margin-bottom: 2rem;
}

.actions {
    display: flex;
    gap: 1rem;
}

button {
    padding: 1rem 2rem;
    border-radius: 99px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #000;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
    background: #7dd3fc;
}

.btn-secondary {
    background: var(--bright-fern);
    color: var(--text-white);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: 10vh;
    }

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

    .info-panel h1 {
        font-size: 2.5rem;
    }

    .tags {
        justify-content: center;
    }

    .poster-large {
        width: 220px;
    }
}

/* Video Modal */
.video-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    width: min(90%, 160vh);
    max-width: 1600px;
    aspect-ratio: 16/9;
    max-height: 90vh;
    background: #000;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(56, 189, 248, 0.2);
    overflow: hidden;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--primary);
}

/* Ad Container */
.ad-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #1e293b, #0f172a);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.ad-content {
    text-align: center;
    color: #fff;
}

.ad-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ad-timer-wrapper {
    position: absolute;
    bottom: 30px;
    right: 30px;
}

.skip-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: none;
    /* Hidden initially */
    transition: all 0.3s ease;
}

.skip-btn:hover {
    background: var(--primary);
    color: #000;
}

#skipTimer {
    color: #94a3b8;
    font-weight: 600;
}

/* Movie Player */
.movie-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* Hidden until ad skipped */
    z-index: 10;
}

.movie-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--bright-fern);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--bright-fern);
    color: var(--bright-fern);
    transform: translateY(-2px);
}

.page-link.active {
    background: var(--bright-fern);
    color: #fff;
    border-color: var(--bright-fern);
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

/* Footer Search Section */
.footer-search {
    background: #0f172a;
    /* Dark background matching container */
    padding: 4rem 2rem;
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.footer-search h2 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.footer-search p {
    color: var(--text-gray);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.large-search {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.large-search input {
    width: 100%;
    background: #1e293b;
    border: 1px solid var(--bright-fern);
    padding: 1rem 1.5rem;
    color: white;
    border-radius: 99px;
    font-size: 1rem;
    outline: none;
}

.large-search input:focus {
    border-color: var(--bright-fern);
}

.large-search button {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    background: var(--bright-fern);
    border: none;
    border-bottom-right-radius: 99px;
    border-top-right-radius: 99px;
    padding: 0 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    transition: transform 0.2s;
}

.large-search button:hover {
    transform: scale(1.05);
}

footer {
    background: var(--bg-dark);
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--text-gray);
    width: 100%;
}

.player-section {
    max-width: 1200px;
    margin: 4rem auto;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(56, 189, 248, 0.1);
    border: 1px solid var(--glass-border);
}

.glass-button {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 99px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.glass-button:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--bright-fern);
    color: var(--bright-fern);
}