/* Specificity artırıldı: body id'si ile başlıyoruz */

/* Masaüstü Görünüm İçin Varsayılan Gizlemeler */
body .mobile-filter-close {
    display: none;
}

@media (max-width: 991px) {

    /* Toggle Button */
    body #mobile-filter-toggle {
        display: block !important;
        margin-bottom: 20px !important;
        font-size: 16px;
        font-weight: bold;
        padding: 12px;
    }

    /* Offcanvas Wrapper */
    body #page-archive .archive-sidebar-wrapper {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important; /* Başlangıçta gizli */
        width: 85% !important; /* Mobilde ekranın %85'ini kaplasın */
        max-width: 350px !important;
        height: 100vh !important;
        background: #1b1d1f !important; /* Tema arkaplan rengi */
        z-index: 99999 !important;
        overflow-y: auto !important;
        padding: 20px !important;
        margin: 0 !important;
        transition: left 0.3s ease-in-out !important;
        box-shadow: 5px 0 15px rgba(0,0,0,0.5) !important;
    }

    /* Active State for Offcanvas */
    body #page-archive .archive-sidebar-wrapper.active {
        left: 0 !important;
    }

    /* Body Overlay when Filter is Open */
    body.filter-open {
        overflow: hidden !important;
    }

    body.filter-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.7);
        z-index: 99998;
    }

    /* Close Button inside Offcanvas */
    body .mobile-filter-close {
        display: block !important;
        text-align: right;
        font-size: 16px;
        color: #fff;
        margin-bottom: 20px;
        cursor: pointer;
        padding-bottom: 10px;
        border-bottom: 1px solid #333;
    }

    body #page-archive .col-1 {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
    }

    /* Form elements inside col-2 */
    body #page-archive .col-2 .form-element {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    /* Sidebar Form Adjustments */
    body #search-criteria {
        background: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
    }
    
    body #search-criteria .title h4 {
        font-size: 18px !important;
        margin-bottom: 15px !important;
    }

    body #search-criteria .was-category-box {
        max-height: 220px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding-right: 5px !important;
    }

    body #page-archive .btn-checkbox {
        width: auto !important;
        margin: 0 !important;
        flex: 1 1 calc(50% - 6px) !important;
    }
    
    body #page-archive .btn-checkbox label {
        padding: 10px 5px !important;
        text-align: center !important;
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Inputs */
    body #search-criteria .form-control {
        height: 40px !important;
        font-size: 15px !important;
    }

    body #search-criteria .btn-primary {
        height: 45px !important;
        font-size: 16px !important;
        font-weight: bold !important;
        margin-top: 10px !important;
    }

    /* Archive Title & Sort Responsive */
    body #page-archive .col-1 .title {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        margin-bottom: 20px !important;
    }

    body #page-archive .col-1 .title h1.pull-left {
        float: none !important;
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    body #page-archive .col-1 .title .select-orderby.pull-right {
        float: none !important;
        width: 100% !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    body #page-archive .col-1 .title .select-orderby label {
        margin: 0 !important;
    }
}

/* Detailed Article Mobile Responsive (< 425px) */
@media (max-width: 425px) {
    body .detailed-article {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
    }
    
    body .detailed-article .big-cover {
        float: none !important;
        margin: 0 0 15px 0 !important;
        width: 140px !important;
        max-width: 100% !important;
        height: auto !important;
    }

    body .detailed-article .big-cover img {
        width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
    }
    
    body .detailed-article-container {
        width: 100% !important;
    }

    body .detailed-article .custom-fields-container {
        height: auto !important;
        margin: 10px 0 !important;
        line-height: 1.8 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5px !important;
    }
    
    body .detailed-article .custom-field {
        margin: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
    }

    body .detailed-article .post-summary {
        font-size: 14px !important;
        line-height: 1.6 !important;
    }
}

/* Grid System Fixes from page-best-series.css (Adapted for Archive) */
#recent-popular-episodes .rpe-poster-grid {
    width: 100%;
    display: flex !important;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
}

#recent-popular-episodes .rpe-poster-grid::before,
#recent-popular-episodes .rpe-poster-grid::after {
    display: none !important;
    content: none !important;
}

#recent-popular-episodes .rpe-poster-grid > .article-series-poster {
    display: block !important;
    flex: 0 0 calc(50% - 6px);
    max-width: calc(50% - 6px);
    width: calc(50% - 6px) !important;
    float: none !important;
    margin-right: 0 !important;
    clear: none !important;
    margin-bottom: 0 !important;
    border-radius: 10px;
    opacity: 1 !important;
    visibility: visible !important;
}

