/* ================== تنظیمات فونت  ================== */

@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir.woff") format('woff'),
         url("../../fonts/Vazir.ttf") format('truetype');
    font-weight: 400; 
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir-Medium.woff2") format('woff2'),
         url("../../fonts/Vazir-Medium.woff") format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url("../../fonts/Vazir-Bold.woff") format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ================== متغیرهای سراسری ================== */
:root {
    --primary-color: #3a3a3a;
    --accent-color: #F7DD89;
    --text-color: #303030;
    --extra-color: #411b0a;
    --color-bg-light: #fbf1ca;
    --color-bg: #fdf8e1;
    --font: 'Vazir', sans-serif; 
    --font-size-headings: clamp(16px, 1.2vw, 18px);
    --font-size-btn: clamp(13px, 4vw, 16px);
    --font-size-text: clamp(14px, 4.2vw, 17px);
    --en-font: 'Inter';
}

/*=============general=============*/

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: var(--font);
    background: var(--color-bg); 
    transition: 0.4s; 
    overflow-x: hidden; 
    width: 100%;
    position: relative;
}

input, button, textarea, select {
    font-family: inherit;
}

.container {
  width: 90%;
  margin-inline: auto;
  max-width: 1500px;
}

.single-product-section {
    margin-top: clamp(150px, 12vh, 170px);
}

/* ================== TITLE ================== */

.product-title {
    font-size: clamp(16px, 1.3vw, 20px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    padding-right: 5px;
}

.side-title-line {
    width: 40%; 
    height: 1px;
    background: #c2c1c177;
    margin-right: 5px;
    margin-bottom: 20px;
    margin-top: 20px;
}

/* ================== HEADER GRID ================== */

.product-header {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr; 
    gap: 0;
    align-items: center;
    height: auto;
    min-height: 480px;
    position: relative; 
}

/* ================== PRODUCT IMAGE ================== */

.product-image-section {
    order: 2;
    text-align: center;
    position: relative;
    z-index: 10; 
    margin-left: 30px;
}

.product-main-img {
    width: 100%;
    max-width: 580px;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: 0.5s ease;
    margin-bottom: 10px;
}

.product-main-img:hover{
    transform: scale(1.1);
}

/* ================== NUTRITION TABLE ================== */

.nutrition-side {
    order: 3;
    width: 100%;
    max-width: 340px; 
    height: auto;
    background: #FAFAFA;
    border: 1px #7c7c7c23 solid;
    border-radius: 25px;
    padding: 25px 20px;
    margin: 0 auto;
}

.nutrition-section h3 {
    font-size: clamp(15px, 1.2vw, 18px);
    font-weight: 700;
    text-align: center;
}

.nutrition-section h3::after{
    content:"";
    display:block;
    width:100%;
    height:1px;
    background:#b6b6b696;
    margin:12px auto 0;
}

.nutrition-bar{
    display:flex;
    flex-direction:column;
    gap:7px;
    margin-top:15px;
}

.nutrition-item{
    width:100%;
}

.nutrition-bar-fill{
    position:relative;
    width:100%;
    height:28px;            
    border-radius:40px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 17px;
    font-size:14px;
    font-weight:600;
    color: #383737;
}

.nutrition-bar-fill .label{
    text-align:right;
}

.nutrition-bar-fill .value{
    text-align:left;
    direction: rtl;
    font-size:14px;
    font-weight: 500;
    color: #383737;
}

.nutrition-license{
    margin: auto;
    width: 70%;
    margin-top:15px;
    background:#F5F5F5;
    border:1px #7c7c7c23 solid;
    border-radius: 14px;
    padding:8px 11px;
    font-size:14px;
    font-weight: 500;
    text-align:center;
    color: #383737;
}

.line {
    width: 100%;
    border-bottom: 1px #b6b6b696 solid;
    margin-top: 15px;
    margin-bottom: 17px;
}

.nutrition-legend{
    display:flex;
    justify-content:center;
    gap:20px;
    font-size:14px;
    font-weight: 500;
    margin-top:15px;
}

.nutrition-legend div{
    display:flex;
    align-items:center;
    gap:20px;
}

.nutrition-legend .dot{
    width:13px;
    height:13px;
    border-radius:50%;
}

/* ================== INGREDIENTS CARD ================== */

.ingredients-side {
    order: 1;
    overflow: visible;
    position: relative;
    width: 100%;
}

.ingredients-box {
    background: #fff;
    border-radius: 18px;
    width: calc(100% + 230px); 
    position: relative;
    right: 0; 
    z-index: 1;
    box-shadow: 0 1px 3px rgba(141, 141, 141, 0.192);
    max-height: none; 
    overflow: hidden; 
} 

.product-name-header {
    font-size: clamp(14px, 1.2vw, 16px);
    background: var(--accent-color) !important;
    padding: 15px 40px;
    color: var(--primary-color);
    font-weight: 800;
    margin: 0;
    border-top-right-radius: 20px;
    border-top-left-radius: 20px;
    text-align: right;
}

.ingredients-list {
    list-style: none;
    padding: 15px 40px 15px 190px; 
    margin: 0;
    max-height: none;
    overflow-y: visible; 
}

.ingredients-list li {
    padding: 6px 0;
    font-size: clamp(11px, 1.2vw, 12.5px); 
    line-height: 2.2;
    color: var(--primary-color);
    font-weight: 500;
    border: none;
}

ul.ingredients-list li {
        width: 120%;
    }

/* ================== DESCRIPTION ================== */

.description-section{
    margin-top: 20px;
    margin-bottom: 20px;
}

.description-section h2{
    font-size: var(--font-size-headings);
    color: var(--primary-color);
    font-weight: 600;
}

.description-line {
    border-bottom: 1px #c2c1c177 solid;
    width: 40%;
    margin-bottom: 20px;
    margin-top: 20px;
}

.product-description p {
    font-size: clamp(14px, 1.1vw, 16px);
    line-height: 2.4;
    text-align: justify;
    color: #222222;
    width: 90%;
}

/* استایل‌دهی اختصاصی عکس‌های داخل توضیحات محصول */
.product-description img {
    border-radius: 25px;
    width: 50%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 30px auto; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05); 
}

