/* ═══════════════════════════════════════════════════════
   Message Templates — page-scoped stylesheet
   Root element carries .comm-page .mt-page
   ═══════════════════════════════════════════════════════ */

.mt-page {
    max-width: 1100px;
}

/* ── List card ──────────────────────────────────────── */
.mt-list-card {
    background: var(--comm-card, #fff);
    border: 1px solid var(--comm-border, #dde3ec);
    border-radius: var(--comm-radius, 10px);
    box-shadow: var(--comm-shadow, 0 2px 6px rgba(0,0,0,.08));
    overflow: hidden;
}

.mt-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--comm-border, #dde3ec);
    background: #fafafa;
    flex-wrap: wrap;
}

.mt-list-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mt-list-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--comm-primary, #334080) 10%, white);
    color: var(--comm-primary, #334080);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mt-list-icon .rzi {
    font-size: 1.25rem;
}

.mt-list-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--comm-text, #0f172a);
}

.mt-list-count {
    font-size: 0.8125rem;
    color: var(--comm-text-muted, #94a3b8);
}

/* ── Edit form card ─────────────────────────────────── */
.mt-edit-card {
    background: var(--comm-card, #fff);
    border: 1px solid var(--comm-border, #dde3ec);
    border-radius: var(--comm-radius, 10px);
    box-shadow: var(--comm-shadow, 0 2px 6px rgba(0,0,0,.08));
    overflow: hidden;
}

.mt-edit-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--comm-border, #dde3ec);
    background: #fafafa;
}

.mt-edit-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--comm-primary, #334080) 10%, white);
    color: var(--comm-primary, #334080);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mt-edit-icon .rzi {
    font-size: 1.25rem;
}

.mt-edit-header-text {
    flex: 1;
    min-width: 0;
}

.mt-edit-header-text h2 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--comm-text, #0f172a);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mt-edit-header-text p {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    color: var(--comm-text-secondary, #64748b) !important;
}

.mt-edit-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Editor label ───────────────────────────────────── */
.mt-body-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--comm-text, #0f172a);
    margin-bottom: 0.375rem;
    display: block;
}

/* ── Editor form footer ─────────────────────────────── */
.mt-edit-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--comm-border, #dde3ec);
    background: #fafafa;
    flex-wrap: wrap;
}

/* ── Radzen input rounding inside mt-page ───────────── */
.mt-page .rz-textbox,
.mt-page .rz-textarea,
.mt-page .rz-dropdown,
.mt-page .rz-password input,
.mt-page .rz-numeric input {
    border-radius: var(--comm-radius-sm, 6px) !important;
}

/* ── DataGrid inside mt-list-card: remove double border  */
.mt-list-card .rz-datatable {
    border: none !important;
    border-radius: 0 !important;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
    .mt-list-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.875rem 1rem;
    }

    .mt-edit-header {
        padding: 0.875rem 1rem;
    }

    .mt-edit-body {
        padding: 1rem;
    }

    .mt-edit-footer {
        padding: 0.875rem 1rem;
        flex-direction: column-reverse;
    }

    .mt-edit-footer > * {
        width: 100%;
    }
}

/* ── Email editor wrapper ───────────────────────────── */
.mt-email-editor-wrap {
    border: 1px solid var(--comm-border, #dde3ec);
    border-radius: 8px;
    overflow: hidden;
    min-height: 560px;
    margin-top: 0.5rem;
}

/* ── Legacy body preview (no JsonDesign) ────────────── */
.mt-legacy-body-preview {
    border: 1px solid var(--comm-border, #dde3ec);
    border-radius: 8px;
    padding: 1.25rem;
    background: #f8fafc;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

/* ── SMS editor wrapper ─────────────────────────────── */
.mt-sms-editor-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
