/* =====================================================================
   ویرایشگر متن غنی (RichTextEditor) + نمایش توضیحات غنی (RichContent)
   این فایل بعد از Article.css بارگذاری می‌شود و استایل‌های پایه‌ی .rte آن را کامل می‌کند.
   ===================================================================== */

/* ---------- ویرایشگر (RadzenHtmlEditor + پنل CSS) ---------- */
.rte-wrap {
    width: 100%;
}

.rte-wrap[data-invalid="1"] .rte-radzen {
    border-color: var(--danger);
}

.rte-radzen {
    width: 100%;
}

/* پنل CSS */
.rte-cssbox {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px 10px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.rte-csshint {
    margin-bottom: 6px;
    font-size: 12px;
    color: #6b7280;
}

.rte-csstext {
    display: block;
    width: 100%;
    min-height: 110px;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font-family: var(--font-main);
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    direction: ltr;
    text-align: left;
}

.rte-csstext:focus {
    border-color: var(--primary);
}

.rte-counter.is-over {
    color: var(--danger);
    font-weight: 700;
}

/* ---------- نمایش توضیحات غنی ---------- */
.rich-content {
    overflow-wrap: anywhere;
    white-space: normal;
}

.rich-content > :first-child {
    margin-top: 0;
}

.rich-content > :last-child {
    margin-bottom: 0;
}

.rich-content p {
    margin: 0 0 .9em;
}

.rich-content h1,
.rich-content h2,
.rich-content h3,
.rich-content h4,
.rich-content h5,
.rich-content h6 {
    margin: 1.2em 0 .5em;
    line-height: 1.7;
    font-weight: 800;
    color: #1e1b4b;
}

.rich-content h1 { font-size: 1.8em; }
.rich-content h2 { font-size: 1.5em; }
.rich-content h3 { font-size: 1.25em; }
.rich-content h4 { font-size: 1.1em; }
.rich-content h5,
.rich-content h6 { font-size: 1em; }

.rich-content ul,
.rich-content ol {
    margin: 0 0 .9em;
    padding-inline-start: 1.6em;
}

.rich-content li {
    margin: .2em 0;
}

.rich-content a {
    color: #4f46e5;
    text-decoration: underline;
}

.rich-content blockquote {
    margin: 1em 0;
    padding: 8px 16px;
    border-inline-start: 4px solid var(--color-primary, #6366f1);
    border-radius: 6px;
    background: #f5f3ff;
}

.rich-content pre {
    direction: ltr;
    text-align: left;
    margin: 1em 0;
    padding: 12px 14px;
    overflow: auto;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre;
}

.rich-content code {
    font-family: var(--font-main);
}

.rich-content img,
.rich-content video,
.rich-content svg {
    max-width: 100%;
    height: auto;
}

.rich-content img {
    border-radius: 10px;
}

.rich-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.rich-content th,
.rich-content td {
    padding: 6px 10px;
}

.rich-content hr {
    margin: 1.2em 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

/* کارت‌های کوتاه (کارت مقاله، محصول، دسته‌بندی): فشرده و بدون فاصله‌ی اضافه */
.rich-content--compact p,
.rich-content--compact ul,
.rich-content--compact ol,
.rich-content--compact blockquote,
.rich-content--compact pre,
.rich-content--compact hr {
    margin: 0;
}

.rich-content--compact h1,
.rich-content--compact h2,
.rich-content--compact h3,
.rich-content--compact h4,
.rich-content--compact h5,
.rich-content--compact h6 {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    color: inherit;
}

.rich-content--compact img {
    max-height: 120px;
    width: auto;
}

.rich-content--compact a {
    color: inherit;
    text-decoration: none;
}

/* پیش‌نمایش توضیح در مودال «مشاهده» پنل ادمین */
.rich-content-preview {
    max-height: 340px;
    padding: 12px 16px;
    overflow: auto;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 14.5px;
    line-height: 2;
}

/* ---------- فونت یکپارچه: حتی اگر محتوای ذخیره‌شده font-family اینلاین یا CSS اختصاصی داشته باشد ---------- */
.rich-content,
.rich-content *,
.rte-radzen,
.rte-radzen .rz-html-editor-content,
.rte-radzen .rz-html-editor-content *,
.rte-area,
.rte-area *,
.rte-source,
.rte-csstext {
    font-family: var(--font-main) !important;
}
