/* styles/product-details.css */

/* ------------------------------------------- */
/* 1. متغیرها و تنظیمات پایه (طبق کد ارسالی شما) */
/* ------------------------------------------- */
:root {
    --bg-dark: #0f172a;
    --bg-deep: #020617; /* رنگ پس‌زمینه اصلی */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-primary: #818cf8; /* Indigo Neon */
    --accent-glow: #6366f1;
    --accent-secondary: #c084fc; /* Purple Neon */
    
    --danger: #f43f5e;
    --success: #10b981;
    --star: #fbbf24;
    
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(148, 163, 184, 0.15);
    --border-radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: var(--bg-deep); /* اعمال رنگ تیره */
    color: var(--text-main);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body.no-scroll { overflow: hidden; } /* برای زمانی که مودال باز است */

/* افکت‌های نوری پس‌زمینه */
.bg-glow-1, .bg-glow-2 {
    position: fixed; border-radius: 50%; filter: blur(80px); z-index: -1; opacity: 0.4;
}
.bg-glow-1 {
    top: -10%; right: -5%; width: 50vw; height: 50vw;
    background: radial-gradient(circle, var(--accent-primary), transparent 70%);
}
.bg-glow-2 {
    bottom: -10%; left: -10%; width: 60vw; height: 60vw;
    background: radial-gradient(circle, var(--accent-secondary), transparent 70%);
}

.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; z-index: 1; }
.container { max-width: 1300px; margin: 0 auto; padding: 2rem; flex-grow: 1; }
a { text-decoration: none; color: inherit; transition: color 0.3s; }

/* ------------------------------------------- */
/* 2. استایل کارت‌های محصول (مشترک با لیست)    */
/* ------------------------------------------- */
/* این بخش برای نمایش صحیح "محصولات مشابه" ضروری است */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}
.product-card {
    background: var(--card-bg);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.4s ease;
    overflow: hidden;
    display: flex; flex-direction: column;
    position: relative;
    animation: fadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-color: var(--accent-primary);
}
/* هماهنگ‌سازی کلاس‌های تصویر برای محصولات مشابه */
.pc-img-box, .product-image-container {
    width: 100%; aspect-ratio: 1 / 1; padding: 1.5rem;
    position: relative; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle, rgba(255,255,255,0.02) 0%, transparent 70%);
}
.pc-img-box img, .product-image-container img {
    max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.4s ease;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
}
.product-card:hover img { transform: scale(1.08) rotate(2deg); }

.pc-badge, .discount-badge {
    position: absolute; top: 1rem; right: 1rem;
    background: var(--danger); color: white;
    padding: 4px 12px; border-radius: 8px;
    font-size: 0.85rem; font-weight: 800;
    box-shadow: 0 4px 10px rgba(244, 63, 94, 0.4);
}
.pc-info, .product-info {
    padding: 1.2rem; display: flex; flex-direction: column; flex-grow: 1;
    border-top: 1px solid var(--border-color); background: rgba(0,0,0,0.1);
}
.pc-title, .product-title-small {
    font-size: 1.05rem; font-weight: 500; height: 3.2em; overflow: hidden; margin-bottom: 0.5rem;
}
.pc-price, .final-price { color: var(--accent-primary); font-weight: bold; font-size: 1.2rem; }
.pc-old-price, .original-price { text-decoration: line-through; color: var(--text-muted); font-size: 0.9rem; margin-left: 8px; }

/* ------------------------------------------- */
/* 3. استایل اختصاصی صفحه جزئیات محصول         */
/* ------------------------------------------- */
.product-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

/* --- گالری تصاویر --- */
.gallery-section { position: sticky; top: 2rem; }
.main-image-frame {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1/1;
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-in;
}
.main-image-frame img {
    max-width: 100%; max-height: 100%; object-fit: contain;
    transition: transform 0.3s;
}
.main-image-frame:hover img { transform: scale(1.05); }

