/* =========================================
   Grid Layout (چیدمان شبکه‌ای محصولات)
========================================= */
.chinyaft-grid {
    display: grid;
    /* این خط باعث می‌شود در موبایل 1 ستونه، در تبلت 2 یا 3 ستونه و در کامپیوتر 4 ستونه شود */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 20px;
    width: 100%;
}

/* =========================================
   Product Card Styles (استایل کارت محصول)
========================================= */
.chinyaft-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chinyaft-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

/* بخش تصویر */
.card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 120%; /* نسبت ابعاد تصویر (برای لباس معمولاً مستطیل عمودی بهتر است) */
    overflow: hidden;
    background: #f8f9fa;
}

.cy-product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* عکس را به زیبایی برش می‌زند تا کادر پر شود */
    transition: transform 0.5s ease;
}

.chinyaft-card:hover .cy-product-img {
    transform: scale(1.08); /* زوم ملایم عکس در هاور */
}

/* در صورت نداشتن عکس */
.cy-no-img {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
}

/* بج کد محصول */
.cy-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    color: #333;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* لایه روی عکس در هاور (Overlay) */
.card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
}

.chinyaft-card:hover .card-overlay {
    opacity: 1;
}

.cy-view-btn {
    background: #1e88e5;
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.chinyaft-card:hover .cy-view-btn {
    transform: translateY(0);
}

/* بدنه کارت (متن و قیمت) */
.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #2f3542;
    margin: 0 0 15px 0 !important;
    line-height: 1.4;
    text-align: right;
}

.card-footer {
    margin-top: auto;
    border-top: 1px dashed #eee;
    padding-top: 12px;
}

.card-price {
    color: #1e88e5;
    text-align: right;
}

.price-amount {
    font-size: 18px;
    font-weight: 900;
}

.price-currency {
    font-size: 12px;
    color: #777;
    margin-right: 4px;
}

.price-call {
    font-size: 14px;
    color: #ff4757;
    font-weight: bold;
}





.chinyaft-brand-slider {
    background: #fff;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.brand-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
}

.brand-track::-webkit-scrollbar {
    display: none;
}

.brand-item {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #f4f6fa;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: .25s;
}

.brand-item.active,
.brand-item:hover {
    background: #1e88e5;
    color: #fff;
    border-color: #1e88e5;
}

/* Skeleton Loader */
.chinyaft-skeleton-wrap {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
    gap: 16px;
}

.chinyaft-skeleton-card {
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.sk-img {
    height: 160px;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        #eee 25%,
        #f5f5f5 37%,
        #eee 63%
    );
    background-size: 400% 100%;
    animation: sk 1.4s ease infinite;
}

.sk-line {
    height: 14px;
    margin-top: 12px;
    border-radius: 8px;
    background: linear-gradient(
        90deg,
        #eee 25%,
        #f5f5f5 37%,
        #eee 63%
    );
    background-size: 400% 100%;
    animation: sk 1.4s ease infinite;
}

.sk-line.short {
    width: 60%;
}

@keyframes sk {
    0% { background-position: 100% 0 }
    100% { background-position: 0 0 }
}



/* =========================================
   Product Card Styles (طراحی کارت محصول)
========================================= */
.chinyaft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.chinyaft-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: 1px solid #f0f0f0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chinyaft-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    border-color: #1e88e5;
}

/* Image Wrapper */
.card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* ساخت یک مربع کامل (نسبت 1:1) */
    overflow: hidden;
    background: #f8f9fa;
}

.cy-prod-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.chinyaft-card:hover .cy-prod-img {
    transform: scale(1.08);
}

/* Badge for Product Code */
.cy-badge-code {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    color: #333;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 2;
}