/* ==========================================================================
   استایل‌دهی ویدیوها و Iframe ها مخصوص ویرایشگر کلاسیک وردپرس
   ========================================================================== */

/* 1. تنظیم عرض 70 درصد برای تگ‌های خام در کلاسیک ادیتور */
.product-description iframe,
.product-description video,
.product-description .wp-video,
.product-description .aparat-video {
    width: 60% !important;
    max-width: 60% !important;
    margin: 30px auto !important;
    display: block !important;
    clear: both !important;
    border-radius: 25px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
}

/* 2. تنظیم نسبت ابعاد و حذف حاشیه‌ها */
.product-description iframe,
.product-description video {
    height: auto !important;
    aspect-ratio: 16 / 9;
    border: none !important;
    outline: none !important;
    background: transparent !important;
}

/* 3. اگر مدیا داخل ظرف خود وردپرس (.wp-video) بود، باید 100 درصدِ آن ظرف 70 درصدی را پر کند */
.product-description .wp-video video,
.product-description .wp-video iframe,
.product-description .wp-video .mejs-container,
.product-description .aparat-video iframe {
    width: 100% !important; 
    max-width: 100% !important;
    margin: 0 auto !important;
    box-shadow: none !important;
}

/* ================== RELATED PRODUCTS ================== */

.product-gallery-section {
    margin-top: 30px;
    margin-bottom: 80px;
}

.product-gallery-section h2 {
    font-size: var(--font-size-headings);
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 25px;
}

.product-gallery .swiper-slide {
    padding: 10px 4px 40px; 
    height: auto;
}

.related-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    border-radius: 20px; 
    padding-top: 15px;
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(65, 27, 10, 0.05);
    transition: all 0.3s ease-in-out;
    width: 100%;
    height: 260px; 
    min-height: 260px;
    max-height: 260px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}

.related-card img {
    width: auto;
    max-width: 95%;
    
    height: 170px; 
    min-height: 170px;
    max-height: 170px;
    
    object-fit: contain;
    transition: transform 0.4s ease;
}

.related-card h4 {
    margin-top: auto; 
    padding: 0 12px; 
    font-size: clamp(9px, 0.9vw, 12px);
    font-weight: 600;
    color: #ffffff;
    background: #424242;
    width: 100%;
    
    height: 60px; 
    min-height: 60px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(65, 27, 10, 0.1);
}

.related-card:hover img {
    transform: scale(1.05);
}

.product-gallery .swiper-pagination {
    bottom: 5px !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.product-gallery .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #30303067 !important;
    opacity: 1;
    border-radius: 20px;
    transition: all 0.4s ease;
}

.product-gallery .swiper-pagination-bullet-active {
    background: var(--accent-color) !important;
    width: 30px; 
    box-shadow: 0 2px 8px rgba(247, 221, 137, 0.4);
}

/*====================circle=====================*/

.bg-circle {
    position: fixed;
    width: 1300px;
    height: 1250px;
    background: #fff1bb;
    border-radius: 50%; 
    top: -300px; 
    left: -400px;
    z-index: -1; 
    pointer-events: none; 
}