.thumbnails-track { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; }
.thumb-img {
    width: 80px; height: 80px;
    border-radius: 12px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--glass-bg);
    opacity: 0.6; transition: all 0.3s;
}
.thumb-img.active, .thumb-img:hover {
    border-color: var(--accent-primary);
    opacity: 1; transform: translateY(-2px);
}

/* --- اطلاعات محصول (سمت چپ) --- */
.info-section { display: flex; flex-direction: column; gap: 1.5rem; }

.breadcrumb { color: var(--text-muted); font-size: 0.9rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--accent-secondary); transition: 0.3s; border-bottom: 1px dashed transparent; }
.breadcrumb a:hover { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

.product-title {
    font-size: 2.2rem; font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.rating-box {
    display: flex; align-items: center; gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    width: fit-content; padding: 5px 12px; border-radius: 50px;
    font-size: 0.9rem;
}
.stars { color: var(--star); }

.price-box {
    display: flex; align-items: center; gap: 1rem; margin: 1rem 0; padding: 1.5rem;
    background: linear-gradient(90deg, rgba(129, 140, 248, 0.1), transparent);
    border-radius: var(--border-radius); border-right: 4px solid var(--accent-primary);
}
.price-old { text-decoration: line-through; color: var(--text-muted); font-size: 1.1rem; }
.price-new { font-size: 2rem; font-weight: 700; color: var(--accent-primary); text-shadow: 0 0 15px var(--accent-glow); }

/* --- فرم کنترل‌ها (رنگ و تعداد) --- */
.controls-form {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    padding: 1.5rem; border-radius: var(--border-radius);
    display: flex; flex-direction: column; gap: 1.5rem;
}
.option-group label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-weight: bold; }

/* انتخاب رنگ دایره‌ای */
.color-selector { display: flex; gap: 10px; flex-wrap: wrap; }
.color-radio { display: none; }
.color-swatch {
    width: 35px; height: 35px; border-radius: 50%; cursor: pointer;
    border: 2px solid var(--glass-border); position: relative; transition: all 0.3s;
}
.color-radio:checked + .color-swatch {
    transform: scale(1.1); box-shadow: 0 0 0 3px var(--bg-deep), 0 0 0 5px var(--accent-primary); border-color: transparent;
}

/* اینپوت تعداد */
.quantity-wrapper {
    display: flex; align-items: center; background: rgba(0,0,0,0.3);
    border-radius: 12px; width: fit-content; border: 1px solid var(--glass-border);
}
.qty-btn {
    background: none; border: none; color: white; padding: 10px 15px;
    cursor: pointer; font-size: 1.2rem; transition: color 0.3s;
}
.qty-btn:hover { color: var(--accent-primary); }
.qty-input {
    width: 50px; background: transparent; border: none; color: white;
    text-align: center; font-size: 1.1rem; -moz-appearance: textfield;
}

/* دکمه افزودن به سبد */
.btn-add-cart {
    width: 100%; padding: 1rem;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    color: white; border: none; border-radius: 12px;
    font-size: 1.1rem; font-weight: bold; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 4px 15px var(--accent-glow); transition: all 0.3s;
}
.btn-add-cart:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 25px var(--accent-glow); }
.btn-add-cart:disabled { filter: grayscale(1); cursor: not-allowed; opacity: 0.7; }

/* ------------------------------------------- */
/* 4. تب‌ها، توضیحات (Read More) و نظرات       */
/* ------------------------------------------- */
.tabs-container { margin-top: 2rem; }
.tab-headers { display: flex; gap: 1rem; border-bottom: 1px solid var(--glass-border); margin-bottom: 1.5rem; }
.tab-btn {
    background: none; border: none; color: var(--text-muted); padding: 1rem;
    font-size: 1rem; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.3s;
}
.tab-btn.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }
.tab-content { display: none; color: var(--text-muted); line-height: 1.8; animation: fadeIn 0.4s; }
.tab-content.active { display: block; }

