/* ============================================
   SHOP PAGE STYLES
   Premium Supermarket - Shop / Products
   ============================================ */

/* ============ BREADCRUMB ============ */
.shop-breadcrumb {
    padding: 14px 0;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
}

.breadcrumb-list a {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-list a:hover {
    color: var(--primary);
}

.breadcrumb-sep {
    margin: 0 8px;
    color: #ccc;
    font-size: 9px;
}

.breadcrumb-current {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}


/* ============ SHOP LAYOUT ============ */
.shop-section {
    padding: 24px 0 48px;
    background: var(--bg-light);
    min-height: 80vh;
}

.shop-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}


/* ============ SIDEBAR ============ */
.shop-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.shop-sidebar::-webkit-scrollbar {
    width: 4px;
}

.shop-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

.sidebar-mobile-header {
    display: none;
}

.sidebar-mobile-footer {
    display: none;
}

/* Active Filters */
.filter-active {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.filter-active-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.filter-active-header span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.filter-clear-all {
    background: none;
    border: none;
    color: var(--secondary, #ef4056);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f0faf3;
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 600;
}

.filter-tag i {
    font-size: 9px;
    cursor: pointer;
    opacity: 0.6;
}

.filter-tag i:hover {
    opacity: 1;
}


/* Filter Block */
.filter-block {
    background: white;
    border-radius: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}

.filter-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.filter-block-head:hover {
    background: #fafafa;
}

.filter-block-head h4 {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
}

.filter-arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

.filter-arrow.rotated {
    transform: rotate(180deg);
}

.filter-block-body {
    padding: 0 16px 14px;
}

/* Checkbox list */
.filter-cat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-cat-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: background 0.2s;
    position: relative;
}

.filter-cat-list label:hover {
    background: #f8f8f8;
}

.filter-cat-list input[type="checkbox"] {
    display: none;
}

.filter-check {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid #d4d4d4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.filter-check::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 9px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.filter-cat-list input:checked + .filter-check {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-cat-list input:checked + .filter-check::after {
    opacity: 1;
    transform: scale(1);
}

.filter-cat-list em {
    font-style: normal;
    color: var(--text-muted);
    font-size: 10.5px;
    margin-right: auto;
}

/* Filter search mini */
.filter-search-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 10px;
}

.filter-search-mini i {
    color: #bbb;
    font-size: 12px;
}

.filter-search-mini input {
    border: none;
    background: none;
    outline: none;
    font-size: 11.5px;
    font-family: inherit;
    color: var(--text-primary);
    width: 100%;
}

.filter-search-mini input::placeholder {
    color: #bbb;
}

/* Price Range */
.price-range-wrap {
    padding: 4px 0 12px;
}

.price-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(to left, var(--primary) 75%, #e8e8e8 75%);
    outline: none;
    direction: ltr;
}

.price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: transform 0.2s ease;
}

.price-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.price-range-labels span {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.price-range-labels span:last-child {
    color: var(--primary);
    font-weight: 700;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.price-input-group {
    flex: 1;
    position: relative;
}

.price-input-group label {
    position: absolute;
    top: -6px;
    right: 8px;
    font-size: 9px;
    color: var(--text-muted);
    background: white;
    padding: 0 4px;
    font-weight: 600;
}

.price-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    font-size: 11px;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    color: var(--text-primary);
}

.price-input:focus {
    border-color: var(--primary);
}

.price-dash {
    color: #ccc;
    font-size: 11px;
}


/* ============ SHOP MAIN ============ */
.shop-main {
    flex: 1;
    min-width: 0;
}


/* ============ TOOLBAR ============ */
.shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-toggle-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    background: #f5f5f5;
    border: 1.5px solid #e8e8e8;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.toolbar-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.sort-options {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 6px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sort-btn:hover {
    background: #f5f5f5;
    color: var(--text-primary);
}

.sort-btn.active {
    background: var(--primary);
    color: white;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.result-count {
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.result-count strong {
    color: var(--text-primary);
    font-weight: 800;
}

.view-toggle {
    display: flex;
    gap: 2px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 2px;
}

.view-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


/* ============ PRODUCT GRID ============ */
.shop-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}


/* ============ PRODUCT CARD ============ */
.sp-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.sp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.sp-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
}

