/* ==========================================================================
   GKRI Shared SunEditor 3.4.3 Styling (Light & Dark Themes, Classic & Document)
   ========================================================================== */

.sun-editor,
.sun-editor-common {
    --se-edit-anchor: #1d4ed8;
    --se-main-out-color: #1d4ed8;
    --se-doc-background: #eef2f7;
    --se-doc-info-background-color: #f8fafc;
    --se-doc-info-font-color: #334155;
    --se-doc-info-page-background-color: #e2e8f0;
    --se-doc-info-page-font-color: #0f172a;
    --se-doc-info-active-color: #1d4ed8;
}

.sun-editor {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--sg-border, rgba(15, 23, 42, 0.14));
    border-radius: 12px;
    overflow: hidden;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-editor-shell .sun-editor {
    border-radius: 12px;
    border-color: var(--sg-border, rgba(151, 176, 214, 0.28));
}

.sun-editor .se-toolbar {
    border-bottom: 1px solid var(--se-main-divider-color, rgba(15, 23, 42, 0.1));
}

.sun-editor .se-wrapper {
    max-width: 100%;
    overflow: hidden;
}

.sun-editor-editable {
    font-family: inherit;
    font-size: 15px;
    line-height: 1.68;
}

.sun-editor-editable img {
    max-width: 100%;
    height: auto;
}

.sun-editor-editable figure {
    max-width: 100%;
}

/* Classic layout comfort sizing */
.gkri-se-classic .se-wrapper-inner {
    min-height: 180px;
}

.gkri-se-compact .se-wrapper-inner {
    min-height: 160px;
}

