/* Responsive styles for tablets and smaller desktops */
@media (max-width: 1024px) {
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* General mobile and tablet improvements */
@media (max-width: 768px) {
    /* Make hero text smaller on mobile */
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    /* Stack controls vertically */
    .controls-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Ensure filter buttons are scrollable and properly spaced */
    .filter-buttons-container {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;  /* For Firefox */
        -ms-overflow-style: none; /* For IE/Edge */
        padding-bottom: 0.5rem; /* Add some space below */
    }

    .filter-buttons-container::-webkit-scrollbar {
        display: none; /* For Chrome, Safari, and Opera */
    }

    .filter-buttons-container .tab-btn {
        flex-shrink: 0; /* Prevent buttons from shrinking */
        margin-right: 0.5rem;
    }
    
    .search-and-sort-container {
        display: flex;
        flex-direction: column;
        /* gap: 1rem; */
    }
    
    #mediaSearchInput, #sortSelect {
        width: 100%;
    }

    .sort-container .flex {
        display: flex;
        width: 100%;
    }

    #sortSelect {
        flex-grow: 1;
    }

    .apply-button-container {
        flex-shrink: 0;
    }

    /* Single column layout for cards on mobile */
    .cards-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Adjust modal for mobile */
    .modal-content {
        width: 90%;
        max-width: 500px;
    }

    /* Make hero buttons more manageable */
    .hero-section-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-section-buttons button {
        width: 80%;
        max-width: 320px; /* Max width for consistency */
        text-align: center;
    }
}

/* Styles for very small screens (e.g., iPhone SE) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.25rem;
    }

    .hero-subtitle {
        font-size: 0.75rem;
    }
    
    #surprise-button {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    /* Adjust card details for smaller screens */
    .media-card .p-5 {
        padding: 1rem;
    }
    
    .media-card .text-lg {
        font-size: 1rem;
    }
}

/* Browse page specific mobile optimizations */
@media (max-width: 768px) {
    /* Browse page header adjustments */
    .browse-header h1 {
        font-size: 1.75rem;
    }

    .browse-header p {
        font-size: 0.875rem;
    }

    /* Review cards on mobile */
    #reviews-container > div {
        margin-bottom: 1rem;
    }

    #reviews-container .bg-slate-800 {
        padding: 1rem;
    }

    /* Review card layout adjustments */
    #reviews-container .flex {
        flex-direction: column;
        gap: 0.75rem;
    }

    #reviews-container .w-full.sm\\:w-20 {
        width: 100%;
        max-width: 120px;
        margin: 0 auto;
    }

    /* Review text improvements */
    .review-body {
        line-height: 1.5;
    }
}

/* Mobile-specific layout adjustments for condensed UI */
@media (max-width: 768px) {
    /* Make the main content area a flex column for mobile */
    main#browse-page {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - 64px); /* Subtract nav height */
    }

    /* Center the search bar in the middle of the screen */
    .search-and-sort-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem 1rem;
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
        border-radius: 1rem;
        margin: 1rem 0;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(71, 85, 105, 0.3);
    }

    .search-container {
        width: 100%;
        max-width: 400px;
    }

    #mediaSearchInput {
        font-size: 1rem;
        padding: 1rem 1rem 1rem 3rem;
        border-radius: 2rem;
        background: rgba(15, 23, 42, 0.9);
        border: 2px solid rgba(99, 102, 241, 0.3);
    }

    #mediaSearchInput:focus {
        border-color: rgba(99, 102, 241, 0.8);
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    /* Sort controls remain visible on mobile */
    .sort-container {
        display: block;
        width: 100%;
    }

    /* Filter buttons: scrollable row, no negative margins that could hide buttons */
    .filter-buttons-container {
        position: sticky;
        top: 64px;
        z-index: 40;
        background: rgba(30, 41, 59, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(71, 85, 105, 0.3);
        padding: 0.5rem 1rem;
        margin: 0 0 1rem 0;
    }

    /* Cards container takes remaining space at bottom */
    #cardsContainer {
        flex: 2;
        padding-bottom: 2rem;
    }

    /* Adjust hero section for mobile */
    .hero-section {
        padding: 1.5rem 1rem 0.5rem 1rem;
        margin-bottom: 0;
    }

    .hero-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .hero-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    /* Hide the controls toolbar background on mobile since search is repositioned */
    .controls-toolbar {
        background: transparent;
        border: none;
        backdrop-filter: none;
        margin-top: 0;
        padding: 0;
    }
}
.stars-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 2px; /* Small space between stars */
}

.stars-row svg, 
.stars-row i {
    flex-shrink: 0 !important;
    display: inline-block !important;
}