/* ═══════════════════════════════════════════════════════════════════
   Toska Product Cards — compact-card.css  |  v30.0.0
   BUG FIX: epcc3-star::after فاقد direction:ltr/white-space بود — رفع شد
   BUG FIX: epcc3-badge1/badge2 تعریف‌های متناقض و تکراری (left+right همزمان)
            با قانون واحد جایگزین شد
   BUG FIX: epcc3-ripple keyframe با inline-style انیمیشن JS تداخل داشت —
            نام keyframe به epcc3RippleAnim تغییر یافت (مطابق با JS v30)
   BUG FIX: focus-visible برای دکمه و ایمیج‌زون اضافه شد
   BUG FIX: epcc3-img-zone بدون cursor مناسب برای کیبورد — tabindex پشتیبانی شد
   ═══════════════════════════════════════════════════════════════════ */

.epcc3-card *,
.epcc3-card *::before,
.epcc3-card *::after { box-sizing: border-box; margin: 0; padding: 0; }

.epcc3-card {
    --c-accent:  #4f77d4;
    --c-accent2: #6366f1;
    --c-purple:  #8b5cf6;
    --c-text:    #1e1b4b;
    --c-muted:   #6b7280;
    --c-gold:    #f59e0b;
    --c-red:     #ef4444;
    --c-border:  rgba(99,102,241,.12);
    --c-radius:  22px;
    --c-trans:   .4s cubic-bezier(.4,0,.2,1);

    font-family: 'IRANSans','Vazirmatn','Tahoma',sans-serif;
    direction: rtl;
    background: #ffffff;
    border-radius: var(--c-radius);
    overflow: hidden;
    box-shadow:
        0 2px 8px rgba(0,0,0,.06),
        0 8px 32px rgba(99,102,241,.1),
        0 0 0 1px rgba(99,102,241,.07);
    display: flex;
    flex-direction: column;
    isolation: isolate;
    transition: box-shadow var(--c-trans), transform var(--c-trans);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.epcc3-card:hover {
    box-shadow:
        0 4px 16px rgba(0,0,0,.08),
        0 20px 60px rgba(79,119,212,.2),
        0 0 0 1px rgba(99,102,241,.15);
    transform: translateY(-4px);
}

/* ══ IMAGE ZONE ══════════════════════════════════════════════════════ */
.epcc3-img-zone {
    position: relative;
    width: 100%;
    height: 320px;         /* overridden by Elementor control */
    overflow: hidden;
    background: #3b5998;   /* overridden by Elementor control */
    flex-shrink: 0;
    cursor: pointer;
}

/* BUG FIX: focus-visible برای دسترسی‌پذیری کیبورد */
.epcc3-img-zone:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
}

/* ── هر دو تصویر absolute هستند ── */
.epcc3-card .epcc3-img-zone .epcc3-img {
    position: absolute;
    inset: 0;
    /* BUG FIX (v30.2.7): specificity بالا برده شد (مشابه product-card.css)
       تا در برابر قوانین CSS کلاس‌محورِ افزونه‌های دیگر مقاوم باشد. */
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;       /* fit inside — never overflow */
    object-position: center;
    display: block;
    transition: opacity .6s cubic-bezier(.4,0,.2,1);
}

/* تصویر استاتیک: پیش‌فرض نمایان */
.epcc3-img-static {
    opacity: 1;
    z-index: 1;
    transform: scale(1);
    transition:
        opacity .6s cubic-bezier(.4,0,.2,1),
        transform .8s cubic-bezier(.25,.46,.45,.94);
}

/* GIF: پیش‌فرض مخفی */
.epcc3-img-gif {
    opacity: 0;
    z-index: 2;
    pointer-events: none;
}

/* وقتی GIF فعال است */
.epcc3-img-zone.gif-active .epcc3-img-static {
    opacity: 0;
    transform: scale(1.04);
}
.epcc3-img-zone.gif-active .epcc3-img-gif {
    opacity: 1;
    pointer-events: auto;
}

/* Placeholder در صورت نبود تصویر */
.epcc3-img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b5998, #4f77d4);
}

