/* ===== منتقل‌شده از CSS اسکوپ‌شده‌ی Blazor: SiteSettingsAdmin.razor.css =====
   اکنون سراسری است؛ برای حفظ همان اولویت قبلی (specificity) انتخاب‌گرها ایمن‌سازی شده‌اند. */
/* ============================================================
   تنظیمات سایت — هماهنگ با بقیه‌ی صفحات پنل (کارت شیشه‌ای، رنگ‌های --primary / --accent، دکمه‌ها و فیلدهای مشترک)
   همه‌ی جهت‌ها منطقی (inline) هستند تا در حالت RTL و LTR درست دیده شوند.
   ============================================================ */

.settings-page.settings-page {
    max-width: 880px;
    margin-inline: auto;
}

/* کارت اصلی: همان ظاهر crud-card، بدون بالا پریدنِ hover (فرم است نه جدول) */
.settings-shell.crud-card.crud-card,
.settings-shell.crud-card.crud-card:hover {
    transform: none;
    overflow: visible;
}

/* ---------- تب‌ها ---------- */
.settings-tabs.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(245, 243, 255, .55);
    border-start-start-radius: var(--radius);
    border-start-end-radius: var(--radius);
}

.settings-tab.settings-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast);
}

    .settings-tab.settings-tab svg {
        width: 18px;
        height: 18px;
        flex: none;
    }

    .settings-tab.settings-tab:hover {
        background: var(--primary-light);
        color: var(--primary-dark);
    }

    .settings-tab.settings-tab:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .settings-tab.is-active.is-active {
        background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
        color: #fff;
        box-shadow: 0 4px 14px rgba(99, 102, 241, .35);
    }

.settings-tab-dot.settings-tab-dot {
    min-width: 20px;
    height: 20px;
    padding-inline: 6px;
    border-radius: 999px;
    background: var(--warning);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

/* ---------- پنل ---------- */
.settings-panel.settings-panel {
    padding: 22px 26px 8px;
    animation: settingsFade .25s ease;
}

@keyframes settingsFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-desc.settings-desc {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 2;
}

.settings-row.settings-row {
    display: grid;
    grid-template-columns: minmax(180px, 250px) 1fr;
    gap: 8px 22px;
    align-items: start;
    padding: 14px 12px;
    margin-inline: -12px;
    border-radius: 12px;
    border-bottom: 1px dashed var(--border);
    transition: background var(--transition-base);
}

    .settings-row.settings-row:last-of-type {
        border-bottom: none;
    }

    .settings-row.is-dirty.is-dirty {
        background: rgba(245, 158, 11, .08);
    }

.settings-label.settings-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 9px;
}

    .settings-label.settings-label label {
        font-size: 14px;
        font-weight: 700;
        color: var(--text);
    }

    .settings-label.settings-label small {
        font-size: 12px;
        line-height: 1.8;
        color: var(--text-muted);
    }

.settings-control.settings-control {
    min-width: 0;
}

.settings-error.settings-error {
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--danger);
}

.settings-control .form-control.invalid.invalid,
.settings-control .form-control.invalid.invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-light);
}

/* ---------- رنگ ---------- */
.color-field.color-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker.color-picker {
    flex: none;
    width: 52px;
    height: 42px;
    padding: 3px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

    .color-picker.color-picker:hover {
        border-color: var(--accent-light);
    }

.color-hex.color-hex {
    max-width: 150px;
    font-family: var(--font-main);
    text-transform: lowercase;
}

.btn-reset.btn-reset {
    flex: none;
    padding: 10px 12px;
}

    .btn-reset.btn-reset svg {
        width: 16px;
        height: 16px;
    }

    .btn-reset.btn-reset:disabled {
        opacity: .45;
        cursor: default;
        transform: none;
    }

/* ---------- کلید روشن/خاموش ---------- */
.switch.switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
    cursor: pointer;
    user-select: none;
}

    .switch.switch input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

.switch-track.switch-track {
    position: relative;
    width: 48px;
    height: 26px;
    border-radius: 999px;
    background: #d1d5db;
    transition: background var(--transition-base);
}

.switch-thumb.switch-thumb {
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
    transition: inset-inline-start var(--transition-base);
}

