/* css/product-details.css */

/* مسیر ناوبری */
.breadcrumb {
    background-color: #f8f9fa;
    padding: 15px 0;
    margin-bottom: 30px;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb-nav a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb-nav a:hover {
    color: #e91e63;
}

.breadcrumb-nav .separator {
    color: #999;
    font-size: 12px;
}

.breadcrumb-nav .current {
    color: #e91e63;
    font-weight: 500;
}

/* جزئیات محصول */
.product-details-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

/* --- استایل گالری تصاویر (اصلاح شده) --- */
.product-gallery {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.main-image {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    position: relative;
    /* ایجاد قاب مربعی برای تصویر اصلی */
    aspect-ratio: 1 / 1; 
    display: flex;
    align-items: center;
    justify-content: center;
}

/* تصویر اصلی باید کل فضا را پر کند بدون دفرمه شدن */
.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
    cursor: zoom-in; /* نشانگر زوم */
    transition: transform 0.3s ease;
}

.main-image:hover img {
    transform: scale(1.05); /* زوم خفیف هنگام هاور */
}

/* دکمه ذره‌بین روی عکس اصلی */
.zoom-icon {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255,255,255,0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    pointer-events: none; /* تا کلیک روی عکس عمل کند */
    z-index: 2;
}

/* لیست تصاویر کوچک (Thumbnails) */
.thumbnail-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin; /* برای فایرفاکس */
}

.thumb-item {
    flex: 0 0 80px; /* عرض ثابت 80 پیکسل */
    height: 80px;   /* ارتفاع ثابت 80 پیکسل */
    border: 2px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    background: #f9f9f9;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* پر کردن کادر بدون کش آمدن */
}

.thumb-item:hover {
    border-color: #ccc;
    opacity: 0.9;
}

.thumb-item.active {
    border-color: #e91e63; /* رنگ فعال */
    box-shadow: 0 0 0 2px rgba(233, 30, 99, 0.1);
}

/* اسکرول بار زیبا برای لیست تصاویر */
.thumbnail-list::-webkit-scrollbar {
    height: 6px;
}
.thumbnail-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.thumbnail-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.thumbnail-list::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* --- پایان استایل گالری --- */

.product-info {
    padding: 10px 0;
}

.product-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
    font-weight: 700;
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.product-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
}

.product-meta i {
    color: #e91e63;
}

.product-price {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.price-with-discount {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1.1rem;
}

.discount-percent {
    background: #e91e63;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.final-price {
    font-size: 1.6rem;
    font-weight: bold;
    color: #e91e63;
}

/* استایل انتخابگر رنگ (Variants) */
.color-selection { 
    margin: 20px 0; 
    padding: 15px; 
    background: #fff; 
    border-radius: 10px; 
    border: 1px solid #eee; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.color-title { 
    font-weight: bold; 
    margin-bottom: 12px; 
    display: block; 
    font-size: 1em; 
    color: #444; 
}

.color-options { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
}

.color-option { position: relative; }

.color-option input[type="radio"] { display: none; }

.color-option label { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    padding: 8px 15px; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s; 
    background: #fff; 
    user-select: none; 
    font-size: 0.9rem;
}

.color-option input[type="radio"]:checked + label { 
    border-color: #e91e63; 
    background-color: #fff5f5; 
    color: #e91e63; 
    box-shadow: 0 2px 5px rgba(233, 30, 99, 0.15); 
}

.color-option input[type="radio"]:disabled + label { 
    opacity: 0.6; 
    cursor: not-allowed; 
    background-color: #f9f9f9; 
    border-color: #eee; 
    color: #aaa; 
    text-decoration: line-through; 
}

.color-circle { 
    width: 18px; 
    height: 18px; 
    border-radius: 50%; 
    border: 1px solid #ccc; 
    display: inline-block; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); 
}

.out-of-stock-badge { 
    color: #d32f2f; 
    font-size: 0.8em; 
    font-weight: bold; 
}

.color-stock { 
    font-size: 0.8em; 
    color: #888; 
}

/* توضیحات محصول */
.product-description {
    margin: 30px 0;
    line-height: 1.8;
}

.product-description h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.2rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
    display: inline-block;
}

.product-description p {
    color: #555;
    text-align: justify;
}

/* دکمه‌ها و اکشن‌ها */
.product-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    height: 45px;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    width: 40px;
    height: 100%;
    cursor: pointer;
    font-size: 1.2rem;
    color: #555;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: #e9ecef;
}

.quantity-input {
    width: 50px;
    border: none;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
    text-align: center;
    height: 100%;
    font-size: 1.1rem;
    background: white;
    color: #333;
}

/* حذف فلش‌های اینپوت نامبر */
.quantity-input::-webkit-inner-spin-button, 
.quantity-input::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

.add-to-cart-btn {
    flex: 1;
    min-width: 200px;
    height: 45px;
    font-size: 1.1rem;
    border-radius: 8px;
    background-color: #e91e63;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(233, 30, 99, 0.2);
}

.add-to-cart-btn:hover:not(:disabled) {
    background-color: #d81b60;
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(233, 30, 99, 0.3);
}

.add-to-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.wishlist-btn {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.wishlist-btn:hover {
    color: #e91e63;
    border-color: #e91e63;
    background: #fff5f8;
}

/* محصولات مرتبط */
.related-products {
    padding: 40px 0;
    background: #fff;
    border-top: 1px solid #eee;
    margin-top: 40px;
}

.section-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
    color: #333;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
}

/* رسپانسیو */
@media (max-width: 992px) {
    .product-details-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .product-gallery {
        position: static; /* در موبایل استیکی نباشد */
    }
}

@media (max-width: 768px) {
    .product-title {
        font-size: 1.4rem;
    }
    
    .thumb-item {
        flex: 0 0 70px;
        height: 70px;
    }
    
    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quantity-selector {
        width: 100%;
        justify-content: center;
    }
    
    .add-to-cart-btn {
        width: 100%;
    }
    
    .wishlist-btn {
        width: 100%;
        margin-top: 10px;
    }
}