/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove default tap highlight on mobile */
}

/* About Section Styles */
.about-section {
    background-color: #111;
    padding: 40px 0;
    margin: 0 0 30px 0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Tip Section with Typewriter Effect */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.about-section h2 {
    color: #f57c00;
    margin-bottom: 15px;
    font-size: 24px;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.about-section p {
    margin-bottom: 15px;
    line-height: 1.8;
}

.about-section .features {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 25px 0;
}

.about-section .feature {
    background-color: #222;
    border-radius: 8px;
    padding: 20px;
    flex: 1 1 250px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.about-section .feature:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background-color: #1a1a1a;
}

.about-section .feature i {
    font-size: 2.5rem;
    color: #f57c00;
    margin-bottom: 15px;
    display: block;
}

.about-section .feature h3 {
    color: #ff9800;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.about-section .feature p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0;
}

.about-section .tip {
    background-color: #1a1a1a;
    padding: 15px;
    border-left: 4px solid #f57c00;
    border-radius: 0 4px 4px 0;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.about-section .tip:hover {
    background-color: #222;
}

.about-section .tip p {
    margin: 0;
    min-height: 24px; /* Maintain consistent height during typing */
    position: relative;
    font-style: italic;
    cursor: pointer;
    color: #fff;
    transition: color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
}

/* Add a visual indicator for movie recommendations */
.about-section .tip p.movie-recommendation {
    position: relative;
    padding-right: 20px;
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
}

.about-section .tip p.movie-recommendation span {
    border-bottom: 1px dotted #8ab4f8;
    display: inline;
}

.about-section .tip p.movie-recommendation:hover::after {
    transform: translate(3px, -50%);
    opacity: 1;
}

.about-section .tip p strong {
    color: #f57c00;
    font-weight: bold;
}

.about-section .tip p::after {
    content: '|';
    position: relative;
    display: inline;
    color: #f57c00;
    animation: blink 0.7s infinite;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    background-color: #000;
    color: #fff;
    overflow-x: hidden;
    position: relative;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #555 #222; /* Firefox */
}

/* Custom Scrollbar for Main Content */
::-webkit-scrollbar {
    width: 2px;
}

::-webkit-scrollbar-track {
    background: #222;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff9800;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: #fff;
    text-decoration: none;
}

a:hover {
    color: #f57c00;
    transition: color 0.3s ease;
}

/* Header Styles */
header {
    background-color: #111;
    padding: 15px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: transform 0.3s ease, background-color 0.3s ease;
    border-bottom: 2px solid #f57c00;
}

header.hidden {
    transform: translateY(-100%);
}

@media (max-width: 768px) {
    .search-container {
        width: 100%;
        padding: 0 15px; /* Add padding to match container */
    }
}

/* Header Content Styles */
.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

@media (max-width: 768px) {
    .header-content {
        align-items: stretch; /* Allow children to stretch full width */
    }
}

.header-left {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Menu toggle styles moved to .search-input-container .menu-toggle */

header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

header h1 i {
    color: #f57c00;
    margin-right: 8px;
}

.search-container {
    display: flex;
    justify-content: center;
    margin: 0;
}

.search-input-container {
    position: relative;
    width: 100%;
    max-width: 400px; /* Default max-width for larger screens */
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .search-input-container {
        max-width: 100%; /* Allow full width on mobile */
    }
}

.search-input-container .menu-toggle {
    position: relative;
    left: 0;
    color: #fff;
    font-size: 20px;
    margin-right: 10px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.search-input-container .menu-toggle:hover {
    color: #ff9800;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

#search {
    padding: 12px 15px 12px 15px;
    width: 100%;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 15px;
    background-color: #222;
    color: #fff;
    transition: all 0.3s ease;
    padding-right: 40px;
}

#search:focus {
    outline: none;
    border-color: #f57c00;
    background-color: #333;
}

#search::placeholder {
    color: #999;
}

.search-icon {
    position: absolute;
    right: 15px;
    color: #f57c00;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.search-icon:hover {
    color: #ff9800;
    transform: scale(1.1);
    transition: all 0.3s ease;
}

/* Main Content */
main {
    margin-top: 60px; /* Increased to prevent content from hiding under header */
    min-height: calc(100vh - 160px); /* Adjust to ensure footer stays at bottom */
    padding: 20px 0;
    transition: transform 0.3s ease;
}

/* Genre Title */
.genre-title {
    margin-top: 0px;
    margin-bottom: 10px;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.genre-title h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.genre-title h2 i {
    margin-right: 10px;
    color: #ff8a00;
}

/* Movies Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Movie Card Styles */
.movie-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    height: 100%;
    cursor: pointer;
    animation: fadeIn 0.5s ease-in-out;
}

/* User Score Circle */
.user-score {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #000000d8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 2;
}

.user-score::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border-radius: 50%;
    border: 3px solid;
    border-color: inherit;
}

.user-score::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    z-index: -1;
}

.score-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.score-value {
    font-size: 14px;
    font-weight: bold;
}

.score-label {
    font-size: 7.5px;
    margin-top: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

.user-score.high {
    color: #4CAF50;
}

.user-score.high::before {
    border-color: #4CAF50;
}

.user-score.medium {
    color: #FFC107;
}

.user-score.medium::before {
    border-color: #FFC107;
}

.user-score.low {
    color: #F44336;
}

.user-score.low::before {
    border-color: #F44336;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.movie-card:hover {
    transform: scale(1.03);
}

.movie-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    animation: fadeIn 0.5s ease-in-out;
}

.movie-poster:hover {
    transform: scale(1.050);
}

.movie-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 10px;
    color: white;
}

