/**
 * ==========================================================================
 * KHELLO PRODUCT LIST & CARDS STYLES (Optimized & Clean)
 * ==========================================================================
 */

.item-filter-section {
    background-color: #FFFFFF;
    min-height: 80vh;
}

/* --------------------------------------------------------------------------
 * Main Layout: Flex Container
 * -------------------------------------------------------------------------- */
.khello-main-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Desktop Layout (>= 992px) */
@media (min-width: 992px) {
    .khello-main-row {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        gap: 28px !important;
    }

    .khello-filter-col.offcanvas {
        width: 230px !important;
        min-width: 230px !important;
        max-width: 230px !important;
        flex: 0 0 230px !important;
        position: static !important;
        transform: none !important;
        visibility: visible !important;
        display: block !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        z-index: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .khello-filter-col .offcanvas-body {
        padding: 0 !important;
        overflow: visible !important;
    }

    .khello-products-col {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* Mobile & Tablet Offcanvas (< 992px) */
@media (max-width: 991.98px) {
    .khello-main-row {
        display: block !important;
    }

    .khello-filter-col.offcanvas {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        width: 320px !important;
        max-width: 88vw !important;
        background: #FFFFFF !important;
        z-index: 1050 !important;
        display: flex !important;
        flex-direction: column !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-in-out !important;
        visibility: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.15) !important;
        border: none !important;
    }

    .khello-filter-col.offcanvas.show {
        transform: none !important;
        visibility: visible !important;
    }

    .khello-filter-col .offcanvas-header {
        padding: 16px 20px !important;
        background: #FFFFFF !important;
        border-bottom: 1px solid #F3F4F6 !important;
        flex-shrink: 0 !important;
    }

    .khello-filter-col .offcanvas-body {
        padding: 20px 20px 32px 20px !important;
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        height: auto !important;
    }

    .khello-filter-sidebar {
        padding-right: 0 !important;
    }

    .khello-products-col {
        width: 100% !important;
        padding: 0 !important;
    }
}

/* --------------------------------------------------------------------------
 * Left Filter Sidebar
 * -------------------------------------------------------------------------- */
.khello-filter-sidebar {
    padding-right: 8px;
}

.khello-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.khello-filter-header-title {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.khello-filter-clear-btn {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #2563EB;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.khello-filter-clear-btn:hover {
    color: #1D4ED8;
    text-decoration: underline;
}

.khello-filter-group {
    margin-bottom: 24px;
}

.khello-filter-group-title {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

/* Filter Checkbox List */
.khello-filter-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.khello-filter-scroll {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.khello-filter-scroll::-webkit-scrollbar {
    width: 3px;
}

.khello-filter-scroll::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.khello-filter-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    user-select: none;
    width: 100%;
}

.khello-filter-item .form-check-input {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    border: 1.5px solid #D1D5DB;
    margin-top: 0;
    margin-right: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.khello-filter-item .form-check-input:checked {
    background-color: #2563EB;
    border-color: #2563EB;
}

.khello-filter-item .form-check-input:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    border-color: #2563EB;
}

.khello-filter-item-label {
    font-family: 'Poppins', sans-serif;
    font-size: 13.5px;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.khello-filter-item:hover .khello-filter-item-label {
    color: #111827;
}

.khello-filter-count {
    font-size: 12.5px;
    color: #6B7280;
    font-weight: 400;
}

/* Price Inputs & Slider */
.khello-price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.khello-price-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.khello-price-currency {
    position: absolute;
    left: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #6B7280;
    pointer-events: none;
}

.khello-price-field {
    width: 100%;
    padding: 7px 8px 7px 22px;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.khello-price-field:focus {
    border-color: #2563EB;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.khello-slider-wrapper {
    padding: 4px 2px;
}

.khello-price-slider {
    width: 100%;
    height: 4px;
    border-radius: 4px;
    accent-color: #2563EB;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
 * Top Bar (Right Toolbar)
 * -------------------------------------------------------------------------- */
.khello-products-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.khello-topbar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.khello-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.khello-sort-label {
    font-family: 'Poppins', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    color: #4B5563;
    white-space: nowrap;
}

.khello-sort-select {
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 7px 32px 7px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    min-width: 130px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.khello-sort-select:focus {
    border-color: #2563EB;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

/* Mobile Filter Trigger Button */
.khello-mobile-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.15s ease;
    height: 34px;
}

.khello-mobile-filter-btn:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
}

.khello-filter-active-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    background-color: #2563EB;
    color: #FFFFFF;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
}

/* View Switcher */
.khello-view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.khello-view-btn {
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.khello-view-btn:hover {
    color: #111827;
    background-color: #F9FAFB;
    border-color: #D1D5DB;
}

.khello-view-btn.active {
    background-color: #F3F4F6;
    color: #111827;
    border-color: #D1D5DB;
}

/* Responsive Topbar on Mobile / Tablet */
@media (max-width: 991.98px) {
    .khello-products-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .khello-topbar-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        margin-left: 0;
    }

    .khello-sort-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .khello-sort-select {
        flex-grow: 1;
        max-width: 220px;
    }

    .khello-topbar-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding-top: 2px;
    }
}

/* --------------------------------------------------------------------------
 * Product Grid: Responsive CSS Grid
 * -------------------------------------------------------------------------- */
.khello-products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    width: 100% !important;
}

/* 4-Columns on Desktop (>= 992px) */
@media (min-width: 992px) {
    .khello-products-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px !important;
    }
}

/* 3-Columns on Tablets (768px - 991.98px) */
@media (max-width: 991.98px) and (min-width: 768px) {
    .khello-products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 14px !important;
    }
}

/* 2-Columns on Mobile (361px - 767.98px) */
@media (max-width: 767.98px) {
    .khello-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
}

/* 1-Column on Tiny Mobile (<= 360px) */
@media (max-width: 360.98px) {
    .khello-products-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

/* List View Mode */
.khello-products-grid.list-view {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
}

.khello-product-card-wrap {
    width: 100%;
    min-width: 0;
}

.khello-no-products {
    grid-column: 1 / -1;
    width: 100%;
}

/* --------------------------------------------------------------------------
 * Product Card: Grid View
 * -------------------------------------------------------------------------- */
.khello-product-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 13px 13px 15px 13px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.khello-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.08);
    border-color: #CBD5E1;
}

/* Image Container */
.khello-product-img-box {
    position: relative;
    width: 100%;
    height: 165px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
    background: #FFFFFF;
}

.khello-product-img-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.khello-product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}

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

