/* Custom styles for genre pages */

/* Fix header positioning and styling */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 30px;
    justify-content: space-between;
}

.watch-list-button {
    margin-left: 10px;
    min-width: 110px;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    margin-right: 30px; /* Increased right margin */
    position: relative;
    right: 0;
}

.watch-list-button .button-text {
    font-size: 0.95rem;
}

/* Fix navigation menu positioning */
.nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    width: 160px; /* Reduced from 200px to 160px */
    bottom: 0;
    background-color: rgba(20, 20, 20, 0.95);
    z-index: 999;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    padding-top: 20px;
}

.nav-items {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-item {
    margin-bottom: 15px;
}

.nav-item a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    display: block;
    padding: 10px 20px;
    transition: background-color 0.3s ease;
}

.nav-item a:hover {
    background-color: rgba(141, 22, 201, 0.3);
}

.nav-item.active a {
    background-color: rgba(141, 22, 201, 0.5);
    border-left: 3px solid rgba(141, 22, 201, 1);
}

/* Adjust main content to account for fixed header and nav */
.main-content {
    margin-left: 160px; /* Changed from 200px to 160px to match nav-menu width */
    margin-top: 80px;
    padding: 20px;
}

/* Genre title styling with improved centering */
.genre-title {
    font-size: 2rem;
    color: #fff;
    text-align: center;
    margin: 1rem auto 1.5rem;
    width: auto;
    position: relative;
    padding-bottom: 10px;
    text-transform: capitalize;
    background: linear-gradient(90deg, rgba(164, 57, 207, 1) 0%, rgba(141, 22, 201, 1) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
    display: table;
    left: 50%;
    transform: translateX(-50%);
}

.genre-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(164, 57, 207, 1) 0%, rgba(141, 22, 201, 1) 100%);
    width: 60%;
    margin: 0 auto;
    border-radius: 2px;
}

/* Filter container styles */
.genre-filter-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 2rem;
    padding: 0 15px;
}

.filter-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-button {
    background-color: rgba(30, 30, 30, 0.7);
    color: #fff;
    border: 1px solid rgba(141, 22, 201, 0.3);
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-button:hover {
    background-color: rgba(141, 22, 201, 0.3);
    border-color: rgba(141, 22, 201, 0.6);
}

.filter-button.active {
    background-color: rgba(141, 22, 201, 0.8);
    border-color: rgba(164, 57, 207, 1);
    box-shadow: 0 0 10px rgba(141, 22, 201, 0.5);
}

/* Grid container styles */
.genre-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); /* Reduced minmax value to fit more columns */
    gap: 40px; /* Increased gap even more */
    padding: 0 4%;
    margin-bottom: 40px;
    min-height: 300px; /* Ensure container has some height even when empty */
}

.movie-item {
    position: relative;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: none;
}

.movie-item:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(141, 22, 201, 0.5);
}

.image-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    border: none;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.movie-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
    opacity: 1; /* Always show the overlay */
    transition: opacity 0.3s ease;
    min-height: 60px; /* Reduce min-height now that we don't have watch button */
    border: none; /* Remove any borders */
}

/* Title-rating container for side-by-side layout */
.title-rating-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
    border: none;
}

/* Movie title styling */
.movie-title {
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    line-height: 1.2;
}

.movie-rating {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    margin-left: auto;
    border: none;
}

.rating-star {
    color: #FFC107;
    margin-right: 5px;
}

/* Remove watch button styling section */

/* Pagination styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0 40px;
    gap: 20px;
}

.pagination-button {
    background-color: rgba(30, 30, 30, 0.7);
    color: #fff;
    border: 1px solid rgba(141, 22, 201, 0.3);
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-button:hover:not(:disabled) {
    background-color: rgba(141, 22, 201, 0.7);
    border-color: rgba(164, 57, 207, 1);
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-indicator {
    color: #fff;
    font-size: 0.9rem;
}

/* Loading indicator styles */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: white;
}

