/*
 * Shared presentation for content authored by TinyMCE.
 * Loaded both inside the editor iframe and by the public/admin layouts.
 */
img,
.img-fluid,
.mce-content-body img,
figure.image,
figure.image img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

.tiny-content-image--center {
    display: block;
    margin-inline: auto;
}

.tiny-content-image--start {
    float: right;
    max-width: 50% !important;
    margin: 0 0 1rem 1rem;
}

.tiny-content-image--end {
    float: left;
    max-width: 50% !important;
    margin: 0 1rem 1rem 0;
}

.tiny-content-image--full {
    display: block;
    width: 100% !important;
}

@media (max-width: 767.98px) {
    .tiny-content-image--start,
    .tiny-content-image--end {
        float: none;
        display: block;
        width: auto !important;
        max-width: 100% !important;
        margin: 0 auto 1rem;
    }
}

.tiny-content-video {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border-radius: 10px;
}

.tiny-content-file {
    overflow-wrap: anywhere;
}

/* Shared tables authored by TinyMCE. */
.tiny-editor-table {
    width: 100%;
    margin: 1.25rem 0;
    border: 1px solid #d7dde5;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    background: #fff;
    color: #273142;
    font-size: .95rem;
    line-height: 1.65;
    text-align: start;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
}

.tiny-editor-table caption {
    padding: .7rem 1rem;
    color: #526071;
    font-size: .875rem;
    font-weight: 600;
    text-align: start;
    caption-side: top;
}

.tiny-editor-table th,
.tiny-editor-table td {
    min-width: 7rem;
    padding: .8rem 1rem;
    border: 0;
    border-inline-end: 1px solid #e5e9ef;
    border-bottom: 1px solid #e5e9ef;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.tiny-editor-table th {
    background: #f1f5f9;
    color: #172033;
    font-weight: 700;
}

.tiny-editor-table thead th {
    background: #e9eff7;
}

.tiny-editor-table tr > :last-child {
    border-inline-end: 0;
}

.tiny-editor-table tbody tr:last-child > *,
.tiny-editor-table tfoot tr:last-child > * {
    border-bottom: 0;
}

.tiny-editor-table tbody tr {
    transition: background-color .15s ease;
}

.tiny-editor-table tbody tr:hover {
    background: #f8fafc;
}

.tiny-editor-table--striped tbody tr:nth-child(even) {
    background: #f7f9fc;
}

.tiny-editor-table--compact th,
.tiny-editor-table--compact td {
    padding: .45rem .65rem;
    font-size: .875rem;
}

.tiny-editor-table a {
    color: #2563eb;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tiny-editor-table img {
    max-width: 100%;
    height: auto;
}