/* Floating Wishlist Button */
.khello-product-wishlist-wrap {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
}

.khello-product-wishlist-wrap .product-wishlist-btn {
    width: 32px;
    height: 32px;
    border-radius: 50% !important;
    background: #FFFFFF !important;
    border: 1px solid #E5E7EB !important;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    outline: none !important;
}

.khello-product-wishlist-wrap .product-wishlist-btn:hover {
    transform: scale(1.1);
    background: #FEF2F2 !important;
    border-color: #FCA5A5 !important;
}

/* Product Info */
.khello-product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.khello-product-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    min-height: 36px;
    margin-bottom: 4px;
}

.khello-product-title {
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    transition: color 0.15s ease;
}

.khello-product-title:hover {
    color: #2563EB;
}

/* Condition Badges */
.khello-condition-badge {
    font-family: 'Poppins', sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.3;
}

.badge-condition-likenew {
    background-color: #F3F4F6;
    color: #374151;
}

.badge-condition-good {
    background-color: #CCFBF1;
    color: #0F766E;
}

.badge-condition-new {
    background-color: #E0F2FE;
    color: #0284C7;
}

.badge-condition-fair {
    background-color: #FEF3C7;
    color: #B45309;
}

.badge-condition-used {
    background-color: #F3F4F6;
    color: #374151;
}

/* Price */
.khello-product-price {
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 6px 0 6px 0;
    letter-spacing: -0.01em;
}

/* Location */
.khello-product-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    color: #6B7280;
    font-weight: 400;
    margin-top: auto;
}

.khello-product-location svg {
    color: #9CA3AF;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
 * Product Card: List View
 * -------------------------------------------------------------------------- */
.khello-product-card.list-view {
    flex-direction: row;
    align-items: center;
    gap: 20px;
    padding: 16px;
}

.khello-product-card.list-view .khello-product-img-box {
    width: 160px;
    height: 140px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.khello-product-card.list-view .khello-product-info {
    height: 100%;
    justify-content: space-between;
}

.khello-product-card.list-view .khello-product-title-row {
    min-height: auto;
    margin-bottom: 6px;
}

.khello-product-card.list-view .khello-product-title {
    font-size: 15px;
    -webkit-line-clamp: 1;
}

.khello-product-card.list-view .khello-product-price {
    font-size: 18px;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
 * Pagination Styling
 * -------------------------------------------------------------------------- */
.khello-pagination-wrapper {
    margin-top: 36px;
    margin-bottom: 24px;
}

.khello-page-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    color: #6B7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.khello-page-nav-btn:hover:not(.disabled) {
    border-color: #2563EB;
    color: #2563EB;
    background: #F9FAFB;
}

.khello-page-nav-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #E5E7EB;
}

.khello-page-num {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #4B5563;
    font-size: 13.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    text-decoration: none;
}

.khello-page-num:hover:not(.active) {
    background-color: #F3F4F6;
    color: #111827;
}

.khello-page-num.active {
    background-color: #1D4ED8 !important;
    color: #FFFFFF !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3);
    cursor: default;
}

.khello-page-dots {
    padding: 0 3px;
    color: #9CA3AF;
    font-size: 13.5px;
    font-weight: 500;
}

.khello-page-next-link {
    border: none;
    background: transparent;
    color: #1D4ED8;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.khello-page-next-link:hover:not(.disabled) {
    color: #1E40AF;
    transform: translateX(2px);
}

.khello-page-next-link.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    color: #9CA3AF;
}

/* --------------------------------------------------------------------------
 * Mobile Specific Product Card Tweaks (< 576px)
 * -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .khello-product-card {
        padding: 10px 10px 12px 10px;
        border-radius: 12px;
    }

    .khello-product-img-box {
        height: 135px;
        margin-bottom: 8px;
    }

    .khello-product-wishlist-wrap .product-wishlist-btn {
        width: 28px;
        height: 28px;
    }

    .khello-product-wishlist-wrap .product-wishlist-btn svg {
        width: 15px;
        height: 15px;
    }

    .khello-product-title {
        font-size: 12px;
    }

    .khello-condition-badge {
        font-size: 9.5px;
        padding: 1.5px 5px;
    }

    .khello-product-price {
        font-size: 15px;
        margin: 4px 0 4px 0;
    }

    .khello-product-location {
        font-size: 11px;
    }

    .khello-product-card.list-view {
        flex-direction: column;
        align-items: stretch;
    }

    .khello-product-card.list-view .khello-product-img-box {
        width: 100%;
        height: 150px;
        margin-bottom: 10px;
    }
}
