/* ════════════════════════════════════
   PRODUCTS LIST PAGE
   ════════════════════════════════════ */

.products-page {
    padding-top: 60px;
    min-height: 100vh;
    background: var(--cream);
}

/* ── Page Header ── */
.products-page .page-header {
    background: linear-gradient(
        135deg,
        var(--brown-dark) 0%,
        var(--brown) 100%
    );
    padding: 2.5rem 1rem 2rem;
    text-align: center;
}

.products-page .page-header-inner {
    max-width: 960px;
    margin: 0 auto;
}

.products-page .page-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gold-light, #e8c97a);
    margin-bottom: 0.35rem;
}

.products-page .page-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.65);
}

/* ── Filter Bar ── */
.products-page .filter-bar-wrap {
    background: var(--warm-white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 40;
    box-shadow: 0 2px 10px rgba(92, 61, 30, 0.06);
}

.products-page .filter-bar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.products-page .search-box {
    position: relative;
    width: 100%;
}

.products-page .search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    pointer-events: none;
}

.products-page .search-icon svg {
    width: 16px;
    height: 16px;
}

.products-page .search-input {
    width: 100%;
    padding: 0.6rem 2.4rem 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--cream);
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.85rem;
    color: var(--brown-dark);
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
    box-sizing: border-box;
}

.products-page .search-input::placeholder {
    color: var(--text-muted);
}
.products-page .search-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.products-page .filter-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.products-page .filter-chips::-webkit-scrollbar {
    display: none;
}

.products-page .chip {
    flex-shrink: 0;
    padding: 0.32rem 0.85rem;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--cream);
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--brown-light);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}
.products-page .chip:hover {
    border-color: var(--gold);
    color: var(--brown-dark);
}
.products-page .chip.active {
    background: var(--brown-dark);
    border-color: var(--brown-dark);
    color: var(--gold-light, #e8c97a);
}

.products-page .sort-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.products-page .sort-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.products-page .sort-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    background: var(--cream);
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.82rem;
    color: var(--brown-dark);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b6914' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.65rem center;
    padding-left: 2rem;
}
.products-page .sort-select:focus {
    border-color: var(--gold);
}

/* ── Products Section ── */
.products-section {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

/* ── Products Grid ── */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

/* ── Product Card ── */
.product-card {
    background: var(--warm-white);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        box-shadow 0.22s,
        transform 0.22s;
}
.product-card:hover {
    box-shadow: 0 8px 28px rgba(92, 61, 30, 0.12);
    transform: translateY(-2px);
}

.card-img-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: right;
}

.card-img-wrap {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--cream);
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    transition: transform 0.35s;
}
.product-card:hover .card-img-wrap img {
    transform: scale(1.04);
}

/* category badge */
.cat-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    background: rgba(92, 61, 30, 0.82);
    color: var(--gold-light, #e8c97a);
    border: 1px solid rgba(201, 168, 76, 0.35);
    backdrop-filter: blur(4px);
}
.cat-badge--mobl {
    background: rgba(139, 94, 60, 0.85);
}
.cat-badge--ghalamzani {
    background: rgba(139, 105, 20, 0.85);
    color: #fff;
}
.cat-badge--sofal {
    background: rgba(107, 66, 38, 0.85);
}
.cat-badge--ghali {
    background: rgba(61, 43, 31, 0.88);
}

.badge-new {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.16rem 0.5rem;
    border-radius: 6px;
    background: #2e9e5b;
    color: #fff;
}
.badge-discount {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.16rem 0.5rem;
    border-radius: 6px;
    background: #e05a2b;
    color: #fff;
}

/* card body */
.card-body {
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.product-name {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--brown-dark);
    line-height: 1.35;
}

.name-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: "Vazirmatn", sans-serif;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    text-align: right;
    line-height: 1.35;
    transition: color 0.18s;
}
.name-btn:hover {
    color: var(--gold-dark, #8b6914);
}

.product-seller {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.74rem;
    color: var(--text-muted);
}
.product-seller svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.product-price {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--brown-dark);
}
.product-price small {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
}

.btn-detail {
    padding: 0.32rem 0.75rem;
    border-radius: 8px;
    border: 1.5px solid var(--gold);
    background: transparent;
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--gold-dark, #8b6914);
    cursor: pointer;
    transition: all 0.18s;
}
.btn-detail:hover {
    background: var(--gold);
    color: #fff;
}

/* ── Empty / Load More ── */
.products-page .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.products-page .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}
.products-page .empty-state p {
    font-size: 0.95rem;
    font-weight: 600;
}

.load-more-wrap {
    text-align: center;
    margin-top: 1.75rem;
}
.btn-load-more {
    padding: 0.7rem 2.5rem;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--warm-white);
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--brown);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-load-more:hover {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.07);
    color: var(--brown-dark);
}

/* ════════════════════════════════════
   PRODUCT MODAL
   ════════════════════════════════════ */

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
}
.product-modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 15, 5, 0.55);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

