/* ============================================================
   PRODUCTS PAGE
   Font: Poppins loaded via functions.php
============================================================ */

.products-page {
    background: #f8fafc;
    font-family: 'Poppins', Arial, sans-serif;
}

.products-container {
    width: min(1280px, 94%);
    margin: 0 auto;
    min-width: 0;
}


/* ============================================================
   BREADCRUMB
============================================================ */

.products-breadcrumb {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 0;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.breadcrumb-nav a {
    font-size: 13px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-nav a:hover {
    color: #1d4ed8;
}

.breadcrumb-sep {
    color: #9ca3af;
    display: flex;
    align-items: center;
}

.breadcrumb-current {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}


/* ============================================================
   PAGE HEADER
============================================================ */

.products-page-header {
    background: #ffffff;
    padding: 36px 0 28px;
    border-bottom: 1px solid #e5e7eb;
}

.products-page-header h1 {
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.products-page-header p {
    font-size: 15px;
    color: #6b7280;
}


/* ============================================================
   CATEGORY NAV
============================================================ */

.category-nav-wrap {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-bar .category-nav-wrap {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .category-nav-wrap {
        top: 46px;
    }
}

.category-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 12px 0;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    border: 1.5px solid #e5e7eb;
    border-radius: 50px;
    background: transparent;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cat-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.cat-btn.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
}


/* ============================================================
   LAYOUT — SIDEBAR + PRODUCTS
============================================================ */

.products-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    padding: 28px 0 60px;
    align-items: start;
    min-width: 0;
}


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

.filter-sidebar {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    position: sticky;
    top: 110px;
}

.admin-bar .filter-sidebar {
    top: 142px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-header span {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

.sidebar-reset {
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
    transition: color 0.2s;
}

.sidebar-reset:hover {
    color: #1d4ed8;
}

.filter-group {
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid #f1f5f9;
}

.filter-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.filter-group-title {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
}

.filter-check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 9px;
    cursor: pointer;
}

.filter-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-check span {
    font-size: 13px;
    color: #374151;
    font-weight: 400;
}

.filter-check:hover span {
    color: #2563eb;
}


/* ============================================================
   PRICE RANGE
============================================================ */

.price-range-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.price-range-wrap input[type="range"] {
    width: 100%;
    accent-color: #2563eb;
    cursor: pointer;
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}


/* ============================================================
   PRODUCTS AREA
============================================================ */

.products-area {
    min-width: 0;
}


/* ============================================================
   TOOLBAR
============================================================ */

.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.products-count {
    font-size: 14px;
    color: #6b7280;
}

.products-count strong {
    color: #111827;
    font-weight: 700;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filter-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-wrap label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.sort-select {
    padding: 8px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    font-family: inherit;
    background: #ffffff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.sort-select:focus {
    border-color: #2563eb;
}


/* ============================================================
   PRODUCT GRID
============================================================ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    min-width: 0;
}


/* ============================================================
   PRODUCT CARD
============================================================ */

.product-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        box-shadow 0.25s ease,
        transform 0.25s ease,
        border-color 0.25s ease;
}

.product-card:hover {
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.1);
    transform: translateY(-4px);
    border-color: #bfdbfe;
}


/* ============================================================
   PRODUCT IMAGE
============================================================ */

.product-img-wrap {
    position: relative;
    overflow: hidden;
    background: #f0f7ff;
    height: 200px;
    flex-shrink: 0;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    padding: 12px;
    transition: transform 0.4s ease;
    box-sizing: border-box;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.product-card:hover .product-img-overlay {
    opacity: 1;
}

.quick-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: #ffffff;
    color: #111827;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    font-family: inherit;
    transition: background 0.2s;
}

.quick-view-btn:hover {
    background: #eff6ff;
    color: #2563eb;
}


/* ============================================================
   BADGES
============================================================ */

.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-new {
    background: #dcfce7;
    color: #15803d;
}

.badge-sale {
    background: #fef3c7;
    color: #b45309;
}

.badge-bestseller {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-refurbished {
    background: #f3e8ff;
    color: #7c3aed;
}


/* ============================================================
   PRODUCT BODY
============================================================ */

.product-body {
    padding: 16px 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.product-cat {
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.product-name {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    margin: 0;
}

.product-name a {
    color: inherit;
    text-decoration: none;
}

.product-name a:hover {
    color: #2563eb;
}

.product-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.stars {
    display: flex;
    align-items: center;
    gap: 1px;
}

.rating-val {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
}

.rating-count {
    font-size: 11px;
    color: #9ca3af;
}


/* ============================================================
   PRODUCT PRICE
============================================================ */

.product-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.product-price {
    font-size: 17px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.3px;
}

.product-price del {
    color: #9ca3af;
    font-size: 13px;
    font-weight: 400;
    margin-right: 6px;
}

.product-price ins {
    text-decoration: none;
    color: #111827;
    font-weight: 800;
}

.product-old-price {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: line-through;
    font-weight: 400;
}

.product-discount {
    font-size: 11px;
    font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    padding: 2px 7px;
    border-radius: 4px;
}


/* ============================================================
   PRODUCT FOOTER
============================================================ */

.product-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid #f1f5f9;
}

.btn-add-cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    background: #2563eb;
    color: #ffffff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-add-cart:hover {
    background: #1d4ed8;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-view-details {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    color: #374151;
    text-decoration: none;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-view-details:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}


/* ============================================================
   EMPTY STATE
============================================================ */

.products-empty {
    text-align: center;
    padding: 80px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.empty-icon {
    margin-bottom: 16px;
}

.products-empty h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.products-empty p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

.empty-reset-btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 24px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.empty-reset-btn:hover {
    background: #1d4ed8;
}


/* ============================================================
   PAGINATION
============================================================ */

.products-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: #2563eb;
    color: #2563eb;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-num {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.page-num:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.page-num.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}


/* ============================================================
   MOBILE FILTER DRAWER
============================================================ */

.mobile-filter-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, calc(100vw - 20px));
    height: 100dvh;
    background: #ffffff;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.12);
}

.mobile-filter-drawer.is-open {
    transform: translateX(0);
}

.mfd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

.mfd-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    transition: background 0.2s;
}

.mfd-close:hover {
    background: #e2e8f0;
}

.mfd-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.mfd-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
}

.mfd-apply {
    width: 100%;
    padding: 13px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.mfd-apply:hover {
    background: #1d4ed8;
}

.mfd-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mfd-backdrop.is-visible {
    opacity: 1;
    pointer-events: all;
}


/* ============================================================
   RESPONSIVE
============================================================ */

/* Large desktop — 4 columns */
@media (min-width: 1200px) {

    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* Tablet landscape */
@media (max-width: 1100px) {

    .products-layout {
        grid-template-columns: 220px 1fr;
        gap: 20px;
    }
}


/* Tablet portrait — hide sidebar, show filter button */
@media (max-width: 900px) {

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

    .filter-sidebar {
        display: none;
    }

    .mobile-filter-btn {
        display: inline-flex;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}


/* Mobile */
@media (max-width: 540px) {

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-name {
        font-size: 13px;
    }

    .product-price {
        font-size: 15px;
    }

    .btn-add-cart {
        font-size: 12px;
        padding: 9px 10px;
    }

    .sort-wrap label {
        display: none;
    }

    .products-breadcrumb,
    .breadcrumb-nav {
        padding-left: 4%;
        padding-right: 4%;
    }

    .products-page-header {
        padding-left: 4%;
        padding-right: 4%;
    }
}


/* Small mobile */
@media (max-width: 380px) {

    .products-grid {
        grid-template-columns: 1fr;
    }
}
