/* ============================================================
   MJ Fashion Gallery — Shop Filters & Product Cards
   Mobile-first responsive design
   ============================================================ */

/* ---- Archive Page Container ---- */
.mj-shop-archive {
    background: #f5f5f5;
}

/* ---- Two-Column Layout (sidebar + products) ---- */
.mj-shop-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

/* ---- Products Area ---- */
.mj-shop-products {
    flex: 1;
    min-width: 0;
}

/* ============================================================
   FILTER SIDEBAR
   ============================================================ */

.mj-filter-sidebar {
    width: 250px;
    min-width: 250px;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #f0f0f0;
}

.mj-filter-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e91e63;
}

.mj-filter-sidebar__header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.mj-filter-sidebar__close {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.mj-filter-sidebar__close:hover {
    color: #e91e63;
}

.mj-filter-sidebar__body {
    display: flex;
    flex-direction: column;
}

.mj-filter-sidebar__footer {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid #eee;
}

.mj-filter-apply-btn {
    width: 100%;
    padding: 12px;
    background: #e91e63;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.mj-filter-apply-btn:hover {
    background: #c2185b;
}

.mj-filter-clear-btn {
    width: 100%;
    padding: 10px;
    background: none;
    color: #888;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mj-filter-clear-btn:hover {
    border-color: #e91e63;
    color: #e91e63;
}

/* ---- Filter Section (collapsible) ---- */
.mj-filter-section {
    border-bottom: 1px solid #f0f0f0;
}

.mj-filter-section:last-child {
    border-bottom: none;
}

.mj-filter-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mj-filter-section__title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mj-filter-section__toggle {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    color: #bbb;
}

.mj-filter-section.collapsed .mj-filter-section__toggle {
    transform: rotate(-90deg);
}

.mj-filter-section__content {
    padding-bottom: 12px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.mj-filter-section.collapsed .mj-filter-section__content {
    max-height: 0 !important;
    padding-bottom: 0;
    opacity: 0;
}

/* ---- Category Links ---- */
.mj-filter-categories {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mj-filter-categories li {
    margin-bottom: 1px;
}

.mj-filter-categories a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
    transition: all 0.15s;
}

.mj-filter-categories a:hover,
.mj-filter-categories a.active {
    background: #fce4ec;
    color: #e91e63;
}

.mj-filter-categories a.active {
    font-weight: 600;
}

.mj-filter-categories .count {
    font-size: 0.7rem;
    color: #999;
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 10px;
}

.mj-filter-categories a:hover .count,
.mj-filter-categories a.active .count {
    background: #f8bbd0;
    color: #e91e63;
}

/* ---- Checkbox Filters (Brands) ---- */
.mj-filter-checkbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.mj-filter-checkbox-list li {
    margin-bottom: 1px;
}

.mj-filter-checkbox-list label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.mj-filter-checkbox-list label:hover {
    background: #fce4ec;
}

.mj-filter-checkbox-list input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mj-filter-checkbox-list input[type="checkbox"]:checked {
    background: #e91e63;
    border-color: #e91e63;
}

.mj-filter-checkbox-list input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.mj-filter-checkbox-list .count {
    font-size: 0.7rem;
    color: #999;
    margin-left: auto;
}

/* ---- Price Range ---- */
.mj-filter-price {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mj-filter-price__inputs {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.mj-filter-price__field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mj-filter-price__field span {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.mj-filter-price__field input {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1a1a1a;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.mj-filter-price__field input:focus {
    outline: none;
    border-color: #e91e63;
    box-shadow: 0 0 0 2px rgba(233, 30, 99, 0.1);
}

.mj-filter-price__separator {
    color: #ccc;
    font-size: 1rem;
    padding-bottom: 10px;
}

.mj-filter-price__btn {
    padding: 9px 16px;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.mj-filter-price__btn:hover {
    background: #e91e63;
    color: #fff;
}

/* ---- Availability ---- */
.mj-filter-availability label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    -webkit-tap-highlight-color: transparent;
}

.mj-filter-availability input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mj-filter-availability input[type="checkbox"]:checked {
    background: #4caf50;
    border-color: #4caf50;
}

.mj-filter-availability input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ---- Active Filter Tags ---- */
.mj-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    min-height: 0;
}

.mj-active-filters:empty {
    margin-bottom: 0;
}

.mj-active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #fce4ec;
    color: #e91e63;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 500;
}

.mj-active-filter-tag__remove {
    background: none;
    border: none;
    color: #e91e63;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.mj-active-filter-tag__remove:hover {
    opacity: 1;
}

/* ---- Toolbar (Sort + Mobile Filter Button) ---- */
.mj-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}

.mj-filter-toggle-btn {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mj-filter-toggle-btn:hover {
    border-color: #e91e63;
    color: #e91e63;
}

.mj-shop-toolbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ---- Overlay ---- */
.mj-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.mj-filter-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   PRODUCT CARDS
   ============================================================ */

/* Force CSS Grid over WooCommerce flexbox */
.mj-shop-archive .mj-product-grid .products-block-post-template {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px !important;
    align-items: stretch !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Card container */
.mj-shop-archive .mj-product-grid .products-block-post-template > li {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    display: flex !important;
    flex-direction: column !important;
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.mj-shop-archive .mj-product-grid .products-block-post-template > li:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

/* Product Image — square, covers area */
.mj-shop-archive .wc-block-components-product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #fafafa;
    flex-shrink: 0;
}

.mj-shop-archive .wc-block-components-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.mj-shop-archive .wc-block-components-product-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    transition: transform 0.4s ease;
}

.mj-shop-archive .mj-product-grid > li:hover .wc-block-components-product-image img {
    transform: scale(1.05);
}

/* Hide extra inner container */
.mj-shop-archive .wc-block-components-product-image__inner-container {
    display: none !important;
}

/* Sale Badge */
.mj-shop-archive .wc-block-components-product-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

.mj-shop-archive .wc-block-components-product-sale-badge__text {
    background: #e91e63;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Product Title */
.mj-shop-archive .mj-product-grid .wp-block-post-title {
    margin: 0 !important;
    padding: 12px 14px 0;
    font-size: inherit !important;
}

.mj-shop-archive .mj-product-grid .wp-block-post-title a {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 0.88rem !important;
    font-weight: 600;
    line-height: 1.45 !important;
    transition: color 0.2s;
}

.mj-shop-archive .mj-product-grid .wp-block-post-title a:hover {
    color: #e91e63;
}

/* Product Price */
.mj-shop-archive .mj-product-grid .wp-block-woocommerce-product-price {
    padding: 8px 14px 0;
    margin: 0 !important;
}

.mj-shop-archive .mj-product-grid .wc-block-components-product-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e91e63;
}

.mj-shop-archive .mj-product-grid .wc-block-components-product-price del {
    font-size: 0.82rem;
    font-weight: 400;
    color: #aaa;
    margin-right: 6px;
}

.mj-shop-archive .mj-product-grid .wc-block-components-product-price ins {
    text-decoration: none;
    font-weight: 700;
    color: #e91e63;
}

/* Add to Cart Button */
.mj-shop-archive .mj-product-grid .wp-block-woocommerce-product-button {
    padding: 10px 14px 14px;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

.mj-shop-archive .mj-product-grid .wc-block-components-product-button__button,
.mj-shop-archive .mj-product-grid .wp-block-button__link {
    width: 100% !important;
    display: block !important;
    background: #e91e63 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 10px 16px !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.2s !important;
    text-align: center !important;
    text-decoration: none !important;
    box-sizing: border-box;
    min-height: 42px;
}

.mj-shop-archive .mj-product-grid .wc-block-components-product-button__button:hover,
.mj-shop-archive .mj-product-grid .wp-block-button__link:hover {
    background: #c2185b !important;
}

/* View cart link */
.mj-shop-archive .mj-product-grid .added_to_cart {
    display: block;
    text-align: center;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #e91e63;
    text-decoration: none;
}

/* Loading state */
.mj-shop-products.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ============================================================
   RESPONSIVE — Tablet (max-width: 1024px)
   ============================================================ */

@media (max-width: 1024px) {
    .mj-filter-sidebar {
        width: 230px;
        min-width: 230px;
        padding: 16px;
    }

    .mj-shop-layout {
        gap: 20px;
    }

    .mj-shop-archive .mj-product-grid .products-block-post-template {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 14px !important;
    }

    .mj-shop-archive .mj-product-grid .wp-block-post-title a {
        font-size: 0.82rem !important;
    }

    .mj-shop-archive .mj-product-grid .wc-block-components-product-price {
        font-size: 0.95rem;
    }
}

/* ============================================================
   RESPONSIVE — Mobile (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {
    /* Stack layout: sidebar hidden, products full-width */
    .mj-shop-layout {
        flex-direction: column;
        gap: 0;
    }

    /* Sidebar → slide-out drawer */
    .mj-filter-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        min-width: auto;
        height: 100dvh;
        max-height: 100dvh;
        z-index: 999;
        background: #fff;
        padding: 20px;
        border-radius: 0;
        border: none;
        box-shadow: none;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mj-filter-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.2);
    }

    .mj-filter-sidebar__close {
        display: block;
    }

    .mj-filter-sidebar__footer {
        display: flex;
    }

    .mj-filter-sidebar__header {
        border-bottom-width: 2px;
    }

    /* Show filter toggle button on mobile */
    .mj-filter-toggle-btn {
        display: flex;
    }

    /* Toolbar full width */
    .mj-shop-toolbar {
        padding: 10px 12px;
        margin-bottom: 12px;
    }

    /* 2-column product grid */
    .mj-shop-archive .mj-product-grid .products-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .mj-shop-archive .mj-product-grid .wp-block-post-title a {
        font-size: 0.78rem !important;
        line-height: 1.35 !important;
    }

    .mj-shop-archive .mj-product-grid .wp-block-post-title {
        padding: 8px 10px 0;
    }

    .mj-shop-archive .mj-product-grid .wp-block-woocommerce-product-price {
        padding: 4px 10px 0;
    }

    .mj-shop-archive .mj-product-grid .wc-block-components-product-price {
        font-size: 0.92rem;
    }

    .mj-shop-archive .mj-product-grid .wp-block-woocommerce-product-button {
        padding: 8px 10px 10px;
    }

    .mj-shop-archive .mj-product-grid .wc-block-components-product-button__button,
    .mj-shop-archive .mj-product-grid .wp-block-button__link {
        padding: 8px 12px !important;
        font-size: 0.76rem !important;
        min-height: 36px;
    }

    /* Smaller sale badges */
    .mj-shop-archive .wc-block-components-product-sale-badge__text {
        font-size: 0.6rem;
        padding: 2px 7px;
    }

    /* Breadcrumb & title */
    .mj-shop-archive .mj-breadcrumb {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }

    .mj-shop-archive [style*="padding-left:32px"] {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* ============================================================
   RESPONSIVE — Small Mobile (max-width: 480px)
   ============================================================ */

@media (max-width: 480px) {
    .mj-shop-archive .mj-product-grid .products-block-post-template {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .mj-shop-archive .mj-product-grid .products-block-post-template > li {
        border-radius: 8px;
    }

    .mj-shop-archive .mj-product-grid .wp-block-post-title a {
        font-size: 0.74rem !important;
    }

    .mj-shop-archive .mj-product-grid .wc-block-components-product-price {
        font-size: 0.85rem;
    }

    .mj-shop-archive .mj-product-grid .wc-block-components-product-button__button,
    .mj-shop-archive .mj-product-grid .wp-block-button__link {
        padding: 7px 10px !important;
        font-size: 0.72rem !important;
        border-radius: 20px !important;
        min-height: 34px;
    }

    .mj-filter-sidebar {
        width: 280px;
    }

    .mj-shop-toolbar {
        padding: 8px 10px;
        gap: 8px;
    }

    .mj-filter-toggle-btn {
        padding: 8px 14px;
        font-size: 0.82rem;
    }
}