/* Document layout (Word/Docs style A4 + outline sidebar) */
.gkri-se-document .se-wrapper.se-type-document {
    background-color: var(--se-doc-background, #eef2f7);
    overflow-x: auto;
    overflow-y: auto;
}

.sun-editor .se-wrapper.se-type-document .se-document-page {
    overflow-x: auto;
}

.sun-editor .se-wrapper.se-type-document .sun-editor-editable.se-type-document-editable-a4 {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border-radius: 4px;
    margin-top: 18px;
    margin-bottom: 24px;
}

.sun-editor .se-document-lines {
    min-width: 180px;
    max-width: 240px;
    border-right: 1px solid var(--se-main-divider-color, rgba(15, 23, 42, 0.1));
}

/* Forum quote & mention rendering inside editor */
.sun-editor-editable .forum-mention {
    color: #2563eb;
    font-weight: 700;
}

.sun-editor-editable .forum-quote {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid #3b82f6;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 0.5rem;
}

.sun-editor-editable .forum-quote-header {
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 0.35rem;
    opacity: 0.85;
}

.sun-editor-editable .forum-quote-body p:last-child {
    margin-bottom: 0;
}

/* Ensure SunEditor overlays sit above cards & Bootstrap 5 modals (.modal z-index ~1055) */
.sun-editor-common.se-menu-tray,
.sun-editor-common.se-modal-area {
    z-index: 2147483000;
}

.modal .sun-editor,
.modal-dialog .sun-editor {
    position: relative;
    z-index: 2;
}

.sun-editor .se-modal,
.sun-editor-common.se-modal-area,
.sun-editor .se-list-layer,
.sun-editor-common .se-list-layer,
.sun-editor .se-controller,
.sun-editor-common .se-controller,
.sun-editor .se-autocomplete-list,
.sun-editor-common .se-autocomplete-list {
    z-index: 2147483500;
}

/* Status bar sizing */
.sun-editor .se-resizing-bar {
    min-height: 24px;
    font-size: 12px;
}

/* ==========================================================================
   Dark Mode Support (.se-theme-dark, [data-theme="dark"], [data-bs-theme="dark"])
   ========================================================================== */

.se-theme-dark,
.sun-editor.se-theme-dark,
.sun-editor-common.se-theme-dark,
[data-theme="dark"] .sun-editor,
[data-bs-theme="dark"] .sun-editor,
[data-theme="dark"] .sun-editor-common,
[data-bs-theme="dark"] .sun-editor-common,
[data-theme="dark"] .sun-editor-editable,
[data-bs-theme="dark"] .sun-editor-editable {
    --se-caret-color: #f8fafc;
    --se-placeholder-color: #64748b;
    --se-edit-font-color: #e2e8f0;
    --se-edit-font-pre: #cbd5e1;
    --se-edit-font-quote: #94a3b8;
    --se-edit-background-color: #0f172a;
    --se-edit-background-pre: #1e293b;
    --se-edit-border-light: rgba(148, 163, 184, 0.24);
    --se-edit-border-dark: rgba(148, 163, 184, 0.45);
    --se-edit-border-table: rgba(148, 163, 184, 0.3);
    --se-edit-anchor: #60a5fa;
    --se-edit-hr-color: rgba(148, 163, 184, 0.28);

    --se-main-out-color: #60a5fa;
    --se-main-color: #e2e8f0;
    --se-main-color-lighter: #94a3b8;
    --se-main-background-color: #162033;
    --se-code-view-color: #e2e8f0;
    --se-code-view-background-color: #0b1120;

    --se-main-divider-color: rgba(148, 163, 184, 0.18);
    --se-main-border-color: rgba(148, 163, 184, 0.24);
    --se-hover-color: rgba(148, 163, 184, 0.16);
    --se-hover-light-color: rgba(148, 163, 184, 0.12);
    --se-active-dark3-color: rgba(59, 130, 246, 0.26);
    --se-active-font-color: #93c5fd;
    --se-active-light-color: rgba(59, 130, 246, 0.22);

    --se-modal-background-color: #162033;
    --se-modal-color: #e2e8f0;
    --se-modal-border-color: rgba(148, 163, 184, 0.26);
    --se-modal-anchor-color: #60a5fa;
    --se-modal-file-input-background-color: #0f172a;

    --se-dropdown-font-color: #e2e8f0;
    --se-controller-background-color: #1e293b;
    --se-controller-color: #e2e8f0;
    --se-controller-border-color: rgba(148, 163, 184, 0.28);
    --se-select-menu-hover-bg: rgba(59, 130, 246, 0.18);
    --se-select-menu-active-bg: rgba(59, 130, 246, 0.28);
    --se-table-picker-color: rgba(148, 163, 184, 0.25);
    --se-table-picker-border-color: rgba(148, 163, 184, 0.35);

    --se-doc-background: #090f1d;
    --se-doc-info-font-color: #cbd5e1;
    --se-doc-info-page-background-color: #1e293b;
    --se-doc-info-page-font-color: #f1f5f9;
    --se-doc-info-active-color: #60a5fa;
}

.sun-editor.se-theme-dark,
[data-theme="dark"] .sun-editor,
[data-bs-theme="dark"] .sun-editor {
    border-color: var(--sg-border, rgba(148, 163, 184, 0.24));
    background-color: #162033;
    color: #e2e8f0;
}

.sun-editor.se-theme-dark .sun-editor-editable,
[data-theme="dark"] .sun-editor .sun-editor-editable,
[data-bs-theme="dark"] .sun-editor .sun-editor-editable {
    background-color: #0f172a;
    color: #e2e8f0;
}

.sun-editor.se-theme-dark .se-wrapper.se-type-document,
[data-theme="dark"] .sun-editor .se-wrapper.se-type-document,
[data-bs-theme="dark"] .sun-editor .se-wrapper.se-type-document {
    background-color: #090f1d;
}

.sun-editor.se-theme-dark .se-wrapper.se-type-document .sun-editor-editable.se-type-document-editable-a4,
[data-theme="dark"] .sun-editor .se-wrapper.se-type-document .sun-editor-editable.se-type-document-editable-a4,
[data-bs-theme="dark"] .sun-editor .se-wrapper.se-type-document .sun-editor-editable.se-type-document-editable-a4 {
    background-color: #111c2e;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.sun-editor.se-theme-dark .sun-editor-editable .forum-quote,
[data-theme="dark"] .sun-editor .sun-editor-editable .forum-quote,
[data-bs-theme="dark"] .sun-editor .sun-editor-editable .forum-quote {
    background: rgba(59, 130, 246, 0.14);
    border-left-color: #60a5fa;
}

.sun-editor.se-theme-dark .sun-editor-editable .forum-mention,
[data-theme="dark"] .sun-editor .sun-editor-editable .forum-mention,
[data-bs-theme="dark"] .sun-editor .sun-editor-editable .forum-mention {
    color: #93c5fd;
}

@media (max-width: 900px) {
    .sun-editor .se-document-lines {
        display: none;
    }
}
