/* ── Shop Facet Sidebar  ─────────────────────────────────────────── */
/* Layout container: sidebar + product grid side-by-side              */
/* ----------------------------------------------------------------- */

/* Layout wrapper -------------------------------------------------- */
.mk-shop-layout {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    align-items: flex-start;
}

/* Sidebar --------------------------------------------------------- */
.mk-facet-sidebar {
    flex: 0 0 260px;
    max-width: 260px;
    position: sticky;
    top: 100px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c4c4c4 transparent;
}

.mk-facet-sidebar::-webkit-scrollbar {
    width: 5px;
}
.mk-facet-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.mk-facet-sidebar::-webkit-scrollbar-thumb {
    background-color: #c4c4c4;
    border-radius: 10px;
}

/* Header ---------------------------------------------------------- */
.mk-facet-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
}

.mk-facet-sidebar__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mk-facet-sidebar__title i {
    color: #6366f1;
    font-size: 0.9rem;
}

.mk-facet-sidebar__clear {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.mk-facet-sidebar__clear:hover {
    background: #eef2ff;
    color: #4f46e5;
}

/* Facet group ----------------------------------------------------- */
.mk-facet-group {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.mk-facet-group:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.mk-facet-group__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 0.6rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.mk-facet-group__toggle {
    font-size: 0.65rem;
    color: #9ca3af;
    transition: transform 0.25s;
}

.mk-facet-group.collapsed .mk-facet-group__toggle {
    transform: rotate(-90deg);
}

.mk-facet-group.collapsed .mk-facet-group__body {
    display: none;
}

/* Facet option (checkbox row) ------------------------------------- */
.mk-facet-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 5px 6px;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.82rem;
    color: #4b5563;
    line-height: 1.3;
}

.mk-facet-option:hover {
    background: #f9fafb;
}

/* Hide native checkbox */
.mk-facet-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom checkmark */
.mk-facet-option__checkmark {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    position: relative;
    transition: all 0.2s;
}

.mk-facet-option input:checked ~ .mk-facet-option__checkmark {
    background: #6366f1;
    border-color: #6366f1;
}

.mk-facet-option input:checked ~ .mk-facet-option__checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mk-facet-option__label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mk-facet-option__count {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: #9ca3af;
    font-weight: 500;
}

/* Active filters tags --------------------------------------------- */
.mk-facet-active {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 2px solid #f3f4f6;
}

.mk-facet-active__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.5rem;
}

.mk-facet-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.mk-facet-tag:hover {
    background: #e0e7ff;
}

.mk-facet-tag i {
    font-size: 0.6rem;
}

/* No results message ---------------------------------------------- */
.mk-facet-no-results {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
    font-size: 1rem;
}

.mk-facet-no-results i {
    font-size: 2.5rem;
    color: #d1d5db;
    display: block;
    margin-bottom: 1rem;
}

.mk-facet-no-results__text {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.mk-facet-no-results__sub {
    font-size: 0.85rem;
}

/* Product grid — main content area fills remaining space ---------- */
.mk-shop-layout #primary {
    flex: 1;
    min-width: 0;
}

.mk-shop-layout .site-main {
    width: 100%;
}

/* Products grid override inside layout */
.mk-shop-layout ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mk-shop-layout ul.products li.product {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0;
}

/* Result count & ordering bar */
.mk-shop-layout .woocommerce-result-count,
.mk-shop-layout .woocommerce-ordering {
    margin-bottom: 1rem;
}

/* Mobile filter toggle -------------------------------------------- */
.mk-facet-mobile-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.mk-facet-mobile-toggle:hover {
    background: #4f46e5;
}

/* Mobile close button inside sidebar */
.mk-facet-sidebar__mobile-close {
    display: none;
    width: 100%;
    padding: 12px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.mk-facet-sidebar__mobile-close:hover {
    background: #e5e7eb;
}

/* Filtered-out product hide animation */
.mk-shop-layout ul.products li.product {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.mk-shop-layout ul.products li.product.mk-filtered-out {
    opacity: 0;
    transform: scale(0.95);
    position: absolute;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Responsive --------------------------------------------------- */

@media (max-width: 991px) {
    .mk-shop-layout {
        flex-direction: column;
    }

    .mk-facet-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        max-width: 85vw;
        flex: none;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 10000;
        transition: left 0.3s ease;
        box-shadow: none;
        border: none;
        padding: 1.5rem;
    }

    .mk-facet-sidebar.mk-sidebar-open {
        left: 0;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
    }

    .mk-facet-mobile-toggle {
        display: inline-flex;
    }

    .mk-facet-sidebar__mobile-close {
        display: block;
    }

    /* Overlay behind sidebar */
    .mk-facet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9999;
    }

    .mk-facet-overlay.active {
        display: block;
    }

    .mk-shop-layout ul.products {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 575px) {
    .mk-shop-layout {
        padding: 0 0.5rem;
    }

    .mk-shop-layout ul.products {
        grid-template-columns: 1fr;
    }
}
