﻿/* =============================================
   frm-modal.css  –  سیستم مودال با پیشوند frm
   مستقل و بدون تداخل با Bootstrap
   ============================================= */

:root {
    --modal-bg: #d9dfed;
    --form-input-bg: #d9dfed;
    --form-input-color: #374b76;
    --placeholder: #969696;
    --form-input-error-color: #ffc1b2;
    --form-text-error-color: #f02e00;
    --frm-btn-dark-bg: #374b76;
    --frm-btn-success-bg: #19c964;
    --frm-btn-danger-bg: #c92700;
    --frm-btn-primary-bg: #0041ff;
    --frm-btn-return-color: #969696;
    --white: #fff;
    --alert-blue-color: #5d86ff;
    --alert-blue-bg: #e8eeff;
}

/* ----- Overlay & Container ----- */
.frm-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.15s ease;
}

    .frm-overlay.frm-open {
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 1;
    }

.frm-container {
    background-color: var(--color-bg-secondary, #ffffff);
    border-radius: var(--radius-lg, 10px);
    width: 90%;
    max-width: 500px;
    box-shadow: none;
    border: none;
    direction: rtl;
    display: flex;
    flex-direction: column;
    animation: frm-pop 0.15s ease;
    max-height: 90vh; /* حداکثر ۹۰٪ ارتفاع صفحه */
    overflow: hidden; /* خودش اسکرول نمی‌شود */
}

.frm-textarea {
    direction: rtl;
    text-align: right;
    font-family:
                "Segoe UI Emoji",
                "Apple Color Emoji",
                "Noto Color Emoji",
                inherit,
                sans-serif;
}

@keyframes frm-pop {
    from {
        transform: scale(0.92);
        opacity: 0.4;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ----- حالت Inline ----- */
.frm-container.frm-inline {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    animation: none;
    background: transparent;
}

.frm-inline .frm-header {
    padding: var(--spacing-md) 0;
}

.frm-inline .frm-body {
    padding: var(--spacing-md) 0;
}

.frm-inline .frm-footer {
    padding: var(--spacing-md) 0;
}

/* ----- ناحیه بازگشت (فقط inline) ----- */
.frm-back-area {
    text-align: right;
    padding: 0 0 var(--spacing-sm) 0;
    cursor: default;
    width: fit-content;
}

.frm-back-btn {
    font-weight: 200;
    color: var(--frm-btn-return-color);
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    text-decoration: none;
}

    .frm-back-btn:hover {
        color: var(--color-active);
    }

    .frm-back-btn::before {
        content: "‹";
        font-size: 1.5rem;
        line-height: 1;
    }

/* ----- تصویر -----*/
/* تصویر بالای مودال */
.frm-image {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

    .frm-image img {
        max-width: 120px; /* عرض دلخواه – قابل تغییر */
        height: auto;
        display: inline-block;
        border: none;
    }

/* کلاس کمکی برای وسط‌چین کردن عنوان‌ها وقتی تصویر موجود است */
.frm-centered-header {
    text-align: center;
    flex: 1 1 100%; /* عرض کامل بگیرد تا مرکز شود */
}

    .frm-centered-header h5,
    .frm-centered-header .frm-description {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

/* ===== هدر صفحه (بالای فرم‌ها) ===== */
.frm-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.frm-page-titles {
    flex: 1 1 auto;
}

.frm-page-title {
    font-size: 1.0rem;
    font-weight: 800;
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-xs) 0;
}

.frm-page-desc {
    font-size: 0.80rem;
    color: var(--color-text-quaternary);
    margin: 0;
}

.frm-page-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: flex-end; /* چسبیدن به انتهای خط (چپ در RTL) */
}

/* در موبایل عناوین و دکمه‌ها زیر هم */
@media (max-width: 576px) {
    .frm-page-header {
        flex-direction: column;
        align-items: center; /* تغییر از stretch به center برای وسط‌چین شدن کل محتوا */
    }

    .frm-page-actions {
        justify-content: center; /* قبلاً flex-start بود، حالا دکمه وسط می‌آید */
        margin-top: var(--spacing-sm);
    }
}
/* ----- هدر ----- */

.frm-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: none;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.frm-header-titles {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
}

    .frm-header-titles h5 {
        margin: 0;
        font-weight: 600;
        color: var(--color-text-primary, #333);
    }

    .frm-header-titles .frm-description {
        font-size: 0.875rem;
        color: var(--color-text-quaternary, #666);
        margin: 0;
    }

.frm-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 0 0 auto;
}

.frm-close {
    color: var(--color-icon, #999);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    margin-right: auto;
}

    .frm-close:hover {
        color: var(--color-active, #1976D2);
    }

/* ----- بدنه ----- */
.frm-body {
    padding: var(--spacing-xl);
    color: var(--color-text-secondary, #444);
    overflow-y: auto; /* فقط بدنه اسکرول شود */
    flex: 1; /* فضای خالی را پر کند */
}

    /* ----- فیلدها ----- */
    .frm-body label {
        display: block;
        font-size: 1rem;
        margin: 0.5rem 0;
        text-align: right;
        color: var(--color-text-primary);
    }

    .frm-body input[type="text"],
    .frm-body input[type="number"],
    .frm-body input[type="tel"],
    .frm-body input[type="email"],
    .frm-body input[type="password"],
    .frm-body textarea,
    .frm-body select {
        background: var(--form-input-bg);
        border: 2px solid var(--form-input-bg);
        width: 100%;
        border-radius: 14px;
        min-height: 2.5rem;
        padding: 0.5rem 1rem;
        font-weight: 300;
        color: var(--form-input-color);
        font-family: inherit;
        font-size: 1rem;
        transition: border-color 0.2s;
        box-sizing: border-box;
        outline: none;
    }

    .frm-body textarea {
        height: auto;
        resize: vertical;
        outline: none;
    }

        .frm-body input:focus,
        .frm-body textarea:focus,
        .frm-body select:focus,
        .frm-body .form-control:focus { /* اگر از form-control بوت‌استرپ استفاده می‌کنید */
            outline: none !important;
            box-shadow: none !important;
            border-color: none !important; /*var(--color-active);*/
        }

        .frm-body input::placeholder,
        .frm-body textarea::placeholder {
            color: var(--placeholder);
        }

    /* حالت خطا */
    .frm-body .input-validation-error {
        border-color: var(--form-input-error-color) !important;
    }

.field-validation-error {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--form-text-error-color);
}

/*.field-validation-error::before {
    content: "\f06a";
    font-family: "Font Awesome 6 Free", "FontAwesome", sans-serif;
    font-weight: 900;
    font-size: 0.75em;
}*/

.field-validation-valid {
    display: none;
}

/* ----- فوتر (دکمه‌ها) ----- */
.frm-header,
.frm-footer {
    flex-shrink: 0; /* هدر و فوتر کوچک نشوند */
}

.frm-footer {
    padding: var(--spacing-lg) var(--spacing-xl);
    border-top: none;
    display: flex;
    justify-content: flex-end; /* همیشه از چپ شروع شوند */
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

    /* تک دکمه: وسطچین */
    .frm-footer[data-buttons="1"] {
        justify-content: center;
    }

/* ----- کلاس‌های دکمه با پیشوند frm ----- */
.frm-btn {
    min-width: 160px;
    height: 48px;
    background: transparent;
    outline: none !important;
    border-radius: 14px !important;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1em;
    line-height: calc(48px - 1rem);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    transition: all 0.3s ease-in-out;
    font-family: inherit;
    cursor: pointer;
}
.frm-btn-xs{
    min-width: 80px;
    height: 32px;
    padding: 0.25rem 0.6rem;
    font-size: 0.85em;
    line-height: calc(32px - 0.5rem);
    border-radius: 10px !important;
}

.frm-btn-default {
    background-color: var(--color-bg-header-btn, #dfe2e8);
    border-color: var(--color-bg-header-btn, #dfe2e8);
    color: var(--color-text-primary, #333) !important;
}

.frm-btn-primary {
    background-color: var(--frm-btn-primary-bg);
    border-color: var(--frm-btn-primary-bg);
    color: var(--white) !important;
}

.frm-btn-dark {
    background-color: var(--frm-btn-dark-bg);
    border-color: var(--frm-btn-dark-bg);
    color: var(--white) !important;
}

.frm-btn-success {
    background-color: var(--frm-btn-success-bg);
    border-color: var(--frm-btn-success-bg);
    color: var(--white) !important;
}

.frm-btn-danger {
    background-color: var(--frm-btn-danger-bg);
    border-color: var(--frm-btn-danger-bg);
    color: var(--white) !important;
}

/* غیرفعال */
.frm-btn:disabled, .frm-btn:disabled:hover,
button:disabled, button:disabled:hover {
    opacity: 0.65;
    background-color: var(--color-button-disable-bg);
    border-color: #eaeaea;
    color: var(--color-button-disable) !important;
    cursor: default;
    filter: none;
}
/*فاصله ایکون با متن*/
.frm-btn i {
    margin-left: 10px;
}
/* ----- اسپینر ----- */
.frm-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--color-active, #1976D2);
    border-radius: 50%;
    border-top-color: #fff;
    animation: frm-spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes frm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ----- تم تاریک ----- */
[data-theme="dark"] .frm-overlay {
    background-color: rgba(0,0,0,0.7);
}

[data-theme="dark"] .frm-container {
    background-color: var(--color-bg-secondary, #1e1e1e);
    color: var(--color-text-primary, #e0e0e0);
}

[data-theme="dark"] .frm-body label {
    color: var(--color-text-primary, #e0e0e0);
}

[data-theme="dark"] .frm-body input,
[data-theme="dark"] .frm-body textarea,
[data-theme="dark"] .frm-body select {
    background: var(--color-bg-quaternary);
    border-color: var(--color-border-primary);
    color: var(--color-text-primary);
}

[data-theme="dark"] .frm-body .input-validation-error {
    border-color: #f87171 !important;
}

[data-theme="dark"] .field-validation-error {
    color: #f87171;
}


/* مودال پاپ‌آپ: دو دکمه → یکی چپ، یکی راست */
.frm-container:not(.frm-inline) .frm-footer[data-buttons="2"] {
    justify-content: space-between;
}

/* مودال Inline یا پاپ‌آپ با بیش از ۲ دکمه → از چپ به راست (در RTL) */
.frm-container.frm-inline .frm-footer[data-buttons="2"],
.frm-container.frm-inline .frm-footer[data-buttons="3"],
.frm-container:not(.frm-inline) .frm-footer[data-buttons="3"] {
    justify-content: flex-end;
}

.frm-footer[data-buttons="3"] {
    flex-wrap: nowrap; /* جلوگیری از شکستن خط */
}

/* ----- ریسپانسیو ----- */
@media (max-width: 576px) {
    .frm-container:not(.frm-inline) {
        width: 95%;
        margin: 0 auto;
    }

    .frm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .frm-header-titles {
        width: 100%;
    }

    .frm-header-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: var(--spacing-sm);
    }

    .frm-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .frm-btn {
        min-width: auto;
        width: 100%;
    }
}


/* شبکهٔ انتخاب روش */
/*کادر های انتخاب در ورود اطلاعات دفتر تلفن*/
.methods-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 576px) {
    .methods-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== گرید ۴ ستونه برای انتخاب روش ===== */
.methods-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* در تبلت (زیر ۹۰۰px) دو ستونه */
@media (max-width: 900px) {
    .methods-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* در موبایل (زیر ۵۷۶px) یک ستونه */
@media (max-width: 576px) {
    .methods-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* (اختیاری) اگر خواستی کارت‌ها کمی جمع‌وجورتر شوند */
.method-card.compact {
    padding: 20px 16px;
}

    .method-card.compact .method-title {
        font-size: 0.9rem;
    }

    .method-card.compact .method-desc {
        font-size: 0.7rem;
    }

.method-card {
    background-color: var(--color-bg-tertiary, #f7fafb);
    border: 1px solid var(--color-border-secondary, #e6e6e6);
    border-radius: var(--radius-lg, 12px);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

    .method-card:hover {
        border-color: none; /*var(--color-active);*/
        box-shadow: var(--shadow-card);
        transform: translateY(-2px);
    }

    .method-card img {
        width: 100px;
        height: 100px;
        margin-bottom: 16px;
        object-fit: contain;
    }

    .method-card .method-title {
        font-weight: 700;
        font-size: 0.8rem;
        color: var(--color-text-primary);
        margin-bottom: 8px;
    }

    .method-card .method-desc {
        font-size: 0.6rem;
        color: var(--color-text-quaternary);
        line-height: 1.5;
    }




/* =============================================
   کلاس‌های فرم‌های مستقل (خارج از مودال)
   ============================================= */

/* چیدمان‌های کمکی برای تعداد ستون‌های مشخص */
.frm-grid-1 {
    grid-template-columns: 1fr;
}

.frm-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.frm-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.frm-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}


/* فاصلهٔ عمودی بیشتر بین ردیف‌ها */


/* ستون خالی (برای پر کردن جای خالی) */
.frm-form-placeholder {
    visibility: hidden; /* یا display:none اگر مشکلی ایجاد نمی‌کند */
}

/* کادر اصلی فرم (شبیه sg-container) */
.frm-form-card {
    background: var(--color-bg-secondary, #ffffff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-card, 0 8px 20px -6px rgba(0, 10, 30, 0.06));
    padding: var(--spacing-xl) var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

/* شبکهٔ فیلدها */
.frm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: 20px !important;
}

/* هر گروه فیلد (لیبل + ورودی) */
.frm-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

    .frm-form-group label {
        font-weight: 500;
        color: var(--color-text-primary);
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    /* استایل ورودی‌ها (کاملاً مشابه sg-search) */
    .frm-form-group input,
    .frm-form-group select,
    .frm-form-group textarea,
    .frm-input {
        background-color: var(--color-bg-quaternary, #f0f3f7);
        border: 1px solid var(--color-border-primary, #d7dde4);
        border-radius: 12px;
        padding: 10px 14px;
        color: var(--color-text-primary);
        font-family: inherit;
        font-size: 0.95rem;
        transition: border-color 0.2s;
        outline: none;
        width: 100%;
        box-sizing: border-box;
    }

        /* فوکوس: فقط تغییر رنگ حاشیه – بدون سایه */
        .frm-form-group input:focus,
        .frm-form-group select:focus,
        .frm-form-group textarea:focus {
            border-color: var(--color-border-primary, #d7dde4);
            box-shadow: none !important;
            outline: none !important;
        }

    /* حالت خطا */
    .frm-form-group .input-validation-error {
        border-color: var(--form-input-error-color, #ffc1b2) !important;
    }

    .frm-form-group select,
    .frm-form-group select option {
        font-family: var(--font-family, 'Vazirmatn FD', Tahoma);
    }

select option {
    font-family: 'Vazirmatn FD', Tahoma !important;
}

/* پیغام خطا (دقیقاً مانند مودال) */
.frm-form-group .field-validation-error {
    color: var(--form-text-error-color, #f02e00);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

/* جای‌گذاری دکمهٔ تأیید */
.frm-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    gap: var(--spacing-md);
}

.frm-btn, a.frm-btn {
    text-decoration: none;
}

.frm-ltr {
    direction: ltr;
    text-align: left;
}

.frm-date-wrapper {
    position: relative;
    display: block; /* flex نباشد تا خطا در خط بعدی بیاید */
    line-height: 0;
}

.frm-date-input {
    width: 100%;
    padding-right: 2.5rem; /* فضا برای آیکون */
    line-height: normal;
}

.frm-date-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-icon, #999);
    pointer-events: none;
    font-size: 1.2rem;
    z-index: 1;
    /* حذف هرگونه transition یا top پویا */
}

/* wrapper اسپینر */
.frm-spinner-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px 20px;
    color: var(--color-text-quaternary);
    font-size: 0.9rem;
}


/*رویدادها*/
.frm-form-section-title {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-secondary);
    padding-bottom: 0.5rem;
}

.frm-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.frm-event-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-bg-quaternary);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
}

    .frm-event-item .event-info {
        display: flex;
        gap: 20px;
        flex: 1;
    }

    .frm-event-item .event-remove {
        color: #dc3545;
        cursor: pointer;
        font-size: 1.2rem;
    }

        .frm-event-item .event-remove:hover {
            color: #a71d2a;
        }


#eventDateWrapper {
    position: relative;
    display: block;
}

#eventDateError {
    position: absolute;
    bottom: -1.3rem;
    left: 0;
    right: 0;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--form-text-error-color, #f02e00);
    z-index: 2;
    pointer-events: none;
}

#eventDate.input-validation-error {
    border-color: var(--form-input-error-color, #ffc1b2) !important;
}

/*فرم های ارسال ساده*/
.progress-steps {
    display: flex;
    align-items: center; /* وسط‌چین عمودی */
    justify-content: center;
    margin-bottom: 2.5rem;
    padding: 0 1rem; /* کمی padding برای صفحه */
}

.progress-line {
    flex: 1;
    height: 2px;
    background: #d0d0d0;
    margin: 0; /* هیچ margin اضافه */
    align-self: center; /* دقیقاً وسط */
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #aaa;
    font-size: 0.8rem;
    margin: 0; /* حذف margin */
    padding: 0; /* حذف padding */
    background: var(--color-bg-primary);
}

    .step .circle {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 2px solid #aaa;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        background: var(--color-bg-primary);
        color: #333;
        margin-bottom: 6px;
        z-index: 1; /* روی خط قرار گیرد */
    }

    .step.active .circle {
        border-color: var(--color-active);
        background: var(--color-active);
        color: #fff;
    }

    .step.active {
        color: var(--color-active);
    }

@media (max-width: 576px) {
    .progress-steps .step span {
        display: none; /* فقط دایره‌ها بمانند */
    }

    .message-composer {
        flex-direction: column; /* پیش‌نویس‌ها به زیر متن بیایند */
    }

    .template-sidebar {
        margin-top: var(--spacing-md);
    }
}

.info-box {
    background-color: var(--alert-blue-bg);
    border-color: var(--alert-blue-bg);
    border-radius: 14px;
    padding: 0.8rem;
    margin: 1rem 0;
    color: var(--alert-blue-color);
    font-size: 0.85rem;
    display: flex;
    text-align: right;
    align-items: flex-start;
  
}

.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: var(--spacing-sm);
}

.template-search {
    position: relative;
    margin-top: 20px;
}

.template-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
   /* background: var(--color-bg-secondary);*/
    border: none;
    border-radius: 8px;
    margin-top: 4px;
}

    .template-list li {
        padding: 8px;
        cursor: pointer;
    }

        .template-list li:hover {
            background: none;
        }

.char-counter {
    font-size: 0.85rem;
    margin-top: 4px;
}

.summary-box {
    background: var(--color-bg-tertiary);
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.frm-link-btn {
    background: none;
    border: none;
    font-family: inherit;
    color: var(--color-active);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ===== کارت‌های سفید ===== */
/*.frm-white-card {
    background: #fff;
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}*/
/*.frm-white-card {
    background: var(--color-bg-secondary, #ffffff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}*/

.frm-white-card  {
    background-color: var(--color-bg-tertiary, #f7fafb);
    border: 1px solid var(--color-border-secondary, #e6e6e6);
    border-radius: var(--radius-lg, 12px);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);

    }
/* ===== بخش متن پیامکی دو بخشی ===== */
.message-composer {
    display: flex;
    gap: var(--spacing-lg);
    align-items: stretch;
}

.message-text-area {
    flex: 1.5;
    flex-direction: column;
}

.template-sidebar {
    flex: 1;
      background-color: var(--color-bg-tertiary, #f7fafb);
      border: 1px solid var(--color-border-secondary, #e6e6e6);
      border-radius: var(--radius-lg, 12px);
     
      margin-bottom: var(--spacing-lg);

   
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
    flex-direction: column;
    min-height: 100%; /* همان ارتفاع ستون مقابل */
}

    .template-sidebar .info-box {
        margin-bottom: var(--spacing-md);
    }

.template-list {
    flex: 1; /* پر کردن فضای باقی‌مانده */
    overflow-y: auto;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.template-editor-row {
    align-items: stretch; /* ارتفاع ستون‌ها برابر شود */
}

    .template-editor-row .frm-form-group:first-child {
        display: flex;
        flex-direction: column;
    }

    .template-editor-row textarea {
        flex: 1; /* textarea تمام فضای عمودی را پر کند */
        min-height: 180px;
    }

.template-personalize {
    background: var(--color-bg-tertiary, #f7fafb);
    border: 1px solid var(--color-border-secondary, #e6e6e6);
    border-radius: var(--radius-lg, 12px);
    padding: var(--spacing-lg);
}

    .template-personalize .template-tags {
        margin-top: auto; /* تگ‌ها را پایین کادر بچسباند */
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

.badge-tag {
    background-color: var(--color-active, #1976D2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    user-select: none;
    white-space: nowrap;
}

    .badge-tag:hover {
        background-color: #1565c0;
    }

.frm-nightly-alert {
    background-color: #fff3e0; /* نارنجی بسیار روشن */
    border: 1px solid #ff9800; /* حاشیه نارنجی */
    border-radius: var(--radius-md, 8px);
    padding: var(--spacing-md, 12px) var(--spacing-lg, 16px);
    color: #e65100; /* متن نارنجی تیره */
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm, 8px);
    line-height: 1.6;
    margin-bottom: 1rem;
}

    .frm-nightly-alert i {
        color: #ff9800;
        font-size: 1.2rem;
        flex-shrink: 0;
    }

/* استایل چک‌باکس سفارشی */
/*انتهای فایل اضافه شده اینجا نیازی نیست*/
/*.group-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border-primary);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .group-checkbox input[type="checkbox"]:checked {
        background-color: var(--color-active);
        border-color: var(--color-active);
    }

        .group-checkbox input[type="checkbox"]:checked::after {
            content: '';
            position: absolute;
            left: 5px;
            top: 2px;
            width: 5px;
            height: 9px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }*/

.group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-secondary);
    cursor: pointer;
    user-select: none;
}

    .group-checkbox .group-name {
        flex: 1;
        cursor: pointer;
    }

    .group-checkbox .group-count {
        color: var(--color-text-quaternary);
        font-size: 0.8rem;
    }

/* حالت indeterminate برای چک‌باکس */
.group-check:indeterminate {
    background-color: var(--color-active);
    border-color: var(--color-active);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cline x1='4' y1='8' x2='12' y2='8' stroke='white' stroke-width='2' stroke-linecap='round' /%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
}

@media (max-width: 768px) {
    .frm-form-grid.frm-grid-2 {
        grid-template-columns: 1fr; /* ستون‌ها زیر هم */
    }

    .group-checkbox .group-name {
        font-size: 0.9rem;
    }
}

.group-count.badge {
    background-color: var(--color-bg-quaternary);
    color: var(--color-text-primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
}
/* ===== ریسپانسیو فرم انتخاب گروه و مخاطب ===== */
@media (max-width: 768px) {
    /* واگردانی چیدمان به حالت عمودی */
    .group-contact-layout {
        grid-template-columns: 1fr !important;
    }

        /* محدود کردن ارتفاع کادر گروه‌ها در موبایل */
        .group-contact-layout .group-panel {
            max-height: 200px;
            overflow-y: auto;
        }
}
/*ردیف گروه انتخاب شده*/
.group-checkbox.active {
    background-color: var(--color-hover, #e9ecf2);
    border-radius: var(--radius-sm);
    padding-left: 8px;
    padding-right: 8px;
    transition: background-color 0.2s;
}

.frm-btn-disabled {
    opacity: 0.55;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== تب‌های گزارش ===== */

.report-tabs-container {
    min-height: 500px; /* جلوگیری از جابه‌جایی هدر */
}

.report-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--color-border-secondary);
    padding-bottom: var(--spacing-sm);
    /* جلوگیری از سرایت flex به بیرون */
    contain: layout style;
}

.report-tab {
    background: none;
    border: none;
    padding: 8px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-quaternary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
    outline: none;
    /* حذف هرگونه margin/padding اضافی */
    margin: 0;
    white-space: nowrap;
}

    .report-tab:hover {
        color: var(--color-active);
    }

    .report-tab.active {
        color: var(--color-active);
        border-bottom-color: var(--color-active);
    }

/* محتوای تب‌ها */
.report-tab-content {
    display: none;
    animation: frmFadeIn 0.2s ease;
    /* اطمینان از عدم تأثیر بر layout */
    contain: layout style;
}

    .report-tab-content.active {
        display: block;
    }

@keyframes frmFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/*آمار گزارش ارسال ساده*/
.frm-stats-grid {
    display: grid;
    grid-template-columns: auto 1fr; /* ستون اول: پهنای خودکار (بزرگترین عنوان)، ستون دوم: باقیمانده */
    gap: 10px; /* فاصله ۱۰ پیکسلی بین عنوان و مقدار */
    align-items: center;
}

.frm-stat-row {
    display: contents; /* label و value مستقیماً در grid قرار می‌گیرند */
}

.frm-stat-label {
    text-align: right; /* متن عنوان به راست چین شود */
    padding: 10px 0;
    color: var(--color-text-quaternary);
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-border-secondary); /* خط جداکننده */
    display: inline-block; /* یا block، برای اینکه min-width روی آن اثر کند */
}

/* مقدارها (سمت چپ) */
.frm-stat-value {
    text-align: right; /* متن مقدار به چپ چین شود (از راست شروع شود؟ نه، از چپ شروع می‌شود ولی چون ستون دوم 1fr است، مقدارها از یک نقطه ثابت شروع می‌شوند) */
    padding: 10px 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-secondary);
}

textarea.frm-textarea-expand {
    min-height: 80px;
    max-height: 300px; /* به جای auto */
    overflow-y: auto; /* به جای hidden */
    resize: vertical;
    width: 100%;
}


/* --- نسخه ضد ضربه رادیو و چک‌باکس --- */
input[type="radio"],
input[type="checkbox"] {
    all: unset; /* پاک کردن تمام استایل‌های پیش‌فرض مرورگر و فریم‌ورک‌ها */
    box-sizing: border-box;
    width: 1.5rem !important;
    height: 1.5rem !important;
    min-width: 1.5rem !important;
    max-width: 1.5rem !important;
    min-height: 1.5rem !important;
    max-height: 1.5rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    cursor: pointer;
    background: #dfe2e8;
    border: 1px solid #dfe2e8;
    transition: all 0.2s ease-in-out;
}

/* چک‌باکس */
input[type="checkbox"] {
    border-radius: 7px !important;
}

/* رادیو (تضمین دایره) */
input[type="radio"] {
    border-radius: 50% !important;
}

    /* حالت انتخاب شده */
    input[type="radio"]:checked,
    input[type="checkbox"]:checked {
        background-color: #5d86ff !important;
        border-color: #5d86ff !important;
    }

        /* علامت تیک برای چک‌باکس */
        input[type="checkbox"]:checked::after {
            content: "✓" !important;
            color: white !important;
            font-size: 1rem !important;
            font-weight: bold !important;
        }

        /* دایره سفید وسط رادیو (با سایز فیکس) */
        input[type="radio"]:checked::after {
            content: "" !important;
            display: block !important;
            width: 0.6rem !important;
            height: 0.6rem !important;
            min-width: 0.6rem !important;
            min-height: 0.6rem !important;
            background-color: white !important;
            border-radius: 50% !important;
        }

/* تراز کردن متن کنار رادیو در گروه */
.radio-group label {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 5px;
    cursor: pointer;
}

/* استایل مخصوص گرید */
.sg-row-select,
.sg-select-all {
    width: 1.5rem !important;
    height: 1.5rem !important;
}

/* =============================================
   مودال نمایش جزئیات گزارش ارسال
   فقط برای همین مودال و بدون تداخل
   ============================================= */

.sms-report-details-modal .detail-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
}

.sms-report-details-modal .detail-label {
    min-width: 120px;
    font-weight: 600;
    color: var(--color-text-tertiary, #666);
    white-space: nowrap;
}

.sms-report-details-modal .detail-value {
    flex: 1;
    color: var(--color-text-primary, #222);
    text-align: left;
    word-break: break-word;
}

.sms-report-details-modal .detail-label-full {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-text-primary, #222);
}

.sms-report-details-modal .message-text-full {
    background: var(--color-bg-quaternary, #f7f7f7);
    border: 1px solid var(--color-border-primary, #ddd);
    color: var(--color-text-primary, #222);
    border-radius: 10px;
    padding: 12px 14px;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 12px;
}

.sms-report-details-modal .light-hr {
    border: none;
    border-top: 1px solid var(--color-border-primary, #e5e5e5);
    margin: 0;
}

[data-theme="dark"] .sms-report-details-modal .detail-label-full {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .sms-report-details-modal .detail-label {
    color: var(--color-text-tertiary);
}

[data-theme="dark"] .sms-report-details-modal .detail-value {
    color: var(--color-text-primary);
}

[data-theme="dark"] .sms-report-details-modal .message-text-full {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-secondary);
    color: var(--color-text-primary);
}

[data-theme="dark"] .sms-report-details-modal .light-hr {
    border-top-color: var(--color-border-primary);
}


.frm-dropdown {
    position: relative;
    display: inline-block;
}

.frm-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-primary, #f9fbfd);
    border: 1px solid var(--color-border-primary, #f9fbfd);
    font-size: 13px;
    color: var(--color-text-primary, #1f3a4e);
    border-radius: 12px;
    padding: 12px 0;
    min-width: 180px;
    z-index: 1000;
}

.frm-dropdown-item {
    padding: 10px 18px;
    align-items: center; /* اصلاح از self-start برای تراز صحیح */
    display: flex;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text-primary,#1f34e);
    cursor: pointer;
    gap: 8px;
    white-space: nowrap;
    transition: background .15s;
    font-size: 13px;
}

    .frm-dropdown-item i {
        font-size: 16px;
        display: inline-flex;
        align-items: center;
    }

    .frm-dropdown-item:hover {
        background: var(--color-hover, #ecf1f7);
        border-radius: 12px;
    }


            /* استایل مخصوص مودال جزئیات */
        .detail-row {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 20px;
            margin: 8px 0;
        }

        .detail-label {
            font-weight: 600;
            color: #555;
            width: 35%;
            text-align: right;
        }

        .detail-value {
            width: 65%;
            text-align: left;
            color: #333;
        }
        /* عنوان متن پیام در یک ردیف کامل */
        .detail-label-full {
            font-weight: 600;
            color: #555;
            margin: 8px 0 5px 0;
            text-align: right;
        }
        /* نمایش متن پیام در یک div با شکستن خودکار خطوط و بدون اسکرول */
        .message-text-full {
            background-color: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 8px;
            margin-bottom: 5px;
            white-space: pre-wrap; /* شکستن خطوط */
            word-wrap: break-word; /* کلمات بلند را شکسته */
            overflow: auto; /* در صورت نیاز بسیار طولانی اسکرول دهد (اما به ندرت) */
            max-height: 300px; /* حداکثر ارتفاع اختیاری (در صورت خیلی طولانی) */
            font-family: inherit;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        hr.light-hr {
            border: none;
            border-top: 1px solid #e0e0e0;
            margin: 10px 0;
        }

      

        .frm-textarea {
            width: 100%;
            background: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 8px;
            font-family: inherit;
            resize: vertical;
        }

         .active-filters-container {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 12px 0 0 0;
    }

    .filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: transparent;
        border: 1px solid #90caf9;
        color: #0b5e8a;
        padding: 4px 12px;
        border-radius: 30px;
        font-size: 0.8rem;
        font-weight: 500;
        direction: rtl;
    }

        .filter-chip .remove-filter {
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: bold;
            color: #1976d2;
            background: none;
            border: none;
            line-height: 1;
            padding: 0 4px;
        }

            .filter-chip .remove-filter:hover {
                color: #d32f2f;
            }

    .date-chip {
        border-color: #42a5f5;
        background: transparent;
    }

    .jdp-container, .jdp-overlay {
        z-index: 10000 !important;
    }