/* ===================================================================
   دکمه‌ی شناور «درخواست تماس» و پنل کشویی آن
   با CSS خودِ سایت نوشته شده است (Tailwind فقط برای پنل ادمین است).
   همه‌ی فاصله‌ها منطقی‌اند تا در RTL و LTR بدون کد جدا درست بیفتند.
   =================================================================== */

.cw {
    position: fixed;
    inset-block-end: 24px;
    inset-inline-end: 24px;
    z-index: 1090;
    font-family: inherit;
    /* روی موبایل ظرف تمام‌عرض است؛ فضای خالی کنار دکمه نباید کلیک صفحه‌ی زیرش را بگیرد */
    pointer-events: none;
}

.cw > * {
    pointer-events: auto;
}

/* --- دکمه‌ی شناور --- */
.cw__toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--brand-orange-strong, #C84516);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(11, 70, 84, .28);
    transition: transform .3s ease, opacity .3s ease, box-shadow .2s ease, background-color .2s ease, padding .25s ease;
}

.cw__toggle:hover,
.cw__toggle:focus-visible {
    background: #A93A12;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(11, 70, 84, .34);
}

.cw__toggle:focus-visible,
.cw :where(button, input, textarea, select):focus-visible {
    outline: 3px solid #0B4654;
    outline-offset: 2px;
}

.cw__toggle svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: currentColor;
}

/* برچسب با max-width جمع می‌شود نه display:none، تا نام دکمه برای صفحه‌خوان بماند */
.cw__toggle-label {
    display: inline-block;
    max-width: 16em;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width .25s ease, opacity .2s ease;
}

/* --- هنگام اسکرول رو به پایین کنار می‌رود (contact-widget.js) --- */
.cw.is-away:not(.is-open) .cw__toggle {
    transform: translateY(calc(100% + 32px));
    opacity: 0;
    pointer-events: none;
}

/* --- حالت جمع: فقط آیکون، دایره‌ی ۵۲ پیکسلی ---
   دسکتاپ بعد از کمی اسکرول جمع می‌شود و با هاور یا فوکوس باز؛ گوشی همیشه جمع است. */
.cw.is-compact .cw__toggle {
    gap: 0;
    padding: 16px;
}

.cw.is-compact .cw__toggle-label {
    max-width: 0;
    opacity: 0;
}

@media (hover: hover) and (min-width: 768px) {
    .cw.is-compact .cw__toggle:is(:hover, :focus-visible) {
        gap: 10px;
        padding: 14px 22px;
    }

    .cw.is-compact .cw__toggle:is(:hover, :focus-visible) .cw__toggle-label {
        max-width: 16em;
        opacity: 1;
    }
}

/* --- پرده‌ی پشت پنل باز ---
   پنل پنجره‌ی مودال است، پس هنگام باز بودن حتی از نوار بالا (۱۱۰۰) هم بالاتر می‌رود. */
.cw.is-open {
    z-index: 1150;
}

.cw__backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(12, 35, 24, .45);
}

.cw__backdrop[hidden] {
    display: none;
}

/* --- پنل --- */
.cw__panel {
    position: absolute;
    inset-block-end: calc(100% + 14px);
    inset-inline-end: 0;
    width: min(380px, calc(100vw - 32px));
    max-height: min(74vh, 640px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(11, 70, 84, .28);
    border: 1px solid #e3e7ee;
}

.cw__panel[hidden] {
    display: none;
}

.cw__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    background: #0B4654;
    color: #fff;
    border-start-start-radius: 17px;
    border-start-end-radius: 17px;
}

.cw__head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.6;
    color: #fff;
}

.cw__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cw__close:hover {
    background: rgba(255, 255, 255, .26);
}

.cw__body {
    padding: 16px 20px 22px;
}

.cw__intro {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 2;
    color: #64707f;
}

.cw__field {
    margin-bottom: 12px;
}

.cw__field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0C2318;
}

.cw__field input,
.cw__field select,
.cw__field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e3e7ee;
    border-radius: 10px;
    background: #f7f9fc;
    font-family: inherit;
    /* ۱۶ پیکسل: کمتر از این، سافاری آیفون هنگام تایپ صفحه را زوم می‌کند */
    font-size: 16px;
    color: #212529;
}

.cw__field input:focus,
.cw__field select:focus,
.cw__field textarea:focus {
    border-color: #FF6D45;
    background: #fff;
}

.cw__field textarea {
    min-height: 92px;
    resize: vertical;
}

.cw__hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #64707f;
}

.cw__hint--warning {
    color: #8a5a00;
}

.cw__hint[hidden] {
    display: none;
}

/* زمینه‌ی فعالیت و کد HS: اختیاری و بسته */
.cw__more {
    margin-bottom: 14px;
    border: 1px dashed #d5dbe4;
    border-radius: 10px;
    padding: 0 14px;
}

.cw__more summary {
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #0B4654;
    cursor: pointer;
}

.cw__more[open] summary {
    margin-bottom: 4px;
}

/* ورودی کد تأیید همیشه لاتین و چپ‌چین خوانده می‌شود */
.cw__code {
    letter-spacing: .5em;
    text-align: center;
    direction: ltr;
    font-size: 20px !important;
    font-weight: 700;
}

.cw__submit {
    width: 100%;
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand-orange-strong, #C84516);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.cw__submit:hover:not(:disabled) {
    background: #A93A12;
}

.cw__submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.cw__links {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.cw__link {
    border: 0;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    color: #0B4654;
    text-decoration: underline;
    cursor: pointer;
}

.cw__link:disabled {
    color: #98a2b1;
    text-decoration: none;
    cursor: not-allowed;
}

/* --- پیام‌ها --- */
.cw__alert {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.9;
}

.cw__alert[hidden] {
    display: none;
}

.cw__alert--error {
    background: #fdeeee;
    border: 1px solid #f3cccc;
    color: #b3362f;
}

.cw__alert--info {
    background: #e8f7ee;
    border: 1px solid #bfe8d0;
    color: #1d6b3f;
}

.cw__done {
    text-align: center;
    padding: 12px 0 4px;
}

.cw__done h3 {
    margin: 0 0 8px;
    font-size: 17px;
    color: #1d6b3f;
}

.cw__done p {
    margin: 0;
    font-size: 13px;
    line-height: 2;
    color: #64707f;
}

/* --- تله‌ی ربات: از دید و از دسترس کاربر خارج، ولی برای ربات پر می‌شود --- */
.cw__hp {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* --- گوشی: همیشه فقط آیکون --- */
@media (max-width: 767px) {
    .cw .cw__toggle {
        gap: 0;
        padding: 16px;
    }

    .cw .cw__toggle-label {
        max-width: 0;
        opacity: 0;
    }

    /* دکمه در انتهای صفحه برمی‌گردد؛ آخرین سطر فوتر زیرش نماند.
       فاصله روی بخش تیره‌ی پایین فوتر است؛ خود #colophon زمینه ندارد و نوار سفید می‌داد. */
    body:has(.cw) #colophon .elementor-element-af66862 {
        padding-bottom: 84px;
    }
}

/* --- موبایل: پنل تمام‌عرض بالای دکمه، بدون افتادن روی عناصر چسبیده‌ی بالا --- */
@media (max-width: 575px) {
    .cw {
        inset-block-end: 16px;
        inset-inline-end: 16px;
        inset-inline-start: 16px;
    }

    .cw__panel {
        width: auto;
        inset-inline: 0;
        max-height: min(70vh, 560px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw__toggle,
    .cw__toggle-label {
        transition: none;
    }

    .cw__toggle:hover,
    .cw__toggle:focus-visible {
        transform: none;
    }
}