/* استایل متن طولانی (جمع شونده) */
.desc-wrapper { position: relative; }
.desc-content { overflow: hidden; transition: max-height 0.5s ease; }
.desc-content.collapsed {
    max-height: 150px; /* ارتفاع اولیه */
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.read-more-btn {
    display: none; /* با JS کنترل می‌شود */
    margin-top: 10px; background: none; border: none;
    color: var(--accent-primary); cursor: pointer; font-weight: bold;
    align-items: center; gap: 5px; font-family: inherit;
}
.read-more-btn:hover { text-decoration: underline; }

/* استایل نظرات */
.review-item {
    background: var(--glass-bg); padding: 1.5rem; border-radius: 12px;
    margin-bottom: 1rem; border: 1px solid var(--glass-border);
}
.review-header { display: flex; justify-content: space-between; margin-bottom: 0.5rem; }
.reviewer-name { font-weight: bold; color: white; }
.review-date { font-size: 0.8rem; opacity: 0.6; }
.view-all-reviews-btn {
    display: inline-block; margin-top: 1rem; padding: 10px 20px;
    border: 1px solid var(--accent-primary); border-radius: 8px;
    color: var(--accent-primary); transition: all 0.3s;
}
.view-all-reviews-btn:hover { background: var(--accent-primary); color: white; }

/* ------------------------------------------- */
/* 5. مودال تمام صفحه (پیشرفته)                */
/* ------------------------------------------- */
.fullscreen-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); backdrop-filter: blur(10px); z-index: 2000;
    flex-direction: column; justify-content: center; align-items: center;
}
.fullscreen-modal.active { display: flex; }

.fs-main-wrapper {
    position: relative; width: 100%; height: 75%;
    display: flex; justify-content: center; align-items: center;
}
.fs-img { max-width: 90%; max-height: 100%; object-fit: contain; border-radius: 8px; }

/* دکمه‌های ناوبری مودال */
.fs-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border);
    color: white; width: 50px; height: 50px; border-radius: 50%;
    font-size: 1.5rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.3s; z-index: 2001;
}
.fs-nav-btn:hover { background: var(--accent-primary); box-shadow: 0 0 15px var(--accent-glow); }
.fs-prev { left: 20px; }
.fs-next { right: 20px; }

.fs-close {
    position: absolute; top: 20px; right: 20px;
    background: none; border: none; color: var(--text-muted);
    font-size: 2.5rem; cursor: pointer; z-index: 2002; transition: color 0.3s;
}
.fs-close:hover { color: var(--danger); }

/* نوار تصاویر پایین مودال */
.fs-thumbnails {
    height: 15%; width: 100%; display: flex; justify-content: center; align-items: center;
    gap: 15px; padding: 20px; overflow-x: auto;
}
.fs-thumb {
    height: 70px; width: 70px; object-fit: cover; border-radius: 10px;
    opacity: 0.5; cursor: pointer; border: 2px solid transparent; transition: all 0.3s;
}
.fs-thumb.active, .fs-thumb:hover { opacity: 1; border-color: var(--accent-primary); transform: scale(1.1); }

/* بخش محصولات مشابه */
.related-section { margin-top: 5rem; }
.section-title { font-size: 1.8rem; margin-bottom: 2rem; text-align: center; }

/* پیام‌های خطا و موفقیت */
.alert-box { padding: 1rem; border-radius: 12px; margin-bottom: 2rem; text-align: center; }
.alert-box.error { background: rgba(244, 63, 94, 0.2); border: 1px solid var(--danger); color: var(--danger); }
.alert-box.success { background: rgba(16, 185, 129, 0.2); border: 1px solid var(--success); color: var(--success); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ریسپانسیو */
@media (max-width: 768px) {
    .product-showcase { grid-template-columns: 1fr; gap: 2rem; }
    .gallery-section { position: static; }
    .fs-nav-btn { width: 40px; height: 40px; font-size: 1.2rem; }
    .fs-prev { left: 10px; } .fs-next { right: 10px; }
}