.movie-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.movie-meta {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

/* Movie Details Page */
.movie-details {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.movie-details-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.movie-poster-large {
    max-width: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.movie-details-info h1 {
    margin-bottom: 10px;
    font-size: 28px;
}

.movie-details-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.movie-details-meta span {
    background-color: #f57c00;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: white;
}

.movie-overview {
    line-height: 1.8;
    margin-bottom: 20px;
}

.back-button {
    margin: 20px 0;
}

.back-button a {
    display: inline-block;
    padding: 10px 20px;
    background-color: #f57c00;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.back-button a:hover {
    background-color: #ff9800;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#loading, #loading-more {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    display: none;
    color: #f57c00;
    font-weight: bold;
}

#loading-more {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(34, 34, 34, 0.7);
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Floating Ad Styles */
.floating-ad {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #282828;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    padding: 15px;
    max-width: 320px;
    z-index: 1111;
    transform: translateX(0);
    transition: transform 0.5s ease-in-out;
    cursor: pointer;
}

.floating-ad.hidden {
    transform: translateX(-120%);
}

.floating-ad .close-ad-btn {
    position: absolute;
    top: 0px;
    right: 5px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
}

.floating-ad .close-ad-btn:hover {
    color: #ff9800;
    transition: color 0.3s ease;
}

.floating-ad .ad-image {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    margin-right: 15px;
    object-fit: cover;
}

.floating-ad .ad-content .ad-title {
    font-size: 1.1em;
    margin-bottom: 5px;
    color: #e0e0e0;
}

.floating-ad .ad-content .ad-title:hover {
    text-decoration: underline;
    text-dot: ellipsis;
    color: #f57c00;
    cursor: pointer;
    transition: color 0.3s ease;
}



.floating-ad .ad-content .ad-description {
    font-size: 0.85em;
    line-height: 1.4;
    color: #b0b0b0;
}

/* Footer Styles */
footer {
    background-color: #1a1a1a;
    color: #fff;
    padding: 20px 0;
    text-align: center;
    margin-top: 20px;
}

footer p {
    margin-bottom: 10px;
}

footer a {
    color: #f57c00;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #ff9800;
}

footer .fab.fa-x-twitter {
    margin-right: 2px;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: #f57c00;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.scroll-to-top:hover {
    background-color: #ff9800;
    transform: translateY(-5px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4);
}

.scroll-to-top i {
    font-size: 18px;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background-color: #1a1a1a;
    z-index: 1001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Ensure sidebar appears as overlay */
    transform: translateZ(0);
}

body:not(.sidebar-closed) {
    overflow: hidden;
}

body:not(.sidebar-closed) .sidebar {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #111;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 2;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 18px;
    color: #ff9800;
}

#close-sidebar {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

#close-sidebar:hover {
    color: #ff9800;
    transform: rotate(90deg);
    transition: all 0.3s ease;
}

.sidebar-content {
    padding: 10px;
    flex: 1;
    overflow-y: auto; /* Enable scrolling */
    scrollbar-width: 2px; /* Firefox */
    scrollbar-color: #555 #333; /* Firefox */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom Scrollbar for Sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #333;
    border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #f57c00;
    border-radius: 10px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #ff9800;
}

.genre-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
}

.genre-list li {
    margin-bottom: 10px;
}

.genre-list a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
}