@media (min-width: 561px) {
    #recent-popular-episodes .rpe-poster-grid {
        gap: 14px;
    }

    #recent-popular-episodes .rpe-poster-grid > .article-series-poster {
        flex-basis: calc(33.3333% - 9.3333px);
        max-width: calc(33.3333% - 9.3333px);
        width: calc(33.3333% - 9.3333px) !important;
    }
}

/* Changed from 992px to 1025px to show 3 columns on 1024px screens */
@media (min-width: 992px) {
    #recent-popular-episodes .rpe-poster-grid {
        gap: 14px;
    }

    #recent-popular-episodes .rpe-poster-grid > .article-series-poster {
        flex-basis: calc(20% - 11.2px);
        max-width: calc(20% - 11.2px);
        width: calc(20% - 11.2px) !important;
    }
}

@media (max-width: 360px) {
    #recent-popular-episodes .rpe-poster-grid {
        gap: 10px;
    }

    #recent-popular-episodes .rpe-poster-grid > .article-series-poster {
        flex-basis: calc(50% - 5px);
        max-width: calc(50% - 5px);
        width: calc(50% - 5px) !important;
    }
}

@media (max-width: 320px) {
    #recent-popular-episodes .rpe-poster-grid {
        gap: 8px;
    }

    #recent-popular-episodes .rpe-poster-grid > .article-series-poster {
        flex-basis: calc(50% - 4px);
        max-width: calc(50% - 4px);
        width: calc(50% - 4px) !important;
    }
}

#recent-popular-episodes .article-series-poster > .figure-link {
    float: none !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

@supports (aspect-ratio: 1 / 1.375) {
    #recent-popular-episodes .article-series-poster > .figure-link {
        aspect-ratio: 1 / 1.375;
        height: auto !important;
    }
}

#recent-popular-episodes .article-series-poster .wp-post-image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    opacity: 1 !important;
    visibility: visible !important;
}

#recent-popular-episodes .article-series-poster a.figure-link {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

@supports not (aspect-ratio: 1 / 1) {
    #recent-popular-episodes .article-series-poster > .figure-link {
        height: 0 !important;
        padding-bottom: 137.5% !important;
    }
}

#recent-popular-episodes .thumbnail-figcaption {
    padding: 10px 10px;
    line-height: 1.2;
}

#recent-popular-episodes .article-series-poster .poster-title {
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal !important;
}

#recent-popular-episodes .article-series-poster .poster-meta {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

#recent-popular-episodes .article-series-poster .poster-meta .imdb,
#recent-popular-episodes .article-series-poster .poster-meta .release {
    float: none !important;
    width: auto !important;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#recent-popular-episodes .article-series-poster .poster-meta .imdb {
    flex: 1 1 auto;
    min-width: 0;
}

#recent-popular-episodes .article-series-poster .poster-meta .release {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
}

@media (min-width: 768px) {
    #recent-popular-episodes .thumbnail-figcaption {
        padding: 12px 12px;
    }

    #recent-popular-episodes .article-series-poster .poster-title {
        font-size: 14px;
    }

    #recent-popular-episodes .article-series-poster .poster-meta {
        font-size: 12.5px;
    }
}

/* Pagination Styles */
.woca-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 40px auto 30px;
    width: 100%;
    clear: both;
    gap: 8px;
    border: none !important;
}

.woca-pagination a, 
.woca-pagination span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    background-color: #232629;
    color: #adbac7;
    border-radius: 8px !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    float: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.woca-pagination a:hover {
    background-color: #31363b;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.woca-pagination .current {
    background-color: #ffd500;
    color: #000;
    border-color: #ffd500 !important;
    cursor: default;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(255, 213, 0, 0.2);
}

.woca-pagination .dots {
    background-color: transparent;
    border: none !important;
    color: #6c757d;
    box-shadow: none;
    cursor: default;
    min-width: 20px;
}

/* Mobile Responsive Pagination */
@media (max-width: 480px) {
    .woca-pagination {
        gap: 5px;
        margin-top: 25px;
    }
    
    .woca-pagination a, 
    .woca-pagination span {
        min-width: 34px;
        height: 34px;
        padding: 0 10px;
        font-size: 13px;
        border-radius: 6px !important;
    }
    
    /* Hide extra pages on very small screens, keep prev/next and current */
    .woca-pagination .dots {
        min-width: 10px;
        padding: 0 2px;
    }
}