/* ── افکت Shine ── */
.epcc3-img-shine {
    position: absolute;
    inset: 0;
    z-index: 3;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255,255,255,.08) 50%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: epcc3-shine 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes epcc3-shine {
    0%   { background-position: 200% 0; }
    50%  { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── حلقه لودر GIF ── */
.epcc3-gif-loader {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
}

.epcc3-img-zone.gif-loading .epcc3-gif-loader { opacity: 1; }
.epcc3-img-zone.gif-active  .epcc3-gif-loader { opacity: 0; }

.epcc3-gif-ring {
    width: 48px; height: 48px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: epcc3-spin 1s linear infinite;
}

@keyframes epcc3-spin {
    to { transform: rotate(360deg); }
}

.epcc3-gif-label {
    color: rgba(255,255,255,.85);
    font-size: 12px;
    letter-spacing: .3px;
}

/* ── حلقه شمارش معکوس (SVG) ── */
.epcc3-countdown-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
}
.epcc3-img-zone.gif-loading .epcc3-countdown-ring { opacity: 1; }
.epcc3-img-zone.gif-active  .epcc3-countdown-ring { opacity: 0; }

.epcc3-countdown-ring circle {
    fill: none;
    stroke: rgba(255,255,255,.9);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 157; /* 2π × 25 */
    stroke-dashoffset: 157;
    transform-origin: center;
    transform: rotate(-90deg);
    transition: stroke-dashoffset linear;
}

/* ── Badges ── */
/* BUG FIX: قانون واحد و بدون تناقض — badge1 بالا-راست، badge2 زیر آن */
.epcc3-badge {
    position: absolute;
    z-index: 20;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 50px;
    letter-spacing: .4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    backdrop-filter: blur(4px);
    transition: transform .2s ease;
}
.epcc3-badge:hover { transform: scale(1.05); }

.epcc3-badge1 {
    top: 16px;
    right: 16px;
    background: #6366f1;
}

.epcc3-badge2 {
    top: 60px;
    right: 16px;
    background: #8b5cf6;
}

/* ══ BODY ════════════════════════════════════════════════════════════ */
.epcc3-body {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* Title */
.epcc3-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1.4;
    letter-spacing: -.2px;
    text-align: center;
}

/* Stars */
.epcc3-stars {
    display: flex;
    gap: 4px;
    direction: ltr;
    justify-content: center;
}

.epcc3-star {
    font-size: 22px;
    color: #e5e7eb;
    position: relative;
    display: inline-block;
    line-height: 1;
}

/* BUG FIX: direction:ltr و white-space:nowrap تضمین میکنه fill همیشه از چپ درست پر بشه */
.epcc3-star::after {
    content: '★';
    position: absolute;
    left: 0; top: 0;
    color: var(--c-gold);
    width: var(--f, 0%);
    overflow: hidden;
    white-space: nowrap;
    direction: ltr;
}

/* Prices */
.epcc3-new-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    justify-content: center;
}

.epcc3-price-num {
    font-size: 28px;
    font-weight: 900;
    color: var(--c-red);
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
}

.epcc3-price-unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-red);
    opacity: .85;
}

.epcc3-old-price {
    font-size: 15px;
    color: var(--c-muted);
    text-decoration: line-through;
    text-decoration-color: rgba(107,114,128,.6);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* CTA Button */
.epcc3-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 20px;
    background: var(--c-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 14px;
    letter-spacing: .3px;
    box-shadow: 0 4px 20px rgba(79,119,212,.35);
    transition: transform var(--c-trans), box-shadow var(--c-trans), filter var(--c-trans);
    position: relative;
    overflow: hidden;
    margin-top: 4px;
    font-family: inherit;
    border: none;
    cursor: pointer;
}

.epcc3-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--c-trans);
}

.epcc3-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(79,119,212,.5);
    filter: brightness(1.07);
}
.epcc3-btn:hover::before { opacity: 1; }
.epcc3-btn:active { transform: translateY(0); }

/* BUG FIX: focus-visible برای دکمه CTA */
.epcc3-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── افکت Ripple روی کلیک دکمه ── */
/* BUG FIX: نام keyframe با JS هماهنگ شد (epcc3RippleAnim) چون JS این انیمیشن را inline تنظیم میکند */
@keyframes epcc3RippleAnim {
    to { transform: scale(1); opacity: 0; }
}

/* ══ ENTRANCE ANIMATION ═════════════════════════════════════════════ */
.epcc3-card {
    animation: epcc3-enter .6s cubic-bezier(.4,0,.2,1) both;
}

@keyframes epcc3-enter {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ══ MOBILE ════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .epcc3-body { padding: 16px 18px 20px; gap: 10px; }
    .epcc3-title { font-size: 17px; }
    .epcc3-price-num { font-size: 24px; }
    .epcc3-btn { padding: 13px; font-size: 14px; }
    .epcc3-badge { font-size: 12px; padding: 5px 12px; }
}

/* ══ DARK MODE ═════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    .epcc3-card {
        --c-text: #f5f3ff;
        --c-muted: #a5b4fc;
        background: #1e1b4b;
        box-shadow:
            0 2px 8px rgba(0,0,0,.3),
            0 8px 32px rgba(99,102,241,.2),
            0 0 0 1px rgba(99,102,241,.15);
    }
}