/* Badges */
.sp-card-badges {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sp-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.sp-badge-discount {
    background: var(--secondary, #ef4056);
    color: white;
}

.sp-badge-fresh {
    background: var(--primary);
    color: white;
}

/* Wishlist */
.sp-wishlist {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.sp-wishlist:hover,
.sp-wishlist.active {
    color: var(--secondary, #ef4056);
    border-color: var(--secondary, #ef4056);
}

.sp-wishlist.active i {
    color: var(--secondary, #ef4056);
}

/* Product Image */
.sp-card-img {
    padding: 16px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
}

.sp-card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.sp-card:hover .sp-card-img img {
    transform: scale(1.05);
}

/* Card Body */
.sp-card-body {
    padding: 8px 14px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: right;
}

.sp-card-cat {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.sp-card-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.sp-card:hover .sp-card-title {
    color: var(--primary);
}

.sp-card-pricing {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sp-old-price {
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.sp-price {
    font-size: 14px;
    font-weight: 900;
    color: var(--text-primary);
}

.sp-price small {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Add to cart */
.sp-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: calc(100% - 28px);
    margin: 0 14px 12px;
    padding: 9px;
    border: 1.5px solid var(--primary);
    border-radius: 10px;
    background: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sp-add-cart:hover {
    background: var(--primary);
    color: white;
}

.sp-add-cart.added {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}


/* ============ LIST VIEW ============ */
.shop-product-grid.list-view {
    grid-template-columns: 1fr;
    gap: 10px;
}

.list-view .sp-card {
    flex-direction: row;
}

.list-view .sp-card-link {
    flex-direction: row;
    flex: 1;
}

.list-view .sp-card-img {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    padding: 12px;
}

.list-view .sp-card-body {
    padding: 14px 16px;
    justify-content: center;
}

.list-view .sp-card-title {
    font-size: 13.5px;
    -webkit-line-clamp: 1;
}

.list-view .sp-card-pricing {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.list-view .sp-add-cart {
    width: auto;
    margin: auto 14px auto 0;
    padding: 9px 20px;
    white-space: nowrap;
    align-self: center;
}

.list-view .sp-card-badges {
    flex-direction: row;
}

.list-view .sp-wishlist {
    top: auto;
    bottom: 14px;
    left: 14px;
}


/* ============ PAGINATION ============ */
.shop-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
    padding: 16px 0;
}

.page-btn {
    min-width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-dots {
    font-size: 14px;
    color: var(--text-muted);
    padding: 0 4px;
    user-select: none;
}


/* ============ SIDEBAR OVERLAY ============ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}


/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .shop-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .shop-sidebar {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .filter-toggle-btn {
        display: flex;
    }

    .shop-sidebar {
        position: fixed;
        top: 0;
        right: -320px;
        width: 300px;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        background: #f8f8f8;
        padding: 0 14px 14px;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        overflow-y: auto;
    }

    .shop-sidebar.open {
        right: 0;
    }

    .sidebar-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 2px;
        position: sticky;
        top: 0;
        background: #f8f8f8;
        z-index: 2;
        border-bottom: 1px solid #eee;
        margin-bottom: 12px;
    }

    .sidebar-mobile-header h3 {
        font-size: 15px;
        font-weight: 800;
        color: var(--text-primary);
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .sidebar-mobile-header h3 i {
        color: var(--primary);
    }

    .sidebar-close-btn {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        border: none;
        background: white;
        color: var(--text-secondary);
        font-size: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-mobile-footer {
        display: block;
        position: sticky;
        bottom: 0;
        background: #f8f8f8;
        padding: 12px 0;
        border-top: 1px solid #eee;
    }

    .filter-apply-btn {
        width: 100%;
        padding: 12px;
        border: none;
        border-radius: 10px;
        background: var(--primary);
        color: white;
        font-size: 14px;
        font-weight: 800;
        font-family: inherit;
        cursor: pointer;
        transition: background 0.2s;
    }

    .filter-apply-btn:hover {
        background: #008c3e;
    }

    .shop-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .sort-options {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sort-options::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 768px) {
    .shop-section {
        padding: 16px 0 36px;
    }

    .shop-toolbar {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .sort-label {
        display: none;
    }

    .result-count {
        display: none;
    }

    .shop-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sp-card-img {
        height: 150px;
        padding: 12px 12px 6px;
    }

    .sp-card-body {
        padding: 6px 12px 10px;
    }

    .sp-card-title {
        font-size: 11.5px;
    }

    .sp-price {
        font-size: 13px;
    }

    .sp-add-cart {
        margin: 0 10px 10px;
        width: calc(100% - 20px);
        padding: 8px;
        font-size: 11px;
    }

    .sp-wishlist {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* List view fallback to grid on mobile */
    .list-view .sp-card {
        flex-direction: column;
    }

    .list-view .sp-card-link {
        flex-direction: column;
    }

    .list-view .sp-card-img {
        width: 100%;
        height: 150px;
    }

    .list-view .sp-add-cart {
        width: calc(100% - 20px);
        margin: 0 10px 10px;
    }

    .page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 12px;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .shop-breadcrumb {
        padding: 10px 0;
    }

    .breadcrumb-list a,
    .breadcrumb-current {
        font-size: 11px;
    }

    .shop-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .sp-card-img {
        height: 120px;
        padding: 10px 10px 4px;
    }

    .sp-card-cat {
        font-size: 9px;
    }

    .sp-card-title {
        font-size: 10.5px;
        margin-bottom: 6px;
    }

    .sp-old-price {
        font-size: 10px;
    }

    .sp-price {
        font-size: 12px;
    }

    .sp-add-cart {
        padding: 7px;
        font-size: 10.5px;
        margin: 0 8px 8px;
        width: calc(100% - 16px);
        border-radius: 8px;
    }

    .sp-badge {
        font-size: 9px;
        padding: 2px 6px;
    }

    .shop-toolbar {
        border-radius: 10px;
        margin-bottom: 10px;
        gap: 8px;
    }

    .sort-btn {
        font-size: 10.5px;
        padding: 5px 10px;
    }

    .filter-toggle-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .view-toggle {
        display: none;
    }
}


/* ============ LOADING OVERLAY ============ */
.shop-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    z-index: 10;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    border-radius: 14px;
    backdrop-filter: blur(2px);
}

.shop-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.shop-loader span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e8e8e8;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinLoader 0.7s linear infinite;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}


/* ============ BACK TO TOP ============ */
.shop-back-top {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,160,73,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.shop-back-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.shop-back-top:hover {
    background: #008c3e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,160,73,0.4);
}


/* ============ FLY TO CART ============ */
.fly-to-cart {
    pointer-events: none;
    transition: none;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.bounce {
    animation: bounce 0.4s ease;
}


/* ============ IMAGE LOADED ============ */
.sp-card-img img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sp-card-img img.loaded,
.sp-card-img img[src] {
    opacity: 1;
}