.modal-sheet {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 92dvh;
    background: var(--warm-white);
    border-radius: 22px 22px 0 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    animation: sheetUp 0.28s cubic-bezier(0.32, 1, 0.56, 1);
}

@keyframes sheetUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 2;
    width: 34px;
    height: 34px;
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.18s;
}
.modal-close svg {
    width: 16px;
    height: 16px;
    color: var(--brown-dark);
}
.modal-close:hover {
    background: #f0e8d8;
}

/* ── Slider ── */
.modal-slider {
    position: relative;
    width: 100%;
    background: var(--brown-dark);
    overflow: hidden;
}

.slider-track {
    display: flex;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
    flex: 0 0 100%;
    aspect-ratio: 16/10;
}
.slide img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--brown-dark);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.18s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.slider-btn:hover {
    background: #fff;
}
.slider-btn--prev {
    right: 0.75rem;
}
.slider-btn--next {
    left: 0.75rem;
}

.slider-dots {
    position: absolute;
    bottom: 0.6rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.35rem;
}
.slider-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition:
        background 0.2s,
        transform 0.2s;
}
.slider-dot.active {
    background: #fff;
    transform: scale(1.25);
}

/* ── Modal Body ── */
.modal-body {
    padding: 1.1rem 1.1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--brown-dark);
    line-height: 1.35;
    padding-left: 2.5rem; /* فضا برای دکمه بستن */
}

.modal-cat-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    background: rgba(92, 61, 30, 0.1);
    color: var(--brown);
    align-self: flex-start;
}
.modal-cat-badge--mobl {
    background: rgba(139, 94, 60, 0.12);
}
.modal-cat-badge--ghalamzani {
    background: rgba(139, 105, 20, 0.12);
    color: #6b5010;
}
.modal-cat-badge--sofal {
    background: rgba(107, 66, 38, 0.12);
}
.modal-cat-badge--ghali {
    background: rgba(61, 43, 31, 0.12);
}

.modal-price {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--brown-dark);
}
.modal-price small {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.modal-desc h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.modal-desc p {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.75;
}

/* مشخصات فنی */
.modal-specs {
    background: var(--cream);
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.spec-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text);
}
.spec-label {
    font-weight: 700;
    color: var(--text-muted);
}
.in-stock {
    color: #2e9e5b;
    font-weight: 700;
}

/* کارت فروشنده */
.modal-seller-card {
    border: 1.5px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.seller-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    background: var(--cream);
    border-bottom: 1px solid var(--border);
}

.seller-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brown-dark), var(--brown));
    color: var(--gold-light, #e8c97a);
    font-size: 1rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.seller-detail {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}
.seller-detail strong {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--brown-dark);
}
.seller-type {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-seller-profile {
    flex-shrink: 0;
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    border: 1.5px solid var(--gold);
    background: transparent;
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--gold-dark, #8b6914);
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
}
.btn-seller-profile:hover {
    background: var(--gold);
    color: #fff;
}

.seller-contacts {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.9rem;
    font-size: 0.82rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.contact-item:last-child {
    border-bottom: none;
}
.contact-item:hover {
    background: rgba(201, 168, 76, 0.06);
}
.contact-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--gold-dark, #8b6914);
}

/* اکشن‌ها */
.modal-actions {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.btn-call {
    flex: 1;
    padding: 0.8rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brown-dark), var(--brown));
    color: var(--gold-light, #e8c97a);
    font-family: "Vazirmatn", sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.18s;
}
.btn-call:hover {
    opacity: 0.88;
}

.btn-save-product {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--cream);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.18s;
    flex-shrink: 0;
}
.btn-save-product svg {
    width: 18px;
    height: 18px;
    color: var(--brown-light);
    transition: all 0.18s;
}
.btn-save-product:hover {
    border-color: #e05a2b;
}
.btn-save-product:hover svg {
    color: #e05a2b;
    fill: #e05a2b;
}
.btn-save-product.saved svg {
    fill: #e05a2b;
    color: #e05a2b;
}

/* ════ RESPONSIVE ════ */
@media (min-width: 560px) {
    .products-page .filter-bar-inner {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    .products-page .search-box {
        flex: 1;
        min-width: 180px;
    }
    .products-page .sort-wrap {
        flex-shrink: 0;
    }
    .products-page .filter-chips {
        order: 3;
        width: 100%;
    }

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

@media (min-width: 900px) {
    .products-page {
        padding-top: 72px;
    }
    .products-page .filter-bar-wrap {
        top: 72px;
    }

    .products-page .filter-bar-inner {
        flex-wrap: nowrap;
        gap: 0.75rem;
    }
    .products-page .filter-chips {
        order: 0;
        width: auto;
    }

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

    .modal-sheet {
        max-width: 680px;
        margin: 0 auto;
        border-radius: 22px;
        max-height: 88dvh;
        align-self: center;
    }
    .product-modal {
        align-items: center;
    }
}
