/* ==========================================================================
   EternalClick Frontend Styles v2.1 – تمیز و بدون تداخل
   ========================================================================== */

/* ── Wrapper اصلی ────────────────────────────────────────────────────────── */
.ccm-cta {
    position: relative;
    margin: 28px 0;
    padding: 24px;
    border: 1px solid #d9dfe7;
    border-radius: 12px;
    background-color: #f5f7fb;
    color: #1a1a1a;
    box-shadow: 0 4px 24px -8px rgba(15,23,42,.12);
    transition: transform .25s ease, box-shadow .25s ease;
    direction: rtl;
    font-family: inherit;
    box-sizing: border-box;
}
.ccm-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px -8px rgba(15,23,42,.18);
}

/* ── Inner: همیشه flex عمودی – هر بخش (تصویر بالا/پایین، body، محتوا) زیر هم ─ */
.ccm-cta-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Body: ظرف کنار هم (تصویر چپ/راست + محتوا) ──────────────────────────── */
.ccm-cta-body {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* ── تصویر ────────────────────────────────────────────────────────────────── */
.ccm-cta-media img {
    display: block;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

/* تصویر بالا / پایین: عرض کامل */
.ccm-cta-media--top,
.ccm-cta-media--bottom {
    width: 100%;
}
.ccm-cta-media--top img,
.ccm-cta-media--bottom img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 8px;
}

/* تصویر چپ/راست: اندازه ثابت */
.ccm-cta-media--right,
.ccm-cta-media--left {
    flex-shrink: 0;
    width: 140px;
}
.ccm-cta-media--right img,
.ccm-cta-media--left img {
    width: 140px;
    border-radius: 8px;
}

/* ── موقعیت تصویر: کلاس روی .ccm-cta ───────────────────────────────────── */

/* تصویر راست: تصویر در سمت راست (در RTL = ابتدای flex row) */
.ccm-img-right .ccm-cta-body {
    flex-direction: row;
}

/* تصویر چپ: تصویر در سمت چپ (در RTL = انتهای flex row) */
.ccm-img-left .ccm-cta-body {
    flex-direction: row-reverse;
}

/* تصویر بالا/پایین: body عمودی */
.ccm-img-top .ccm-cta-body,
.ccm-img-bottom .ccm-cta-body {
    flex-direction: column;
}

/* ── محتوا (عنوان + توضیحات + دکمه) ────────────────────────────────────── */
.ccm-cta-content {
    flex: 1;
    min-width: 0;
}

.ccm-cta-title {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.ccm-cta-description {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.7;
}
.ccm-cta-description p { margin: 0 0 8px; }
.ccm-cta-description p:last-child { margin-bottom: 0; }

/* ── تراز متن ────────────────────────────────────────────────────────────── */
.ccm-text-right  .ccm-cta-content { text-align: right; }
.ccm-text-center .ccm-cta-content { text-align: center; }
.ccm-text-left   .ccm-cta-content { text-align: left; }

/* تراز دکمه وقتی متن وسط است */
.ccm-text-center .ccm-cta-actions { text-align: center; }
.ccm-text-left   .ccm-cta-actions { text-align: left; }
.ccm-text-right  .ccm-cta-actions { text-align: right; }

/* ── دکمه ────────────────────────────────────────────────────────────────── */
.ccm-cta-actions {
    margin-top: 14px;
}

/* وقتی دکمه بالای محتوا است */
.ccm-cta-actions--top {
    margin-top: 0;
    margin-bottom: 12px;
}

.ccm-cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 999px;
    background: #6366f1;
    color: #fff !important;
    text-decoration: none !important;
    border: 2px solid transparent;
    box-shadow: 0 4px 14px -4px rgba(99,102,241,.5);
    transition: filter .2s ease, box-shadow .2s ease, transform .15s ease;
    white-space: nowrap;
    cursor: pointer;
}
.ccm-cta-button:hover,
.ccm-cta-button:focus {
    filter: brightness(1.1);
    box-shadow: 0 6px 20px -4px rgba(99,102,241,.6);
    transform: translateY(-1px);
    color: #fff !important;
    text-decoration: none !important;
}

/* ── موقعیت دکمه: inline (کنار متن) ─────────────────────────────────────── */
.ccm-btn-pos-inline .ccm-cta-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
/* در حالت inline، بخش متن باید flex:1 باشد */
.ccm-btn-pos-inline .ccm-cta-text-wrap {
    flex: 1;
    min-width: 0;
}
.ccm-btn-pos-inline .ccm-cta-actions {
    flex-shrink: 0;
    margin-top: 0;
}

/* ── Behavioral Hidden ───────────────────────────────────────────────────── */
.ccm-behavior-hidden {
    visibility: hidden;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}
.ccm-behavior-revealed {
    visibility: visible;
    opacity: 1;
    max-height: none;
    pointer-events: auto;
    animation: ccm-fadeIn .4s ease-in-out;
}
@keyframes ccm-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Sticky footer ───────────────────────────────────────────────────────── */
.ccm-cta.ccm-placement-sticky_footer {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    margin: 0;
    border-radius: 12px 12px 0 0;
    z-index: 9999;
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
}

/* ── موبایل ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .ccm-cta { padding: 16px; }

    /* همه حالت‌های تصویر در موبایل عمودی می‌شوند */
    .ccm-img-right .ccm-cta-body,
    .ccm-img-left  .ccm-cta-body {
        flex-direction: column;
    }
    .ccm-cta-media--right,
    .ccm-cta-media--left {
        width: 100%;
    }
    .ccm-cta-media--right img,
    .ccm-cta-media--left img {
        width: 100%;
        max-height: 200px;
    }

    /* دکمه inline در موبایل زیر متن */
    .ccm-btn-pos-inline .ccm-cta-content {
        flex-direction: column;
    }
    .ccm-btn-pos-inline .ccm-cta-actions {
        width: 100%;
    }
    .ccm-cta-button {
        width: 100%;
        justify-content: center;
    }

    /* تراز وسط در موبایل برای همه */
    .ccm-cta-content { text-align: center; }
    .ccm-cta-actions { text-align: center; }
}
