/* ============================================================
 *  Janiyar Segal — Price Cards Dashboard v5.0
 *  نسخه یکدست — تم روشن روی همه دستگاه‌ها (دسکتاپ/تبلت/موبایل)
 * ============================================================ */

/* ═══════════════════════════════════════════════════════════
 *  بخش اصلی
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards {
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #f1f5f9 100%);
    padding-block: clamp(40px, 5vw, 64px);
    overflow: hidden;
    isolation: isolate;
}

/* هاله نارنجی (وقتی عکس نیست) */
.js-price-cards:not(.has-bg)::before {
    content: '';
    position: absolute;
    top: -50%;
    inset-inline-start: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 140, 66, 0.08) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
 *  تصویر پس‌زمینه + overlay
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.js-price-cards__bg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: brightness(1.05) contrast(1.05) saturate(1.1);
    transform: scale(1.05);
}

/* Overlay شیشه سفید — یکدست روی همه دستگاه‌ها */
.js-price-cards__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.7) 0%,
            rgba(255, 255, 255, 0.55) 40%,
            rgba(248, 250, 252, 0.6) 70%,
            rgba(255, 255, 255, 0.72) 100%
        ),
        radial-gradient(
            ellipse at 25% 50%,
            rgba(255, 140, 66, 0.04) 0%,
            transparent 60%
        );
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
 *  Container
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1320px;
    margin-inline: auto;
    padding-inline: clamp(16px, 3vw, 32px);

    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(0, 3fr);
    gap: clamp(24px, 3vw, 48px);
    align-items: center;
}

/* ═══════════════════════════════════════════════════════════
 *  ستون راست — intro (تیره روی پس‌زمینه روشن)
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards__intro {
    text-align: right;
    color: #0f172a;
}

.js-price-cards__title {
    font-size: clamp(22px, 2.4vw, 30px);
    font-weight: 900;
    line-height: 1.3;
    color: #0f172a;
    margin: 0 0 14px;
    letter-spacing: -0.5px;
    position: relative;
    padding-bottom: 14px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.js-price-cards__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, #ff8c42 0%, #ff5500 100%);
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(255, 140, 66, 0.5);
}

.js-price-cards__desc {
    font-size: 14px;
    line-height: 1.9;
    color: #1e293b;
    margin: 0 0 20px;
    max-width: 340px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* دکمه CTA */
.js-price-cards__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    background: rgba(255, 255, 255, 0.75);
    color: #0f172a;
    border: 1.5px solid rgba(15, 23, 42, 0.2);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.js-price-cards__cta:hover {
    background: linear-gradient(135deg, #ff8c42 0%, #ff5500 100%);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(255, 140, 66, 0.4);
}

/* ═══════════════════════════════════════════════════════════
 *  ★ تیک ارزش افزوده
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards__vat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 8px 14px 8px 10px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 999px;
    margin-bottom: 20px;
    transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.js-price-cards__vat-toggle:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 140, 66, 0.4);
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.15);
}

.js-price-vat-input {
    display: none;
}

.js-price-cards__vat-slider {
    width: 42px;
    height: 22px;
    background: rgba(148, 163, 184, 0.45);
    border-radius: 11px;
    position: relative;
    transition: background 240ms;
    flex-shrink: 0;
    display: inline-block;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.js-price-cards__vat-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.js-price-vat-input:checked + .js-price-cards__vat-slider {
    background: linear-gradient(135deg, #ff8c42 0%, #ff5500 100%);
    box-shadow:
        0 0 12px rgba(255, 140, 66, 0.5),
        inset 0 1px 2px rgba(15, 23, 42, 0.1);
}

.js-price-vat-input:checked + .js-price-cards__vat-slider::after {
    transform: translateX(-20px);
}

.js-price-cards__vat-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    transition: color 240ms;
}

.js-price-vat-input:checked ~ .js-price-cards__vat-label {
    color: #ea580c;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
 *  گرید ۴ کارت
 *  ═══════════════════════════════════════════════════════════ */
.js-price-cards__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

/* ═══════════════════════════════════════════════════════════
 *  کارت — شیشه تیره (کنتراست عالی با پس‌زمینه روشن)
 *  ═══════════════════════════════════════════════════════════ */
.js-price-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    background: linear-gradient(
        160deg,
        rgba(30, 41, 59, 0.85) 0%,
        rgba(15, 23, 42, 0.92) 100%
    );
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: all 320ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow:
        0 6px 20px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.js-price-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #ff8c42 0%, #ff5500 100%);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.js-price-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 140, 66, 0.5);
    background: linear-gradient(
        160deg,
        rgba(30, 41, 59, 0.92) 0%,
        rgba(15, 23, 42, 0.98) 100%
    );
    box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.2),
        0 0 0 1px rgba(255, 140, 66, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.js-price-card:hover::before {
    transform: scaleX(1);
}

.js-price-card__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 12px 12px;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

/* آیکون */
.js-price-card__icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 16px rgba(255, 140, 66, 0.25));
    transition: transform 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

.js-price-card__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.js-price-card:hover .js-price-card__icon {
    transform: translateY(-2px) scale(1.05);
    filter: drop-shadow(0 8px 20px rgba(255, 140, 66, 0.5));
}

/* نام */
.js-price-card__name {
    font-size: 12.5px;
    font-weight: 700;
    color: #e2e8f0;
    text-align: center;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.js-price-card__grade {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 140, 66, 0.12);
    color: #ff8c42;
    border: 1px solid rgba(255, 140, 66, 0.3);
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 800;
    font-family: 'Inter', monospace;
    letter-spacing: 0.3px;
    direction: ltr;
}

/* قیمت */
.js-price-card__price-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    width: 100%;
    direction: ltr;
}

