﻿:root {
    --primary: #C97D4F;
    --primary-dark: #A8622D;
    --primary-light: #FDF5EF;
    --green: #7C9A7E;
    --green-dark: #628064;
    --green-light: #EEF4EE;
    --danger: #DC2626;
    --danger-light: #FEF2F2;
    --text-dark: #1C1917;
    --text-muted: #57534E;
    --text-light: #9CA3AF;
    --border: #ECE4DC;
    --border-light: #F5F0EB;
    --bg-light: #FAF7F3;
    --surface: #FFFFFF;
    --radius: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 8px 24px rgba(28,25,23,.08);
    --shadow-sm: 0 2px 8px rgba(28,25,23,.06);
}

/* =============================================
   Shared: shimmer / skeleton loaders
   (used by both Product Detail and Store page)
   ============================================= */

@@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton,
.skeleton-img,
.skeleton-text {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

.skeleton {
    border-radius: 8px;
}

.skeleton-img {
    aspect-ratio: 1;
}

.skeleton-text {
    height: 12px;
    border-radius: 6px;
    margin: .85rem .85rem .4rem;
}

    .skeleton-text.short {
        width: 60%;
        margin-bottom: .85rem;
    }

.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem;
}

/* =============================================
   Shared: empty state
   ============================================= */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

    .empty-state .icon {
        font-size: 3rem;
        margin-bottom: 1rem;
    }

/*******************Product Detail*******************/

.product-detail {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

    .breadcrumb a {
        color: var(--primary);
        text-decoration: none;
    }

        .breadcrumb a:hover {
            text-decoration: underline;
        }

.pd-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.gallery {
    position: sticky;
    top: 1rem;
    align-self: start;
}

.main-img-wrap {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 1;
    margin-bottom: .75rem;
    cursor: zoom-in;
    position: relative;
}

.main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
    display: block;
}

.main-img-wrap:hover .main-img {
    transform: scale(1.04);
}

.zoom-hint {
    position: absolute;
    bottom: .75rem;
    left: .75rem;
    background: rgba(0,0,0,.4);
    color: #fff;
    border-radius: 8px;
    padding: .3rem .6rem;
    font-size: .72rem;
    opacity: 0;
    transition: opacity .2s;
}

.main-img-wrap:hover .zoom-hint {
    opacity: 1;
}

.no-img-large {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: var(--border);
}

.thumbnails {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
}

.thumb {
    width: 70px;
    height: 70px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s, transform .15s;
    background: var(--bg-light);
    flex-shrink: 0;
}

    .thumb:hover {
        transform: scale(1.05);
    }

    .thumb.active {
        border-color: var(--primary);
    }

    .thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

    .lightbox.open {
        display: flex;
    }

.lightbox-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lightbox-img {
    width: 600px;
    height: 600px;
    object-fit: contain; /* عکس داخل کادر جا می‌شه بدون crop */
    border-radius: 8px;
    user-select: none;
    display: block;
    background: #111; /* پس‌زمینه تاریک برای عکس‌های با aspect ratio متفاوت */
}

.lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: .7;
    transition: opacity .15s;
    line-height: 1;
}

    .lightbox-close:hover {
        opacity: 1;
    }

.lightbox-nav {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
    line-height: 1;
}

    .lightbox-nav:hover {
        background: rgba(255,255,255,.3);
    }

    .lightbox-nav:disabled {
        opacity: .3;
        cursor: default;
    }

.lightbox-counter {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.6);
    font-size: .82rem;
    white-space: nowrap;
}

/* Info */
.pd-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.pd-price-wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pd-price {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
}

.pd-old-price {
    font-size: 1rem;
    color: var(--text-light);
    text-decoration: line-through;
}

.discount-pill {
    background: var(--danger-light);
    color: var(--danger);
    font-size: .75rem;
    font-weight: 700;
    padding: .25rem .6rem;
    border-radius: 20px;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    font-weight: 600;
    padding: .35rem .75rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
}

    .stock-badge.in-stock {
        background: var(--green-light);
        color: var(--green-dark);
    }

    .stock-badge.out-stock {
        background: var(--danger-light);
        color: var(--danger);
    }

.stock-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.in-stock .stock-dot {
    background: var(--green-dark);
}

.out-stock .stock-dot {
    background: var(--danger);
}

.divider {
    height: 1px;
    background: var(--border-light);
    margin: 1.25rem 0;
}

.specs-title,
.desc-title,
.filter-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-light);
}

.specs-title {
    margin-bottom: .75rem;
}

.spec-row {
    display: flex;
    align-items: center;
    padding: .55rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: .88rem;
}

    .spec-row:last-child {
        border-bottom: none;
    }