.genre-list a i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: #f57c00;
    transition: transform 0.3s ease;
}

.genre-list a:hover {
    background-color: #333;
    color: #ff9800;
}

.genre-list a:hover i {
    transform: scale(1.2);
    color: #ff9800;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Increased opacity for better visibility */
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none; /* Initially no pointer events */
}

body:not(.sidebar-closed) .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Enable pointer events when visible */
}

/* Sidebar Footer Styles */
.sidebar-footer {
    padding: 5px;
    background-color: #111;
    border-top: 1px solid #333;
    text-align: center;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

/* Scroll indicator for genre list - only shows when content is scrollable */
.sidebar-content::after {
    content: "\f078"; /* Font Awesome down arrow */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    bottom: 35px;
    left: 50%;
    color: #f57c00;
    font-size: 16px;
    opacity: 0.8;
    pointer-events: none; /* Don't interfere with clicks */
    display: none; /* Hidden by default */
}

/* Only show scroll indicator when content is scrollable */
.sidebar-content.scrollable::after {
    display: block;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.sidebar-footer p {
    margin: 5px 0;
    font-size: 12px;
    color: #999;
}

.sidebar-footer i {
    color: #f57c00;
    margin-right: 5px;
}

body:not(.sidebar-closed) main {
    /* Removed transform to prevent content shifting */
}

/* Allow movies-grid to be interactive even when sidebar is open */
body:not(.sidebar-closed) .movies-grid {
    pointer-events: auto;
}

/* Responsive Styles */
@media (min-width: 768px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }

    header h1 {
        text-align: left;
    }

    .search-container {
        justify-content: flex-end;
    }

    header .container {
        padding: 0 20px;
    }

    #search {
        width: 300px;
    }

    .movie-details-header {
        flex-direction: row;
        align-items: flex-start;
    }

    .movie-details-info {
        margin-left: 20px;
    }
}

@media (max-width: 767px) {
    main {
        margin-top: 100px; /* Further increased to prevent content from hiding under header */
    }
    
    .genre-title {
        margin-top: 15px;
        margin-bottom: -30px;
    }
    
    .genre-title h2 {
        font-size: 1.2rem;
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding-top: 10px;
    }

    .movie-title {
        font-size: 14px;
    }

    .movie-meta {
        font-size: 12px;
    }
    
    .header-content {
        padding: 5px 0;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    header {
        padding: 10px 0;
    }
    
    /* Responsive sidebar for mobile */
    .sidebar {
        width: 250px;
        left: -250px;
    }
    
    body:not(.sidebar-closed) main {
        /* Commented out to prevent content shifting on tablet */
        /* transform: translateX(250px); */
    }
}

@media (max-width: 480px) {
    .genre-title {
        margin-top: 10px;
        margin-bottom: -30px;
    }
    
    .genre-title h2 {
        font-size: 1rem;
    }
    main {
        margin-top: 100px; /* Even more space for smaller screens */
    }
    
    .movies-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }

    .movie-info {
        padding: 5px;
    }

    .movie-title {
        font-size: 12px;
        margin-bottom: 2px;
    }

    .movie-meta {
        font-size: 10px;
    }
    
    /* Responsive sidebar for small mobile */
    
    body:not(.sidebar-closed) main {
        /* Removed transform to prevent content shifting on mobile */
    }
    
    .sidebar-header h2 {
        font-size: 16px;
    }
    
    .genre-list a {
        padding: 8px 10px;
    }
}