[data-bs-theme="dark"] .tiny-editor-table {
    border-color: #475569;
    background: #1e293b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .tiny-editor-table th,
[data-bs-theme="dark"] .tiny-editor-table td {
    border-color: #475569;
}

[data-bs-theme="dark"] .tiny-editor-table th,
[data-bs-theme="dark"] .tiny-editor-table thead th {
    background: #334155;
    color: #f8fafc;
}

[data-bs-theme="dark"] .tiny-editor-table tbody tr:hover,
[data-bs-theme="dark"] .tiny-editor-table--striped tbody tr:nth-child(even) {
    background: #273449;
}

@media (max-width: 767.98px) {
    .tiny-editor-table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        border-radius: 8px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tiny-editor-table th,
    .tiny-editor-table td {
        padding: .65rem .75rem;
        white-space: normal;
    }
}

@media print {
    .tiny-editor-table {
        break-inside: avoid;
        box-shadow: none;
    }
}

@media (prefers-color-scheme: dark) {
    .mce-content-body .tiny-editor-table {
        border-color: #475569;
        background: #1e293b;
        color: #e2e8f0;
    }

    .mce-content-body .tiny-editor-table th,
    .mce-content-body .tiny-editor-table td {
        border-color: #475569;
    }

    .mce-content-body .tiny-editor-table th,
    .mce-content-body .tiny-editor-table thead th {
        background: #334155;
        color: #f8fafc;
    }

    .mce-content-body .tiny-editor-table tbody tr:hover,
    .mce-content-body .tiny-editor-table--striped tbody tr:nth-child(even) {
        background: #273449;
    }
}

/* جدول مشخصات پروژه؛ دو ستون مینیمال و سازگار با زمینه روشن و تیره. */
.tiny-project-details-wrap {
    width: 100%;
    max-width: 46rem;
    margin: 1.5rem 0;
    padding-inline: 1.25rem;
    overflow-x: auto;
    color: #f8fafc;
    background: #151719;
    border-radius: 2px;
    box-sizing: border-box;
}

.tiny-project-details {
    width: 100%;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
    background: transparent;
    color: inherit;
    font-size: .875rem;
    line-height: 1.55;
}

.tiny-project-details th,
.tiny-project-details td {
    padding: 1rem 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .13);
    background: transparent;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.tiny-project-details tr:last-child > * { border-bottom: 0; }

.tiny-project-details th {
    width: 35%;
    padding-inline-end: 1.25rem;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    text-align: start;
    text-transform: uppercase;
}

.tiny-project-details td {
    width: 65%;
    color: rgba(255, 255, 255, .52);
    text-align: start;
}

.mce-content-body .tiny-project-details-wrap {
    outline: 1px dashed rgba(255, 255, 255, .2);
    outline-offset: -1px;
}

@media (max-width: 575.98px) {
    .tiny-project-details th { width: 42%; padding-inline-end: .75rem; }
    .tiny-project-details td { width: 58%; }
    .tiny-project-details th,
    .tiny-project-details td { padding-block: .8rem; }
}

@media print {
    .tiny-project-details-wrap {
        color: #111827;
        background: transparent;
    }
    .tiny-project-details th,
    .tiny-project-details td { border-color: #d1d5db; color: #111827; }
}

/* بلوک واقعی عکس و متن: دو ستون مستقل، بدون عبور متن از زیر تصویر. */
.tiny-content-side-by-side {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    align-items: flex-start;
    gap: 0;
    clear: both;
    box-sizing: border-box;
}

.tiny-content-side-by-side:not(:has(.tiny-content-side-by-side__divider)) { gap: 24px; }

.tiny-content-side-by-side__media {
    flex: 0 1 40%;
    width: 40%;
    max-width: 40%;
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.tiny-content-side-by-side__text {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

.tiny-content-side-by-side__media img,
.tiny-content-side-by-side__media figure,
.tiny-content-side-by-side__media a {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    box-sizing: border-box;
}

.tiny-content-side-by-side__text pre,
.tiny-content-side-by-side__text code {
    max-width: 100%;
    overflow-x: auto;
}

.tiny-content-side-by-side__divider {
    position: relative;
    display: block;
    align-self: stretch;
    flex: 0 0 24px;
    width: 24px;
    min-height: 3rem;
    box-sizing: border-box;
}

.tiny-content-side-by-side__ratio,
.tiny-content-side-by-side__gap-value { display: none; }

/* مرزبندی فقط در خود ادیتور برای تشخیص آسان دو ستون. */
.mce-content-body .tiny-content-side-by-side {
    padding: .5rem;
    border: 1px dashed #b9c7da;
    border-radius: .5rem;
}

.mce-content-body .tiny-content-side-by-side__media,
.mce-content-body .tiny-content-side-by-side__text {
    min-height: 3rem;
    outline: 1px dashed rgba(37, 99, 235, .22);
    outline-offset: .2rem;
}

.mce-content-body .tiny-content-side-by-side__divider {
    display: block;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.mce-content-body .tiny-content-side-by-side__divider::before {
    content: '';
    position: absolute;
    inset-block: 0;
    left: 50%;
    width: 3px;
    border-radius: 999px;
    background: #94a3b8;
    transform: translateX(-50%);
    transition: width .15s, background-color .15s;
}

.mce-content-body .tiny-content-side-by-side__divider:hover::before,
.mce-content-body .tiny-content-side-by-side__divider.is-resizing::before {
    width: 5px;
    background: #2563eb;
}

.mce-content-body .tiny-content-side-by-side__ratio,
.mce-content-body .tiny-content-side-by-side__gap-value {
    position: absolute;
    left: 50%;
    z-index: 2;
    display: inline-flex;
    min-width: 42px;
    height: 22px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font: 700 10px/1 Arial,sans-serif;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15,23,42,.12);
    transform: translateX(-50%);
}

.mce-content-body .tiny-content-side-by-side__ratio { top: 8px; pointer-events: none; }
.mce-content-body .tiny-content-side-by-side__gap-value { top: 36px; color: #1d4ed8; cursor: pointer; }

@media (max-width: 767.98px) {
    .tiny-content-side-by-side {
        flex-direction: column !important;
        gap: 1rem;
    }

    .tiny-content-side-by-side__media,
    .tiny-content-side-by-side__text {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }

    /* در RTL باکس سمت راست در موبایل بالا می‌ماند. */
    .tiny-content-side-by-side--media-start .tiny-content-side-by-side__media,
    .tiny-content-side-by-side--media-end .tiny-content-side-by-side__text { order: 0; }
    .tiny-content-side-by-side--media-start .tiny-content-side-by-side__text,
    .tiny-content-side-by-side--media-end .tiny-content-side-by-side__media { order: 1; }
    .tiny-content-side-by-side__divider { display: none !important; }
}
/* باکس‌بندی عمومی و ریسپانسیو محتوای TinyMCE. */
.tiny-content-box-layout {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    align-items: stretch;
    gap: 0;
    clear: both;
    box-sizing: border-box;
}

.tiny-content-box-layout__box {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}

.tiny-content-box-layout__box img,
.tiny-content-box-layout__box video,
.tiny-content-box-layout__box iframe,
.tiny-content-box-layout__box figure {
    max-width: 100% !important;
    height: auto;
    box-sizing: border-box;
}

.tiny-content-box-layout__divider {
    position: relative;
    display: block;
    align-self: stretch;
    flex: 0 0 24px;
    width: 24px;
    min-height: 3rem;
    box-sizing: border-box;
}

.tiny-content-box-layout__ratio,
.tiny-content-box-layout__gap-value { display: none; }

.mce-content-body .tiny-content-box-layout {
    padding: .5rem;
    border: 1px dashed #94a3b8;
    border-radius: .55rem;
    background: rgba(248,250,252,.55);
}

.mce-content-body .tiny-content-box-layout__box {
    min-height: 7rem;
    padding: .65rem;
    outline: 1px dashed rgba(37,99,235,.3);
    outline-offset: -.2rem;
    border-radius: .35rem;
    background: rgba(255,255,255,.7);
}

.mce-content-body .tiny-content-box-layout__divider {
    display: block;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.mce-content-body .tiny-content-box-layout__divider::before {
    content: '';
    position: absolute;
    inset-block: 0;
    left: 50%;
    width: 3px;
    border-radius: 999px;
    background: #94a3b8;
    transform: translateX(-50%);
    transition: width .15s, background-color .15s;
}

.mce-content-body .tiny-content-box-layout__divider:hover::before,
.mce-content-body .tiny-content-box-layout__divider.is-resizing::before {
    width: 5px;
    background: #2563eb;
}

.mce-content-body .tiny-content-box-layout__ratio,
.mce-content-body .tiny-content-box-layout__gap-value {
    position: absolute;
    left: 50%;
    z-index: 2;
    display: inline-flex;
    min-width: 52px;
    height: 22px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #334155;
    font: 700 10px/1 Arial,sans-serif;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(15,23,42,.12);
    transform: translateX(-50%);
}

.mce-content-body .tiny-content-box-layout__ratio { top: 8px; pointer-events: none; }
.mce-content-body .tiny-content-box-layout__gap-value { top: 36px; color: #1d4ed8; cursor: pointer; }

@media (max-width: 767.98px) {
    .tiny-content-box-layout {
        flex-direction: column !important;
        gap: 1rem;
    }

    .tiny-content-box-layout__box {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0;
    }

    .tiny-content-box-layout__divider { display: none !important; }
}