/* ================== RESPONSIVE DESIGN ================== */
@media screen and (max-width: 1200px) {
    .container {
        width: 90%;
    }

    .product-header {
        grid-template-columns: 1.1fr 1fr; 
        gap: 30px;
        min-height: auto;
    }

    .ingredients-side {
        grid-column: 1 / 2; 
        order: 1;
    }

    .product-image-section {
        grid-column: 2 / 3; 
        order: 2;
        z-index: 10;
    }

    .nutrition-side {
        grid-column: 1 / 3; 
        order: 3;
        max-width: 400px;
        margin: 40px auto 0;
        display: grid;
        gap: 20px 40px;
        align-items: start;
        padding: 30px;
    }

    .ingredients-box {
        width: calc(100% + 200px); 
    }

    .ingredients-list {
        padding: 15px 30px 20px 140px; 
    }

    .nutrition-section h3, .nutrition-section h3::after {
        grid-column: 1 / 3;
    }
    .product-main-img {
        width: 350px;
        max-width: 500px;
        max-height: 500px;
    }

    .related-card {
    height: 200px; 
    height: 200px;
    max-height: 200px;
    }

    .related-card img {
    height: 155px;
    min-height: 155px;
    max-height: 155px;
    }

    /* تنظیم مدیاهای داخل متن در تبلت */
    .product-description img {
        width: 85%;
    }
    
    .product-description iframe,
    .product-description video,
    .product-description .wp-video,
    .product-description .aparat-video {
        width: 85% !important;
        max-width: 85% !important;
    }
}

@media screen and (max-width: 992px) {
    .single-product-section {
        margin-top: 140px; 
    }

    .product-header {
        grid-template-columns: 1fr; 
        gap: 40px;
    }

    .product-image-section { grid-column: 1 / 2; order: 1; }
    .ingredients-side { grid-column: 1 / 2; order: 2; }
    
    .product-main-img {
        max-width: 400px; 
        max-height: 400px; 
    }

    .ingredients-box {
        width: 100%; 
        margin: 0 auto; 
    }

    .description-section h2 {
        margin-top: 40px;
    }

    .ingredients-list {
        padding: 15px 30px 20px 30px; 
    }

    .nutrition-side { 
        grid-column: 1 / 2; 
        order: 3;
        display: block; 
        max-width: 350px; 
        margin: 0 auto; 
        padding: 25px 20px;
    }

    .product-title {
        padding-right: 0;
    }

    .side-title-line {
        width: 40%;
    }

    .bg-circle {
        width: 800px;
        height: 800px;
        top: -150px;
        left: -200px;
    }

    .product-gallery-section h2 {
        margin-top: 40px;
    }
}

@media screen and (max-width: 500px) {
    .container {
        width: 90%;
    }

    .single-product-section {
        margin-top: 85px;
    }

    .product-name-header {
        font-size: 14px;
        padding: 12px 20px;
    }

    .product-title {
        font-size: 16px;
    }

    .ingredients-list {
        padding: 10px 20px 15px 20px;
    }

    .ingredients-list li {
        font-size: 11px;
        line-height: 2;
    }

    .nutrition-side {
        max-width: 320px; 
        padding: 20px 15px;
    }

    .product-main-img {
        max-width: 300px;
        max-height: 300px;
    }

    .description-line {
        width: 100%;
    }

    .product-description p {
        width: 100%;
        font-size: 14px;
    }

    .description-section h2 {
        margin-top: 40px;
    }

    .related-card {
        height: 240px; 
        min-height: 240px;
        max-height: 240px;
    }

    .related-card img {
        height: 155px;
        min-height: 155px;
        max-height: 155px;
    }

    .related-card h4 {
        height: 55px;
        min-height: 55px;
    }

    .bg-circle {
        width: 500px;
        height: 500px;
        top: -50px;
        left: -50px;
    }
   
    .side-title-line {
        width: 100%;
    }

    .product-gallery-section h2 {
        margin-top: 40px;
    }
    
    /* عرض ۱۰۰ درصد مدیاها در گوشی موبایل */
    .product-description img {
        width: 100%;
    }
    
    .product-description iframe,
    .product-description video,
    .product-description .wp-video,
    .product-description .aparat-video {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* =======================================================
   تنظیمات مخصوص زبان انگلیسی (LTR) برای صفحه تک محصول
======================================================= */
[dir="ltr"] .product-name-header {
    text-align: left;
    border-top-right-radius: 20px;
    border-top-left-radius: 20px;
}

[dir="ltr"] .ingredients-box {
    right: auto;
    left: 0;
}

[dir="ltr"] .ingredients-list {
    padding: 15px 190px 15px 40px; /* قرینه شدن پدینگ‌ها برای انگلیسی */
    text-align: left;
}

[dir="ltr"] .nutrition-bar-fill .label {
    text-align: left;
}

[dir="ltr"] .nutrition-bar-fill .value {
    text-align: right;
    direction: ltr; /* اصلاح جهت اعداد در انگلیسی */
}

/* ریسپانسیو LTR */
@media screen and (max-width: 1200px) {
    [dir="ltr"] .ingredients-list {
        padding: 15px 140px 20px 30px;
    }
}

@media screen and (max-width: 992px) {
    [dir="ltr"] .ingredients-list {
        padding: 15px 30px 20px 30px; 
    }
}
