/**
 * Responsive Enhancements for Anime Listing Pages
 * Works with existing HiAnime theme flexbox layout
 * Optimized for Category, Browse, TV, Movie, and A-Z List pages
 */

/* ============================================
   FULL WIDTH CONTAINER FOR LISTING PAGES
   ============================================ */

/* Make container full-width for better space utilization */
#main-content .container,
#main-wrapper .container,
.container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

/* Ensure wrapper divs also use full width */
#main-content,
#main-wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

/* Override any Bootstrap container widths */
@media (min-width: 576px) {
    .container {
        max-width: 100% !important;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 100% !important;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 100% !important;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 100% !important;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 100% !important;
    }
}

/* ============================================
   ENHANCED FILM LIST GRID (Works with existing flexbox)
   ============================================ */

/* Ultra-minimal spacing between items for very tight layout */
.film_list .film_list-wrap {
    margin: -0.05rem -0.05rem !important;
    justify-content: flex-start !important;
}

.film_list .film_list-wrap .flw-item {
    margin: 0.05rem 0.05rem !important;
}

/* Base improvements for all screens */
.flw-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.flw-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

/* ============================================
   ENHANCED POSTER STYLES
   ============================================ */

.film-poster-img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flw-item:hover .film-poster-img {
    transform: scale(1.08);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   Adjusts the existing .flw-item width for different screens
   ============================================ */

/* Ultra Wide Screens (2560px+) - 8 columns */
@media (min-width: 2560px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(12.5% - 0.1rem) !important;
    }
}

/* Extra Large Screens (1920px - 2559px) - 7 columns */
@media (min-width: 1920px) and (max-width: 2559px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(14.28% - 0.1rem) !important;
    }
}

/* Large Desktop (1600px - 1919px) - 6 columns */
@media (min-width: 1600px) and (max-width: 1919px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(16.66% - 0.1rem) !important;
    }
}

/* Desktop (1200px - 1599px) - 5 columns */
@media (min-width: 1200px) and (max-width: 1599px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(20% - 0.1rem) !important;
    }
}

/* Small Desktop / Large Tablet (992px - 1199px) - 4 columns */
@media (min-width: 992px) and (max-width: 1199px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(25% - 0.1rem) !important;
    }

    .block_area .block_area-header .cat-heading {
        font-size: 20px !important;
    }
}

/* Tablet (768px - 991px) - 3 columns */
@media (min-width: 768px) and (max-width: 991px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(33.33% - 0.1rem) !important;
    }

    .block_area .block_area-header .cat-heading {
        font-size: 18px !important;
    }

    .film-poster-ahref i {
        font-size: 28px !important;
    }
}

/* Mobile Landscape (576px - 767px) - 2 columns */
@media (min-width: 576px) and (max-width: 767px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(50% - 0.8rem) !important;
        margin: 0.5rem 0.4rem !important;
    }

    .film_list .film_list-wrap {
        margin: -0.5rem -0.4rem !important;
    }

    .block_area .block_area-header .cat-heading {
        font-size: 16px !important;
    }

    .film_list .film_list-wrap .flw-item .film-detail .film-name {
        font-size: 0.9em !important;
    }

    .film-poster-ahref i {
        font-size: 24px !important;
    }
}

/* Mobile Portrait (400px - 575px) - 2 columns */
@media (min-width: 400px) and (max-width: 575px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(50% - 0.8rem) !important;
        margin: 0.5rem 0.4rem !important;
    }

    .film_list .film_list-wrap {
        margin: -0.5rem -0.4rem !important;
    }

    .block_area {
        margin-bottom: 2rem !important;
    }

    .block_area .block_area-header {
        margin-bottom: 1rem !important;
    }

    .block_area .block_area-header .cat-heading {
        font-size: 16px !important;
    }

    .film_list .film_list-wrap .flw-item .film-detail .film-name {
        font-size: 0.85em !important;
    }

    .film_list .film_list-wrap .flw-item .film-detail .fd-infor {
        font-size: 0.75em !important;
    }

    .film-poster-ahref i {
        font-size: 24px !important;
    }

    .tick-item {
        font-size: 10px !important;
        padding: 0 5px !important;
        height: 18px !important;
    }

    .flw-item:hover {
        transform: translateY(-4px);
    }
}