/* Hover Quick View Button */
.cy-quick-view {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.cy-quick-view span {
    background: #1e88e5;
    color: #fff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.chinyaft-card:hover .cy-quick-view {
    opacity: 1;
}

.chinyaft-card:hover .cy-quick-view span {
    transform: translateY(0);
}

/* Card Body */
.card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-brand {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    font-weight: 600;
}

.card-title {
    font-size: 16px;
    margin: 0 0 15px;
    color: #222;
    font-weight: 700;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* محدود کردن به دو خط */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Footer (Price) */
.card-footer {
    margin-top: auto;
    border-top: 1px dashed #eaeaea;
    padding-top: 12px;
}

.card-price {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #1e88e5;
}

.price-amount {
    font-size: 18px;
    font-weight: 800;
}

.price-currency {
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

/* =========================================
   Brand Filter Slider (اسلایدر برندها)
========================================= */
.chinyaft-brand-slider {
    background: #ffffff;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 100px; /* شکل بیضی و مدرن */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0f0f0;
}

.brand-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* اسکرول نرم در موبایل */
}

/* مخفی کردن اسکرول‌بار */
.brand-track::-webkit-scrollbar {
    display: none;
}
.brand-track {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.brand-item {
    padding: 10px 24px;
    border-radius: 50px;
    border: 2px solid transparent;
    background: #f8f9fa;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.brand-item:hover {
    background: #e3f2fd;
    color: #1e88e5;
}

.brand-item.active {
    background: #1e88e5;
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

/* =========================================
   Skeleton Loader (انیمیشن لودینگ)
========================================= */
.chinyaft-skeleton-wrap {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

.chinyaft-skeleton-card {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #f0f0f0;
}

.sk-img {
    width: 100%;
    padding-top: 100%; /* مربع کامل مثل عکس محصول */
    border-radius: 12px;
    background: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    margin-bottom: 15px;
}

.sk-line {
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    margin-bottom: 10px;
}

.sk-line.short {
    width: 50%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =========================================
   Modal / Popup (پاپ‌آپ محصول)
========================================= */
.chinyaft-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.chinyaft-modal:not(.hidden) {
    visibility: visible;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px); /* افکت تار شدن پس‌زمینه */
    transition: all 0.3s ease;
}

.modal-box {
    position: relative;
    width: 90%;
    max-width: 450px;
    background: #fff;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(30px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chinyaft-modal:not(.hidden) .modal-box {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background: #ff4757;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 71, 87, 0.3);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    transform: scale(1.1) rotate(90deg);
}

/* محتوای داخل پاپ‌آپ */
.modal-content-inner {
    text-align: center;
}

.modal-content-inner h2 {
    font-size: 22px;
    font-weight: 800;
    color: #2f3542;
    margin-bottom: 15px;
    line-height: 1.4;
}

.modal-price-tag {
    display: inline-block;
    background: #f1f2f6;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    color: #1e88e5;
    margin-bottom: 25px;
}

.wa-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(45deg, #25D366, #128C7E);
    color: #fff !important;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 16px;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
}

.wa-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(37, 211, 102, 0.4);
}

.wa-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* =========================================
   اصلاحات جدید (متن چین و واحد پول)
========================================= */

/* اصلاح مشکل بهم ریختگی متن و حروف جداگانه (توجه) */
.cy-china-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background-color: #f4f6fb;
    color: #1a428a;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    text-align: right;
    border-right: 3px solid #1a428a;
    margin-top: 15px;
    /* جلوگیری از فشرده شدن بیش از حد متن */
    flex-wrap: nowrap; 
    word-break: normal;
}

/* جلوگیری از جمع شدن سایز آیکون */
.cy-china-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.cy-china-notice .notice-text {
    flex-grow: 1;
}

/* اصلاح چیدمان قیمت (اول عدد بعد افغانی) */
.cy-price-wrap {
    display: flex;
    align-items: baseline;
    justify-content: flex-end; /* چون در قالب فارسی هستیم به سمت راست یا چپ دلخواه تنظیم میشود */
    gap: 6px;
    direction: rtl !important; /* این خط تضمین میکند عدد راست و حروف چپ بیفتند */
    margin-top: 15px;
}

.cy-price-number {
    font-size: 22px;
    font-weight: 900;
    color: #1a428a;
}

.cy-currency {
    font-size: 13px;
    font-weight: bold;
    color: #666;
}

/* استایل‌های درخت دسته‌بندی */
.cy-cat-list.sub-tree {
    padding-right: 15px !important; /* تو رفتگی برای زیرمجموعه‌ها */
    border-right: 1px solid #eee;   /* خط راهنما سمت راست */
    margin-right: 8px !important;
}

.cy-cat-item {
    margin-bottom: 8px;
}

.cy-cat-row {
    transition: all 0.2s;
    border-radius: 6px;
    padding: 4px;
}

.cy-cat-row:hover {
    background-color: #f5f5f5;
}

/* آیکون فلش */
.cy-cat-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

/* وقتی زیرمنو باز است، فلش بچرخد (کلاس open توسط جاوااسکریپت اضافه می‌شود) */
.cy-cat-toggle.open {
    transform: rotate(180deg);
}