.loading-spinner {
    border: 4px solid rgba(141, 22, 201, 0.3);
    border-top: 4px solid rgba(141, 22, 201, 1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* No results message */
.no-results {
    text-align: center;
    color: white;
    padding: 40px 20px;
    background-color: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    margin: 30px auto;
    max-width: 600px;
    border: 1px solid rgba(141, 22, 201, 0.3);
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(141, 22, 201, 0.7);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 10;
}

.back-to-top:hover {
    background-color: rgba(164, 57, 207, 0.9);
}

/* Responsive design */
@media (max-width: 1200px) {
    .genre-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        gap: 35px; /* Adjusted for better spacing */
    }
}

@media (max-width: 768px) {
    /* Hide watchlist button on mobile */
    .watch-list-button {
        display: none !important;
    }

    .header {
        padding: 0 15px;
        height: 50px;
    }

    .nav-menu {
        top: 50px;
        width: 100%;
        height: auto;
        position: fixed;
        bottom: auto;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        padding-top: 0;
    }

    .nav-items {
        flex-direction: row;
        justify-content: center;
        overflow-x: auto;
        white-space: nowrap;
    }

    .nav-item {
        margin-bottom: 0;
        margin-right: 5px;
    }

    .nav-item a {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .main-content {
        margin-left: 0;
        margin-top: 110px;
        padding: 15px;
    }

    .genre-title {
        font-size: 1.5rem;
        margin: 1.5rem auto 1rem;
        width: auto;
        position: relative;
        padding-bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        display: table;
    }

    .genre-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 30px; /* Adjusted for better spacing */
        padding: 0 3%;
    }

    .filter-button {
        padding: 6px 15px;
        font-size: 0.8rem;
    }

    .pagination-container {
        gap: 15px;
    }
}

@media (max-width: 480px) {
    /* Core layout fixes to prevent zooming issues */
    html, body {
        width: 100%;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    body {
        position: relative;
        min-height: 100vh;
    }

    .header {
        padding: 0 8px;
        height: 50px; /* Increased from 45px to 50px */
        width: 100%;
        box-sizing: border-box;
    }

    .logo img {
        max-height: 30px; /* Increased from 28px */
    }

    .search-container {
        max-width: 140px;
        margin: 0 5px;
    }

    /* Enhanced navigation for mobile */
    .nav-menu {
        top: 50px; /* Adjusted to match header height */
        width: 100vw;
        box-sizing: border-box;
        overflow-x: auto;
        padding: 8px 0; /* Added padding for larger touch area */
        background-color: rgba(20, 20, 20, 0.98); /* Darker background */
        border-bottom: 2px solid rgba(141, 22, 201, 0.5); /* Added border for visual separation */
    }

    .nav-items {
        padding: 0 10px; /* Increased padding */
        width: max-content;
        display: flex;
        align-items: center;
        height: 40px; /* Fixed height for nav bar */
    }

    .nav-item {
        margin-bottom: 0;
        margin-right: 8px; /* Increased from 5px */
    }

    .nav-item a {
        padding: 10px 15px; /* Increased padding for larger touch targets */
        font-size: 0.85rem; /* Increased font size */
        font-weight: 500; /* Added font weight */
        border-radius: 20px; /* Rounded corners */
        white-space: nowrap;
        border: 1px solid rgba(141, 22, 201, 0.3); /* Added subtle border */
    }

    .nav-item.active a {
        background-color: rgba(141, 22, 201, 0.7); /* Brighter active state */
        border-left: none; /* Removed left border */
        border: 1px solid rgba(141, 22, 201, 0.8); /* Consistent border style */
        font-weight: 600; /* Bolder text for active item */
    }

    .main-content {
        margin-top: 110px; /* Adjusted to account for larger nav */
        padding: 5px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Enhanced genre title */
    .genre-title {
        font-size: 1.5rem; /* Increased from 1.2rem */
        margin: 1rem auto 1.2rem; /* Increased margin */
        width: auto;
        position: relative;
        padding: 5px 15px; /* Added horizontal padding */
        padding-bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        display: table;
        background: linear-gradient(90deg, rgba(164, 57, 207, 1) 0%, rgba(141, 22, 201, 1) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        border-radius: 30px; /* Added rounded corners */
    }

    /* Enhanced filter buttons */
    .filter-options {
        gap: 10px; /* Increased from 6px */
        justify-content: center;
        margin-bottom: 15px; /* Added margin */
        margin-right: 5%; /* Move buttons slightly to the left for better mobile symmetry */
    }

    .filter-button {
        padding: 8px 15px; /* Increased padding */
        font-size: 0.85rem; /* Increased font size */
        border-radius: 20px;
        font-weight: 500;
        letter-spacing: 0.5px;
        border: 1px solid rgba(141, 22, 201, 0.4);
        min-width: 80px; /* Added minimum width */
        text-align: center;
    }

    .filter-button.active {
        background-color: rgba(141, 22, 201, 0.8);
        box-shadow: 0 0 10px rgba(141, 22, 201, 0.5);
        font-weight: 600;
    }

    .genre-grid-container {
        grid-template-columns: repeat(2, 1fr); /* Two columns layout for mobile */
        gap: 15px; /* Slightly increased gap for better spacing */
        padding: 0 10px; /* Slightly increased padding */
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
    }

    .movie-item {
        height: 150px; /* Increased height for better visibility */
        margin: 0 auto;
        width: 100%;
    }

    .pagination-container {
        gap: 8px;
        margin: 20px 0;
    }

    .pagination-button {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .footer {
        padding: 15px 10px;
        font-size: 0.7rem;
        width: 100%;
        box-sizing: border-box;
    }
}