/* =====================================================================
   بخش مقالات: پنل ادمین (مودال عریض، ویرایشگر متن) + صفحات عمومی سایت
   ===================================================================== */

/* ---------- مودال عریض برای فرم مقاله ---------- */
.modal-box.modal-xl {
    max-width: 960px;
}

/* ---------- ویرایشگر متن غنی ---------- */
.rte {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
    overflow: hidden;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.rte:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

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

.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.rte-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.rte-btn:hover {
    background: var(--primary-light);
    border-color: var(--border);
}

.rte-btn.active {
    background: var(--primary);
    color: #fff;
}

.rte-sep {
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: var(--border);
}

.rte-area,
.rte-source {
    display: block;
    width: 100%;
    min-height: 240px;
    max-height: 420px;
    overflow-y: auto;
    padding: 14px 16px;
    box-sizing: border-box;
    border: 0;
    outline: none;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 2;
}

.rte-source {
    resize: vertical;
    font-family: var(--font-main);
    font-size: 13px;
    line-height: 1.7;
}

.rte-area:empty::before {
    content: "";
}

/* ---------- محتوای مقاله (نمایش در ادمین و سایت) ---------- */
.article-body {
    font-size: 15px;
    line-height: 2.2;
    color: #374151;
    overflow-wrap: anywhere;
}

.article-body > :first-child {
    margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
    margin: 1.6em 0 .5em;
    line-height: 1.7;
    color: #1e1b4b;
    font-weight: 800;
}

.article-body h2 { font-size: 22px; }
.article-body h3 { font-size: 18.5px; }
.article-body h4 { font-size: 16px; }

.article-body p {
    margin: 0 0 1em;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1em;
    padding-inline-start: 1.6em;
}

.article-body blockquote {
    margin: 1.2em 0;
    padding: 10px 18px;
    border-inline-start: 4px solid var(--color-primary, #6366f1);
    border-radius: 6px;
    background: #f5f3ff;
    color: #4338ca;
}

.article-body img,
.article-body video {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

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

.article-body th,
.article-body td {
    border: 1px solid #e5e7eb;
    padding: 6px 10px;
}

.article-body a {
    color: var(--color-primary-dark, #4338ca);
    text-decoration: underline;
}

/* پیش‌نمایش داخل مودال ادمین */
.article-body-preview {
    max-height: 320px;
    overflow-y: auto;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

/* =====================================================================
   صفحات عمومی سایت (لیست مقالات و جزئیات مقاله)
   ===================================================================== */

/* ---------- سربرگ لیست + جستجو ---------- */
.app-shell .art-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px 28px;
    margin-bottom: 26px;
    padding: 26px 32px;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #f1efff 100%);
    border: 1px solid var(--color-border-light, #ddd6fe);
    box-shadow: 0 10px 30px rgba(99, 102, 241, .14);
}

.app-shell .art-hero-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    color: #1e1b4b;
}

.app-shell .art-hero-desc {
    margin: 6px 0 0;
    font-size: 14.5px;
    line-height: 2;
    color: #6b7280;
}

.app-shell .art-search {
    position: relative;
    flex: 1 1 280px;
    max-width: 420px;
}

.app-shell .art-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    padding-inline-end: 46px;
    border-radius: 14px;
    border: 1.5px solid var(--color-border-light, #ddd6fe);
    background: #fff;
    font-family: inherit;
    font-size: 14px;
    color: #1e1b4b;
    transition: border-color .2s, box-shadow .2s;
}

.app-shell .art-search input:focus {
    outline: none;
    border-color: var(--color-primary, #6366f1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

.app-shell .art-search svg {
    position: absolute;
    top: 50%;
    inset-inline-end: 14px;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: #a5a3c4;
    pointer-events: none;
}

/* ---------- کارت مقاله (بر پایه‌ی shop-card) ---------- */
.app-shell .art-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.app-shell .art-card .shop-card-media {
    aspect-ratio: 16 / 10;
}

.app-shell .art-card-desc {
    -webkit-line-clamp: 3;
}

.app-shell .art-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border-light, #ddd6fe);
    font-size: 12.5px;
}

.app-shell .art-card-date {
    color: #9ca3af;
}

.app-shell .art-card-more {
    font-weight: 700;
    color: var(--color-primary-dark, #4338ca);
}

/* ---------- صفحه‌ی جزئیات مقاله ---------- */
.app-shell .art-article {
    padding: 0;
}

.app-shell .art-article-cover {
    position: relative;
    aspect-ratio: 16 / 7;
    background: #eef0f6;
}

.app-shell .art-article-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-shell .art-article-head {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 26px 32px 6px;
}

.app-shell .art-article-title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.7;
    color: #1e1b4b;
    overflow-wrap: anywhere;
}

.app-shell .art-article-lead {
    padding: 14px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5f3ff, #eef2ff);
    border: 1px solid var(--color-border-light, #ddd6fe);
}

.app-shell .art-article-content {
    padding: 18px 32px 32px;
}

.app-shell .art-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px dashed var(--color-border-light, #ddd6fe);
}

.app-shell .art-keyword {
    cursor: default;
}

.app-shell .art-back {
    display: flex;
    justify-content: center;
}

/* ---------- ستون کناری: آخرین مقالات ---------- */
.app-shell .art-side-row {
    justify-content: flex-start;
}

.app-shell .art-side-thumb {
    flex: 0 0 auto;
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    background: #eef0f6;
}

.app-shell .art-side-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-shell .art-side-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.app-shell .art-side-date {
    font-size: 11.5px;
    color: #9ca3af;
}

/* ---------- بخش «آخرین مقالات» در صفحه‌ی اصلی ---------- */
.app-shell .art-home-section {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 16px 28px;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.app-shell .art-home-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.app-shell .art-home-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: #164a8a;
}

.app-shell .art-home-all {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary-dark, #4338ca);
}

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 640px) {
    .app-shell .art-hero {
        padding: 20px 18px;
    }

    .app-shell .art-hero-title {
        font-size: 23px;
    }

    .app-shell .art-article-head {
        padding: 20px 18px 4px;
    }

    .app-shell .art-article-content {
        padding: 14px 18px 24px;
    }

    .app-shell .art-article-title {
        font-size: 22px;
    }

    .app-shell .art-article-cover {
        aspect-ratio: 16 / 9;
    }

    .app-shell .art-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