.switch input:checked + .switch-track.switch-track {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

    .switch input:checked + .switch-track .switch-thumb.switch-thumb {
        inset-inline-start: 25px;
    }

.switch input:focus-visible + .switch-track.switch-track {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.switch-text.switch-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}

/* ---------- رمز / مقدار محرمانه ---------- */
.secret-state.secret-state {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.link-btn.link-btn {
    padding: 0;
    border: none;
    background: none;
    color: var(--primary-dark);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

    .link-btn.danger.danger {
        color: var(--danger);
    }

/* ---------- پیش‌نمایش تم ---------- */
.theme-preview.theme-preview {
    margin: 18px 0 14px;
    border: 1.5px dashed var(--accent-light);
    border-radius: 14px;
    overflow: hidden;
}

.theme-preview-caption.theme-preview-caption {
    display: block;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--bg-soft);
}

.theme-preview-surface.theme-preview-surface {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background-color: var(--pv-bg, #f8f7fc);
    transition: background-color var(--transition-base);
}

.theme-preview-btn.theme-preview-btn {
    pointer-events: none;
}

/* ---------- ایمیل آزمایشی ---------- */
.smtp-test.smtp-test {
    margin: 18px 0 14px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-soft);
}

    .smtp-test.smtp-test h5 {
        margin: 0 0 4px;
        font-size: 15px;
        color: var(--primary-dark);
    }

    .smtp-test.smtp-test p {
        margin: 0 0 12px;
        font-size: 12.5px;
        line-height: 1.9;
        color: var(--text-muted);
    }

.smtp-test-row.smtp-test-row {
    display: flex;
    gap: 10px;
}

    .smtp-test-row .form-control.form-control {
        flex: 1;
        min-width: 0;
        background: #fff;
    }

.smtp-test-hint.smtp-test-hint {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #92400e;
}

.smtp-test-result.smtp-test-result {
    margin-top: 10px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

    .smtp-test-result.is-ok.is-ok {
        background: #dcfce7;
        color: #166534;
    }

    .smtp-test-result.is-error.is-error {
        background: var(--danger-light);
        color: #b91c1c;
    }

/* ---------- نوار ذخیره ---------- */
.settings-savebar.settings-savebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    padding: 16px 26px;
    border-top: 1px solid var(--border);
    background: rgba(245, 243, 255, .55);
    border-end-start-radius: var(--radius);
    border-end-end-radius: var(--radius);
}

.savebar-state.savebar-state {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

    .savebar-state.has-changes.has-changes {
        color: #b45309;
    }

.savebar-actions.savebar-actions {
    display: flex;
    gap: 10px;
}

    .savebar-actions .btn.btn:disabled {
        opacity: .5;
        cursor: default;
        transform: none;
        box-shadow: none;
    }

/* ---------- موبایل ---------- */
@media (max-width: 680px) {
    .settings-panel.settings-panel {
        padding-inline: 16px;
    }

    .settings-row.settings-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .settings-label.settings-label {
        padding-top: 0;
    }

    .settings-tabs.settings-tabs {
        padding: 10px 12px;
    }

    .settings-tab.settings-tab {
        flex: 1 1 auto;
        justify-content: center;
        padding: 9px 12px;
    }

    .smtp-test-row.smtp-test-row {
        flex-direction: column;
    }

    .settings-savebar.settings-savebar {
        padding-inline: 16px;
    }

    .savebar-actions.savebar-actions {
        width: 100%;
    }

        .savebar-actions .btn.btn {
            flex: 1;
        }
}

@media (prefers-reduced-motion: reduce) {
    .settings-panel.settings-panel {
        animation: none;
    }
}

/* ---------- سرتیتر بخش‌ها (رنگ‌ها / فوتر) ---------- */
.settings-section.settings-section {
    margin: 22px 0 4px;
    padding: 8px 14px;
    border-inline-start: 4px solid var(--accent);
    border-radius: 8px;
    background: var(--bg-soft);
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-dark);
}

    .settings-section.settings-section:first-of-type {
        margin-top: 4px;
    }

.settings-control textarea.form-control.form-control {
    min-height: 84px;
    resize: vertical;
    line-height: 1.9;
}

/* ---------- پیش‌نمایش منو و فوتر ---------- */
.theme-preview-surface.theme-preview-surface {
    flex-direction: column;
    gap: 18px;
}

.pv-nav.pv-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    width: 100%;
    padding: 8px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--pv-nav-bg, #fff) 65%, transparent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
}

.pv-nav-item.pv-nav-item {
    font-size: 13px;
    font-weight: 600;
    color: var(--pv-nav-text, #000);
}

.pv-site-btn.pv-site-btn {
    margin-inline-start: auto;
    padding: 5px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pv-p, #6366f1), var(--pv-a, #8b5cf6));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.pv-footer.pv-footer {
    overflow: hidden;
    border-radius: 0 0 12px 12px;
}

.pv-footer-dark.pv-footer-dark {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 18px 22px;
    background: linear-gradient(180deg, var(--ft-top, #0d0d0d), var(--ft-bottom, #222));
    color: var(--ft-text, #d1d5db);
    font-size: 12px;
}

    .pv-footer-dark.pv-footer-dark b {
        color: var(--ft-heading, #fff);
        font-size: 13px;
    }

.pv-footer-blue.pv-footer-blue {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 18px 0 14px;
    background: linear-gradient(180deg, var(--ft-wave-top, #2561bb), var(--ft-wave-bottom, #317ff6));
    border-top-left-radius: 50% 14px;
    border-top-right-radius: 50% 14px;
    margin-top: -12px;
}

.pv-dot.pv-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ft-icon, #fff) 18%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--ft-icon, #fff) 45%, transparent);
}

/* ---------- لوگوی گزارش ---------- */
.logo-field.logo-field {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
}

.logo-field-preview.logo-field-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 150px;
    height: 100px;
    padding: 8px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    /* شطرنجی ملایم تا شفافیت لوگو دیده شود */
    background:
        conic-gradient(#f3f4f6 25%, #fff 0 50%, #f3f4f6 0 75%, #fff 0) 0 0 / 16px 16px;
}

    .logo-field-preview.is-empty.is-empty {
        border-style: dashed;
        color: var(--text-muted);
        font-size: 12px;
        text-align: center;
    }

    .logo-field-preview.logo-field-preview img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.logo-field-actions.logo-field-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex: 1 1 220px;
    min-width: 0;
}

    .logo-field-actions .form-control.form-control {
        width: 100%;
    }

.logo-field-meta.logo-field-meta {
    color: var(--text-muted);
    word-break: break-all;
}

    .logo-field-meta.too-large.too-large {
        color: var(--danger);
        font-weight: 700;
    }

/* ---------- پیش‌نمایش سربرگ گزارش ---------- */
.report-preview.report-preview {
    margin: 18px 0 14px;
    border: 1.5px dashed var(--accent-light);
    border-radius: 14px;
    overflow: hidden;
}

.report-preview-sheet.report-preview-sheet {
    margin: 14px;
    padding: 14px 16px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}

.rp-head.rp-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rp-logo.rp-logo {
    flex: 0 0 auto;
    width: 56px;
    height: 48px;
    object-fit: contain;
}

.rp-name.rp-name {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
}

    .rp-name.rp-name b {
        font-size: 15px;
        color: var(--rp-brand, #154c79);
    }

    .rp-name.rp-name span {
        font-size: 12px;
        color: var(--text-muted);
    }

.rp-meta.rp-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--rp-brand, #154c79) 10%, #fff);
    font-size: 11px;
}

    .rp-meta.rp-meta small {
        color: var(--text-muted);
    }

    .rp-meta.rp-meta b {
        color: var(--rp-brand, #154c79);
        white-space: nowrap;
    }

.rp-bar.rp-bar {
    height: 2px;
    margin: 12px 0 10px;
    background: var(--rp-brand, #154c79);
}

.rp-table.rp-table {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

    .rp-table.rp-table span {
        height: 14px;
        border-radius: 3px;
        background: var(--rp-brand, #154c79);
        opacity: .85;
    }

.rp-note.rp-note {
    display: block;
    padding: 0 14px 12px;
    color: var(--text-muted);
}
