:root {
    --primary: #ef4056;
    --primary-light: #fdf2f4;
    --border: #e0e0e0;
    --text: #1a1a1a;
    --muted: #757575;
    --bg: #fafafa;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    --success: #00bfd6;
    --warning: #f9a825;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: #f5f5f5;
    padding: 12px;
    padding-bottom: max(100px, calc(100px + env(safe-area-inset-bottom, 0px)));
    line-height: 1.7;
    color: var(--text);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.product-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 20px;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.main-image {
    height: clamp(300px, 50vw, 420px);
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #999;
    border: 2px dashed #ddd;
    position: relative;
    overflow: hidden;
}

.main-image img {
    height: 80%;
}


.thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.thumb {
    width: 64px;
    height: 64px;
    background: #eee;
    border-radius: 8px;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
}

.thumb img {
    height: 100%;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
}

.brand {
    font-size: 14px;
    color: var(--muted);
}

.rating {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.stars {
    color: #f9a825;
    font-size: 16px;
}

.colors,
.sizes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-item,
.size-item {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.color-item.active,
.size-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 14px;
}

.seller-avatar {
    width: 40px;
    height: 40px;
    background: #e0e0e0;
    border-radius: 50%;
    border: 1px dashed #bbb;
}

.seller-avatar img {
    width: 100%;
    border-radius: 200px;
    ;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab {
    padding: 16px 24px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    padding: 24px;
    display: none;
}

.tab-content.active {
    display: block;
}

.description {
    font-size: 15px;
    line-height: 2;
    color: #424750;
}

.specs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.spec-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed #ddd;
    font-size: 14px;
}

.spec-label {
    color: var(--muted);
    font-size: 13px;
}

.review {
    border-bottom: 1px solid #eee;
    padding: 16px 0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.review-rating {
    color: #f9a825;
}

.question {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px dashed #ddd;
}

/* --- محصولات مشابه --- */
.related {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 12px 0;
}

.related-item {
    min-width: 180px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    font-size: 13px;
}

.related-img {
    width: 100%;
    height: 120px;
    background: #f0f0f0;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px dashed #ccc;
}

.fixed-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    max-width: 1240px;
    margin: 0 auto;
    padding-bottom: max(12px, calc(12px + env(safe-area-inset-bottom, 0px)));
}

.price-box {
    background: #d1fae5;
    color: #065f46;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 16px;
    border: 1px dashed #34d399;
}

.old-price {
    background: #fee2e2;
    color: #991b1b;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: line-through;
    border: 1px dashed #f87171;
}

#dynamicHolder {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;

}

.btn-add {
    height: 48px;
    width: 90%;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 15px;
    background: var(--primary);
    border: 1px dashed #e91e63;
}

.countShow {
    background-color: darksalmon;
    color: black;
}

.btn-add:hover {
    background: #e91e63;
}

.disbled_btn {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: gray;
    border-color: gray;
}

@media (max-width: 992px) {
    .product-header {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }

    .main-image {
        height: 300px;
    }

    .fixed-bar {
        flex-direction: column;
        gap: 10px;
    }

    .btn-add {
        padding-top: 10px;
        padding-bottom: 10px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
        padding-bottom: max(110px, calc(110px + env(safe-area-inset-bottom, 0px)));
    }

    .title {
        font-size: 18px;
    }

    .thumb {
        width: 56px;
        height: 56px;
    }

    .btn-add {
        height: 44px;
        font-size: 14px;
    }
}