.js-price-card__price {
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    font-family: 'Inter', 'Vazirmatn', system-ui, sans-serif;
    letter-spacing: -0.3px;
    transition: color 240ms, transform 240ms;
}

.js-price-card__price.is-vat-active {
    color: #ff8c42;
}

.js-price-card__unit {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
}

.js-price-card__change {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    margin-inline-start: 4px;
}

.js-price-card__change.is-up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
}

.js-price-card__change.is-down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.js-price-card__change.is-flat {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
}

/* نمودار */
.js-price-card__chart {
    width: 100%;
    height: 42px;
    margin-top: 2px;
    position: relative;
}

.js-price-card__chart canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* تاریخ */
.js-price-card__updated {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.2px;
    direction: rtl;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════
 *  دکمه‌ها
 *  ═══════════════════════════════════════════════════════════ */
.js-price-card__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px 10px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    margin-top: auto;
}

.js-price-card__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    min-height: 34px;
}

.js-price-card__btn svg {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}

.js-price-card__btn--buy {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.js-price-card__btn--buy:hover {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(22, 163, 74, 0.5);
}

.js-price-card__btn--order {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.js-price-card__btn--order:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.5);
}

.js-price-card__btn--chart {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.3);
}

.js-price-card__btn--chart:hover {
    background: rgba(255, 140, 66, 0.18);
    color: #ff8c42;
    border-color: rgba(255, 140, 66, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(255, 140, 66, 0.25);
}

/* ═══════════════════════════════════════════════════════════
 *  ★ Responsive — تبلت (تا 1024px)
 *  ═══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .js-price-cards__container {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .js-price-cards__intro {
        text-align: center;
    }

    .js-price-cards__title::after {
        inset-inline-start: 50%;
        transform: translateX(50%);
    }

    .js-price-cards__desc {
        margin-inline: auto;
    }

    .js-price-cards__vat-toggle {
        margin-inline: auto;
        display: flex;
        width: fit-content;
    }

    .js-price-cards__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    /* عکس — تنظیم برای موبایل/تبلت */
    .js-price-cards__bg img {
        object-position: center;
        transform: scale(1);
        filter: brightness(1.1) contrast(1.03) saturate(1.08);
    }

    /* Overlay — روشن‌تر */
    .js-price-cards__overlay {
        background:
            linear-gradient(135deg,
                rgba(255, 255, 255, 0.78) 0%,
                rgba(255, 255, 255, 0.65) 40%,
                rgba(248, 250, 252, 0.7) 70%,
                rgba(255, 255, 255, 0.8) 100%
            ),
            radial-gradient(
                ellipse at 50% 30%,
                rgba(255, 140, 66, 0.04) 0%,
                transparent 60%
            );
    }

    /* کارت‌ها — شیشه تیره‌تر برای کنتراست بهتر */
    .js-price-card {
        background: linear-gradient(
            160deg,
            rgba(30, 41, 59, 0.9) 0%,
            rgba(15, 23, 42, 0.95) 100%
        );
        box-shadow:
            0 8px 24px rgba(15, 23, 42, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }

    .js-price-card:hover {
        background: linear-gradient(
            160deg,
            rgba(30, 41, 59, 0.95) 0%,
            rgba(15, 23, 42, 1) 100%
        );
    }
}

/* ═══════════════════════════════════════════════════════════
 *  ★ Responsive — موبایل (تا 560px)
 *  ═══════════════════════════════════════════════════════════ */
@media (max-width: 560px) {
    .js-price-cards {
        padding-block: 36px;
    }

    .js-price-cards__container {
        padding-inline: 16px;
    }

    .js-price-cards__title {
        font-size: 20px;
    }

    .js-price-cards__desc {
        font-size: 13px;
        max-width: 100%;
    }

    .js-price-cards__cta {
        padding: 11px 22px;
        font-size: 13px;
    }

    .js-price-cards__vat-toggle {
        padding: 7px 12px 7px 8px;
    }

    .js-price-cards__vat-label {
        font-size: 11.5px;
    }

    .js-price-cards__vat-slider {
        width: 38px;
        height: 20px;
    }

    .js-price-cards__vat-slider::after {
        width: 16px;
        height: 16px;
    }

    .js-price-vat-input:checked + .js-price-cards__vat-slider::after {
        transform: translateX(-18px);
    }

    .js-price-cards__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    /* عکس — بخش جالب‌تر نشون داده بشه */
    .js-price-cards__bg img {
        object-position: center 30%;
    }

    .js-price-card__link {
        padding: 14px 10px 10px;
    }

    .js-price-card__icon {
        width: 44px;
        height: 44px;
    }

    .js-price-card__name {
        font-size: 11.5px;
    }

    .js-price-card__price {
        font-size: 14px;
    }

    .js-price-card__unit {
        font-size: 9px;
    }

    .js-price-card__change {
        font-size: 10px;
    }

    .js-price-card__chart {
        height: 36px;
    }

    .js-price-card__updated {
        font-size: 9.5px;
    }

    .js-price-card__actions {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 8px 8px 10px;
    }

    .js-price-card__btn {
        font-size: 11px;
        padding: 7px 5px;
        min-height: 32px;
    }
}

/* ═══════════════════════════════════════════════════════════
 *  ★ Responsive — موبایل کوچک (تا 380px)
 *  ═══════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
    .js-price-cards__grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
 *  Reduced motion
 *  ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .js-price-card,
    .js-price-card__icon,
    .js-price-card__btn,
    .js-price-cards__cta,
    .js-price-cards__vat-toggle,
    .js-price-cards__vat-slider,
    .js-price-cards__vat-slider::after {
        transition: none;
    }
    .js-price-card:hover {
        transform: none;
    }
}