/* --- فونت و متغیرها --- */
:root {
    --cream: #fcf8f3; 
    --jade-green: #006442; 
    --primary-green: #00bf6f; 
    --dark-bar: #4a4a4a; 
    --border-color: #e0e0e0;
    --text-main: #444;
    --radius: 8px;
}

/* === استایل‌های اصلی صفحه محصول === */
.single-product .product {
    margin: 20px auto;
    max-width: 1300px;
}

/* --- شبکه بندی اصلی (بالای محصول) --- */
.product-top-grid {
    display: grid;
    grid-template-columns: 300px 1fr 400px; /* چپ (خرید) - وسط (اطلاعات) - راست (گالری) */
    gap: 20px;
    background: #fff;
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}
/* Container گالری ووکامرس */
.gallery-col .woocommerce-product-gallery {
    /* تضمین می‌کند کانتینر گالری تمام عرض gallery-col را بگیرد */
    width: 100% !important; 
    box-sizing: border-box; /* برای محاسبه درست ابعاد */
}

/* تضمین پر شدن تمام فضای Wrapper توسط عکس */
.gallery-col .woocommerce-product-gallery__wrapper {
    width: 100% !important;
    height: auto;
    margin: 0;
}
/* 1. ستون گالری */
.gallery-col { position: relative; }
.gallery-actions { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.action-icon { width: 35px; height: 35px; border: 1px solid #ddd; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #777; background: #fff; cursor: pointer; transition: 0.3s; }
.action-icon:hover { color: red; border-color: red; }

/* 2. ستون اطلاعات */
.info-col { padding: 0 15px; }
.meta-info { font-size: 13px; color: #888; margin-bottom: 20px; display: flex; gap: 15px; }
.product-top-grid h1.product_title { 
    font-size: 22px; 
    font-weight: 700; 
    margin-bottom: 15px; 
    line-height: 1.4; 
}
.summary .woocommerce-product-details__short-description { 
    margin-top: 20px; 
    font-size: 14px; 
    line-height: 1.8; 
    color: #666; 
    text-align: justify; 
}
.feature-box { 
    background: #f8f9fa; 
    border-radius: 4px; 
    padding: 10px 15px; 
    margin-bottom: 10px; 
    font-size: 14px; 
    display: flex; 
    justify-content: space-between; 
    border-right: 3px solid #ddd; 
}

/* 3. ستون باکس خرید */
.buy-box-col { 
    background: #fff; 
    border: 1px solid #e0e0e0; 
    border-radius: var(--radius); 
    padding: 20px; 
    height: fit-content; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.03); 
}

.price-area { text-align: center; margin-bottom: 20px; }
.price-area .price { font-size: 26px; font-weight: 800; color: #222; display: block; }
.price-area .amount { font-size: 26px; }
.price-area .currency { font-size: 14px; color: #666; }
.price-date { 
    font-size: 11px; 
    background: #eee; 
    color: #555; 
    padding: 3px 8px; 
    border-radius: 10px; 
    display: inline-block; 
    margin-top: 5px; 
}

/* باکس هشدار */
.alert-box { 
    background: #fff8e1; 
    border: 1px dashed #ffb300; 
    border-radius: 6px; 
    padding: 10px; 
    margin-bottom: 20px; 
    text-align: center; 
}
.alert-text { font-size: 12px; color: #d35400; font-weight: bold; display: block; margin-bottom: 5px; }

/* === استایل‌های فرم خرید ووکامرس === */
.woocommerce-variation-add-to-cart, 
.buy-box-col form.cart { 
    margin-bottom: 20px;
}
/* باکس تعداد */
.quantity { 
    border: 1px solid #ddd; 
    border-radius: 6px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 5px; 
    margin-bottom: 15px; 
}
.quantity input[type="number"] {
    width: 40px; 
    text-align: center; 
    border: none; 
    font-weight: bold; 
    font-family: inherit;
    box-shadow: none;
}
.quantity .qty { appearance: none; -moz-appearance: textfield; }

/* دکمه افزودن به سبد خرید */
.single_add_to_cart_button { 
    width: 100% !important; 
    background: var(--primary-green) !important; 
    color: white !important; 
    border: none !important; 
    padding: 12px !important; 
    border-radius: 6px !important; 
    font-size: 16px !important; 
    font-weight: bold !important; 
    cursor: pointer !important; 
    transition: 0.3s !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    gap: 10px !important; 
    text-shadow: none !important;
}
.single_add_to_cart_button:hover { 
    background: #009e5c !important; 
}

/* سرویس‌ها */
.service-badges { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.service-item { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-size: 13px; 
    color: #555; 
    background: #f9f9f9; 
    padding: 8px; 
    border-radius: 4px; 
}

/* --- استایل نوار ثابت (Sticky Nav) - دسکتاپ --- */
.sticky-nav {
    background: var(--dark-bar);
    border-radius: var(--radius);
    padding: 0 20px;
    margin: 0 auto 30px;
    max-width: 1300px;
    position: sticky;
    top: 0; 
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.nav-item { 
    color: #fff; 
    text-decoration: none; 
    padding: 15px 0; 
    font-size: 14px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    border-bottom: 3px solid transparent; 
    transition: 0.3s; 
    white-space: nowrap; 
}
.nav-item:hover, .nav-item.active { 
    border-bottom-color: var(--primary-green); 
    color: var(--primary-green); 
}
.scroll-top-btn { 
    margin-right: auto; 
    color: white; 
    cursor: pointer; 
    display: flex; 
}

/* --- استایل‌های محتوای پایین (جایگزین تب‌ها) --- */
.content-container {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 40px;
    margin: 0 auto 30px;
    max-width: 1300px;
}
.content-container h2 {
    font-size: 24px;
    color: var(--jade-green); 
    margin-bottom: 30px;

    padding-bottom: 15px;
    text-align: right;
    font-weight: 700;
}
.content-container p, .content-container .woocommerce-Tabs-panel {
    line-height: 2;
    text-align: justify;
    color: #555;
}
.section-highlight {
    border-right: 4px solid var(--jade-green); 
    padding-right: 15px;
}

/* مخفی کردن تب‌های ووکامرس در ساختار سفارشی ما */
.woocommerce-tabs.wc-tabs-wrapper { 
    border: none; 
    padding: 0; 
    margin: 0;
}
.woocommerce-tabs.wc-tabs-wrapper ul.tabs {
    display: none; /* مخفی کردن دکمه‌های تب‌ها (فقط محتوا نمایش داده می‌شود) */
}
.woocommerce-Tabs-panel {
    border: none !important; 
    padding: 0 !important; 
    margin: 0 !important;
}

/* --- ریسپانسیو (اجبار به یک خط و اسکرول کشویی بدون نوار) --- */
@media (max-width: 992px) {
    /* بازچینش گرید بالا در موبایل */
    .product-top-grid { 
        grid-template-columns: 1fr; 
        padding: 10px;
    }
    .buy-box-col { order: 3; }
    .gallery-col { order: 1; }
    .info-col { order: 2; }
    
    /* **نوار ثابت اسکرول‌شونده (کشویی)** */
    .sticky-nav { 
        padding: 0 10px; 
        border-radius: 0;
        
        flex-wrap: nowrap; /* اجبار به یک خط */
        overflow-x: auto; /* کلید ایجاد اسکرول افقی */
        justify-content: flex-start; 
        gap: 15px; 
        
        /* پنهان کردن نوار اسکرول */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .sticky-nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav-item {
        flex-shrink: 0; 
        padding: 12px 0; 
        font-size: 13px; 
        margin: 0 5px;
    }
    .scroll-top-btn {
        display: none !important; 
    }
    
    /* استایل‌های پایین محصول در موبایل */
    .content-container { padding: 20px; margin: 0 15px 30px; }
}


/* --- استایل دهی خاص برای لینک برند (محتویات درون آن) --- */
.brand-link {
    display: flex; /* محتویات لینک برند (لوگو و نام) را در یک ردیف قرار می‌دهد */
    align-items: center;
    text-decoration: none;
    color: #007bff; /* رنگ لینک برند */
    transition: color 0.2s;
}

/* --- استایل دهی به لوگوی برند --- */
.brand-link .brand-logo,
.brand-link img.brand-logo {
    /* اندازه 20x20 در کد PHP تنظیم شده، این بخش فقط تراز و نمایش را تضمین می کند */
    width: 20px;
    height: 20px;
    object-fit: contain; /* برای حفظ نسبت تصویر لوگو */
    margin-left: 5px; /* فاصله بین لوگو و نام برند */
    vertical-align: middle;
}



/* ========================================= */
/* ۶. استایل‌های تصاویر و Alignment */
/* ========================================= */

/* رفع مشکل تصاویر وسط‌چین (aligncenter) */
.product-description-content .aligncenter,
.content-text .aligncenter {
    display: block; /* تبدیل به المان بلوکی برای امکان وسط‌چین */
    margin-left: auto;  /* وسط‌چین کردن با margin */
    margin-right: auto; /* وسط‌چین کردن با margin */
    clear: both; /* جلوگیری از چسبیدن به متن‌های شناور */
}

/* رفع مشکل تصاویر چسبیده به چپ و راست (alignleft / alignright) */
.product-description-content .alignleft,
.content-text .alignleft {
    float: left; /* شناور کردن به چپ */
    margin-left: 1.5em; /* فاصله از محتوای سمت چپ */
    margin-right: 0;
}

.product-description-content .alignright,
.content-text .alignright {
    float: right; /* شناور کردن به راست */
    margin-right: 1.5em; /* فاصله از محتوای سمت راست */
    margin-left: 0;
}

/* برای تصاویر و بلاک‌هایی که استایل وسط‌چین این‌لاین دارند (اگر از Gutenberg استفاده می‌کنید) */
.product-description-content .wp-block-image,
.content-text .wp-block-image {
    /* تنظیمات پایه برای بلاک تصویر */
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

/* وسط‌چین کردن بلاک‌ها در گوتنبرگ (اگر به صورت پیش‌فرض توسط قالب تعریف نشده باشد) */
.product-description-content .wp-block-image.aligncenter,
.content-text .wp-block-image.aligncenter {
    display: block;
    text-align: center; /* برای وسط‌چین کردن کپشن زیر عکس */
    margin-left: auto;
    margin-right: auto;
    width: fit-content; /* مهم: عرض را محدود می‌کند تا وسط‌چین عمل کند */
}

/* استایل کپشن زیر تصویر */
.product-description-content .wp-caption-text,
.content-text .wp-block-image figcaption {
    font-size: 0.9em;
    color: #777;
    text-align: center;
    margin-top: 0.5em;
}

/* تصاویر درون محتوا (برای زیبایی مرزها) */
.product-description-content img,
.content-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* سایه ملایم برای جلوه حرفه‌ای */
}