/* 🔹 Mobile Drawer */
#filterDrawer {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 60vh;
    background-color: #fff;
    z-index: 9999;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.15);
    transition: bottom 0.3s ease-in-out;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#filterDrawer.open {
    bottom: 0;
}

/* 🔹 Header με τίτλο στο κέντρο και Χ δεξιά */
.filter-drawer-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.filter-drawer-header h2.filter-title {
    margin: 0;
    font-size: 18px;
    font-weight: bold;
}

/* 🔹 ΜΟΝΟ το Χ χωρίς background */
.filter-drawer-header .close-popup {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: normal;
    line-height: 1;
    color: #333;
    cursor: pointer;
    padding: 0;
    width: auto;
    height: auto;
}

/* 🔹 Floating κουμπί "Φίλτρα" */
#filterBtnMobile {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: #00bfa6;
    color: white;
    font-weight: bold;
    padding: 12px 18px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 9999;
    cursor: pointer;
}

/* 🔹 Εσωτερικό swipeable περιεχόμενο */
.filter-drawer-inner {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid #ddd;
}

/* Layout: Αριστερά tabs / δεξιά values */
.acf-filter-ui {
    display: flex;
    height: 100%;
    min-height: 300px;
}

.acf-keys {
    width: 40%;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    padding: 10px 5px;
    background: #fff;
}

.acf-keys ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.acf-keys li {
    padding: 10px;
    margin: 6px 0;
    background: #f2f2f2;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s ease;
}

.acf-keys li.active {
    background: #daaa00;
    color: white;
    font-weight: bold;
}

.acf-values {
    width: 60%;
    padding: 10px;
    overflow-y: auto;
    background: #fff;
}

.acf-value-set {
    display: none;
}

.acf-value-set.active {
    display: block;
}

.acf-value-set label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    text-align: left;
}

/* Footer */
.filter-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    border-top: 1px solid #ddd;
    background: #fff;
}

.clear-btn {
    background: #f2f2f2;
    color: #333;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 14px;
    border: none;
}

.apply-btn {
    background: #ff6600;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 14px;
    border: none;
}

/* Desktop filters off */
.acf-filter-desktop {
    display: none;
}


/* 🔹 Desktop layout */
@media screen and (min-width: 1024px) {
    #filterDrawer {
        /* αναιρεί το bottom:-100% του mobile */
        bottom: auto;
        top: 180px;
        left: calc(50% - 600px - 280px);
        width: 250px;
        height: auto;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        z-index: 10;

        /* (προαιρετικό) αν είχες overflow:hidden, άσε το περιεχόμενο να φαίνεται */
        overflow: visible;
    }

    .products-container {
        max-width: 1200px;
        margin: 0 auto;
        position: relative;
        z-index: 1;
    }

    .pns-layout {
        display: block;
    }

    #filterBtnMobile,
    .filter-footer,
    .filter-drawer-header .close-popup {
        display: none !important;
    }

    .acf-filter-ui {
        display: none !important;
    }

    .acf-filter-desktop {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .acf-filter-block {
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }

    .acf-filter-label {
        font-weight: bold;
        font-size: 15px;
        margin-bottom: 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .acf-filter-values label {
        display: block;
        font-size: 14px;
        margin-bottom: 6px;
    }
}

/* 🔹 Κατάσταση φόρτωσης */
.products-container {
    position: relative;
}

.products-container.loading {
    filter: blur(3px);
    opacity: 0.6;
    pointer-events: none;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.products-container.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00bfa6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10;
}

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

/* 🔹 Pagination */
.custom-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 20px 0;
    padding: 0;
}

.custom-pagination li {
    margin: 0 10px;
    font-size: 18px;
    line-height: 1;
}

.custom-pagination li a {
    text-decoration: none;
    color: inherit;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 50%;
    display: inline-block;
}

.custom-pagination .current-page {
    font-weight: bold;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 50%;
}

.custom-pagination .prev-page,
.custom-pagination .next-page {
    border: none;
    border-radius: 0;
    background: none;
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}