/* Small Mobile (320px - 399px) - 2 columns (very tight) */
@media (max-width: 399px) {
    .film_list .film_list-wrap .flw-item {
        width: calc(50% - 0.6rem) !important;
        margin: 0.4rem 0.3rem !important;
    }

    .film_list .film_list-wrap {
        margin: -0.4rem -0.3rem !important;
    }

    .block_area {
        margin-bottom: 1.5rem !important;
    }

    .block_area .block_area-header {
        margin-bottom: 0.8rem !important;
    }

    .block_area .block_area-header .cat-heading {
        font-size: 14px !important;
    }

    .film_list .film_list-wrap .flw-item .film-poster {
        margin-bottom: 0.3rem !important;
    }

    .film_list .film_list-wrap .flw-item .film-detail .film-name {
        font-size: 0.8em !important;
        margin-bottom: 0.3rem !important;
    }

    .film_list .film_list-wrap .flw-item .film-detail .fd-infor {
        font-size: 0.7em !important;
    }

    .film-poster-ahref i {
        font-size: 20px !important;
    }

    .tick-item {
        font-size: 9px !important;
        padding: 0 4px !important;
        height: 16px !important;
    }

    .film-poster .tick {
        bottom: 8px !important;
    }

    .film-poster .tick.ltr {
        left: 8px !important;
    }

    .flw-item:hover {
        transform: translateY(-2px);
    }
}

/* ============================================
   ENHANCED PAGE HEADER
   ============================================ */

.block_area-header-filter .block_area-header {
    padding: 20px 0;
    border-bottom: 2px solid rgba(255, 186, 222, 0.2);
}

.bah-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.cat-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-heading i {
    color: #FFBADE;
}

.bah-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 14px;
    background: rgba(255, 186, 222, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(255, 186, 222, 0.2);
}

@media (max-width: 767px) {
    .bah-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .bah-count {
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* ============================================
   ENHANCED PAGINATION
   ============================================ */

.pagination-wrapper {
    margin-top: 30px;
    padding: 20px 0;
}

.pre-pagination .pagination .page-item .page-link {
    transition: all 0.2s ease;
}

.pre-pagination .pagination .page-item .page-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 186, 222, 0.2);
}

.pre-pagination .pagination .page-item.active .page-link {
    box-shadow: 0 4px 12px rgba(255, 186, 222, 0.4);
}

@media (max-width: 575px) {
    .pre-pagination .pagination-lg .page-item .page-link {
        padding: 0 8px !important;
        line-height: 32px !important;
        font-size: 14px !important;
        min-width: 32px !important;
    }

    .pre-pagination .pagination .page-item {
        margin: 3px !important;
    }

    .pagination-wrapper {
        margin-top: 20px;
        padding: 15px 0;
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.block_area-content.text-center {
    padding: 60px 20px;
}

.text-center .fa-inbox {
    color: rgba(255, 186, 222, 0.3);
}

.text-center h3 {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    margin-top: 15px;
}

@media (max-width: 575px) {
    .block_area-content.text-center {
        padding: 40px 15px;
    }

    .text-center .fa-inbox {
        font-size: 3rem !important;
    }

    .text-center h3 {
        font-size: 1.2rem !important;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.flw-item:focus-within {
    outline: 2px solid #FFBADE;
    outline-offset: 2px;
}

.page-link:focus {
    outline: 2px solid #FFBADE;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    .flw-item,
    .film-poster-img,
    .page-link {
        transition: none !important;
    }

    .flw-item:hover {
        transform: none !important;
    }

    .flw-item:hover .film-poster-img {
        transform: none !important;
    }
}

/* ============================================
   CONTAINER PADDING ADJUSTMENTS FOR MOBILE
   ============================================ */

@media (max-width: 767px) {
    .container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

@media (max-width: 575px) {
    #main-wrapper {
        margin-bottom: 40px !important;
    }
}