.spec-name {
    width: 40%;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.spec-value {
    color: var(--text-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.spec-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: inline-block;
    flex-shrink: 0;
}

.desc-card,
.filter-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.desc-card {
    padding: 1.5rem;
}

.desc-title {
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-light);
}

.desc-content {
    font-size: .92rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.btn-buy {
    width: 100%;
    padding: .85rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    transition: background .15s, transform .1s;
}

    .btn-buy:not(:disabled):hover {
        background: var(--primary-dark);
    }

    .btn-buy:not(:disabled):active {
        transform: scale(.98);
    }

    .btn-buy:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

@@media (max-width: 768px) {
    .pd-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .gallery {
        position: static;
    }

    .pd-name {
        font-size: 1.2rem;
    }

    .pd-price {
        font-size: 1.3rem;
    }

    .lightbox-img {
        max-width: 95vw;
    }

    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/*************************Store Page****************************/

.store-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 2rem;
}

.sidebar {
    position: sticky;
    top: 1rem;
    align-self: start;
}

.filter-card {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.filter-title {
    margin-bottom: 1rem;
}

.category-group {
    position: relative;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-muted);
    transition: background .12s;
    user-select: none;
}

    .category-item:hover {
        background: var(--bg-light);
    }

    .category-item.active {
        background: var(--primary-light);
        color: var(--primary);
        font-weight: 600;
    }

.category-child {
    display: flex;
    align-items: center;
    padding: .38rem .6rem .38rem 1.6rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: .82rem;
    color: var(--text-light);
    transition: background .12s;
    user-select: none;
    position: relative;
}

    .category-child::before {
        content: '';
        position: absolute;
        right: .85rem;
        top: 50%;
        transform: translateY(-50%);
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: var(--border);
    }

    .category-child:hover {
        background: var(--bg-light);
        color: var(--text-muted);
    }

    .category-child.active {
        background: var(--primary-light);
        color: var(--primary);
        font-weight: 600;
    }

        .category-child.active::before {
            background: var(--primary);
        }

.category-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
}

.category-group:hover .category-children {
    max-height: 500px;
}

.category-group:hover .expand-icon {
    transform: rotate(180deg);
}

.expand-icon {
    font-size: .65rem;
    color: var(--text-light);
    transition: transform .25s;
    flex-shrink: 0;
}

/* Sort dropdown */
.sort-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .4rem .75rem;
    font-size: .85rem;
    color: var(--text-muted);
    background: var(--surface);
    cursor: pointer;
    outline: none;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem 0;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-muted);
}

    .filter-option input {
        cursor: pointer;
    }

.color-filter-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform .1s, border-color .1s;
    display: inline-block;
    flex-shrink: 0;
}

    .color-filter-dot.selected {
        border-color: var(--text-dark);
        border-width: 3px;
    }

    .color-filter-dot:hover {
        transform: scale(1.15);
    }

.count-badge {
    font-size: .72rem;
    color: var(--text-light);
    margin-right: auto;
    padding-right: .3rem;
}

.store-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.store-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
}

.store-count {
    font-size: .82rem;
    color: var(--text-light);
    margin-top: 2px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .45rem .9rem;
    gap: .5rem;
    width: 260px;
}

    .search-bar input {
        border: none;
        outline: none;
        font-size: .88rem;
        background: transparent;
        width: 100%;
        color: var(--text-muted);
    }

.search-icon {
    color: var(--text-light);
    font-size: .9rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .15s, transform .15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

    .product-card:hover {
        box-shadow: var(--shadow);
        transform: translateY(-2px);
    }

.product-img-wrap {
    position: relative;
    background: var(--bg-light);
    aspect-ratio: 1;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .2s;
}

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

.no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--border);
}

.out-of-stock-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: .65rem;
    font-weight: 600;
    padding: .2rem .5rem;
    border-radius: 20px;
}

.discount-badge {
    position: absolute;
    top: .5rem;
    left: .5rem;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 20px;
}

.product-info {
    padding: .85rem;
}

.product-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: .5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.product-old-price {
    font-size: .78rem;
    color: var(--text-light);
    text-decoration: line-through;
    margin-right: .4rem;
}

.product-price-wrap {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    flex-wrap: wrap;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: .4rem;
    margin-top: 2rem;
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
}

    .page-btn:hover {
        background: var(--bg-light);
    }

    .page-btn.active {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

@@media (max-width: 768px) {
    .store-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .search-bar {
        width: 100%;
    }

    .store-header {
        flex-direction: column;
        align-items: flex-start;
        gap: .75rem;
    }
}
