/* Editor isi berita dan pemilih foto yang konsisten di admin serta halaman pengunjung. */
.rich-editor {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dfe5f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(31, 54, 93, .04);
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid #edf0f5;
    background: #f8faff;
}

.rich-editor-tool-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.rich-editor-tool {
    display: inline-grid;
    width: 31px;
    height: 31px;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #61708b;
    cursor: pointer;
    font: 700 12px/1 Inter, sans-serif;
    transition: .18s ease;
}

.rich-editor-tool:hover,
.rich-editor-tool:focus-visible {
    border-color: #c8d8fa;
    background: #edf4ff;
    color: #245eea;
    outline: 0;
}

.rich-editor-tool--text {
    width: 33px;
    font-size: 10px;
}

.rich-editor-tool--image {
    border-color: #d7e4ff;
    background: #eef4ff;
    color: #245eea;
}

.rich-editor-divider {
    width: 1px;
    height: 20px;
    margin: 0 3px;
    background: #dfe5f0;
}

.rich-editor-file-input,
.rich-editor-source {
    display: none !important;
}

.rich-editor-surface {
    min-height: 300px;
    padding: 18px 19px;
    overflow-wrap: anywhere;
    outline: 0;
    background: #fff;
    color: #26334e;
    font-size: 14px;
    line-height: 1.75;
}

.rich-editor-surface:empty::before {
    color: #9aa6ba;
    content: attr(data-placeholder);
    pointer-events: none;
}

.rich-editor-surface p {
    margin: 0 0 1em;
}

.rich-editor-surface p:last-child {
    margin-bottom: 0;
}

.rich-editor-surface h2,
.rich-editor-surface h3 {
    margin: 1.25em 0 .55em;
    color: #172541;
    line-height: 1.3;
}

.rich-editor-surface h2 {
    font-size: 1.42em;
}

.rich-editor-surface h3 {
    font-size: 1.18em;
}

.rich-editor-surface ul,
.rich-editor-surface ol {
    margin: 0 0 1em;
    padding-left: 1.55em;
}

.rich-editor-surface blockquote {
    margin: 1.25em 0;
    padding: 12px 16px;
    border-left: 4px solid #245eea;
    border-radius: 0 9px 9px 0;
    background: #f4f7ff;
    color: #53617b;
}

.rich-editor-surface a {
    color: #245eea;
    text-decoration: underline;
}

.rich-editor-surface img {
    display: block;
    max-width: 100%;
    height: auto;
}

.rich-editor-surface figure.editor-inline-image {
    margin: 22px 0;
    text-align: center;
}

.rich-editor-surface figure.editor-inline-image img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 10px;
    background: #f1f4f9;
}

.rich-editor-surface figure.editor-inline-image figcaption {
    margin-top: 6px;
    color: #8490a6;
    font-size: 11px;
}

.rich-editor-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-top: 1px solid #edf0f5;
    background: #fbfcff;
    color: #8793a8;
    font-size: 10px;
    line-height: 1.4;
}

.rich-editor-footer [data-rich-editor-status] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rich-editor-footer [data-rich-editor-status].is-error {
    color: #c73545;
}

.rich-editor.is-uploading .rich-editor-surface {
    opacity: .62;
    pointer-events: none;
}

.image-upload-field {
    min-width: 0;
}

.file-dropzone {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px dashed #cbd7eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbfdff, #f5f8fd);
    cursor: pointer;
    transition: .18s ease;
}

.file-dropzone:hover,
.file-dropzone:focus-within {
    border-color: #2563eb;
    background: #eff5ff;
}

.file-dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-dropzone-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    background: #eaf1ff;
    color: #2563eb;
    font-size: 15px;
}

.file-dropzone-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.file-dropzone-copy strong {
    overflow: hidden;
    color: #233250;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-dropzone-copy small {
    overflow: hidden;
    color: #8793a8;
    font-size: 9px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-dropzone-button {
    flex: none;
    padding: 8px 10px;
    border-radius: 8px;
    background: #245eea;
    color: #fff;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
}

.file-upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.file-upload-preview:empty {
    display: none;
}

.file-preview-item {
    position: relative;
    display: block;
    width: 58px;
    height: 48px;
    overflow: hidden;
    border: 1px solid #dbe4f2;
    border-radius: 8px;
    background: #eef2f8;
}

.file-preview-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-item span {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    padding: 3px 4px;
    background: rgba(15, 26, 49, .72);
    color: #fff;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-more {
    align-self: center;
    color: #657491;
    font-size: 9px;
    font-weight: 700;
}

.image-upload-field.has-files .file-dropzone {
    border-style: solid;
    border-color: #9bb9f7;
    background: #f4f8ff;
}

body.admin-dark .rich-editor,
body.dark-mode .rich-editor {
    border-color: #26324d;
    background: #121a2e;
}

body.admin-dark .rich-editor-toolbar,
body.dark-mode .rich-editor-toolbar,
body.admin-dark .rich-editor-footer,
body.dark-mode .rich-editor-footer {
    border-color: #26324d;
    background: #17223b;
}

body.admin-dark .rich-editor-tool,
body.dark-mode .rich-editor-tool {
    color: #bac7df;
}

body.admin-dark .rich-editor-surface,
body.dark-mode .rich-editor-surface {
    background: #121a2e;
    color: #dbe5f7;
}

body.admin-dark .rich-editor-surface h2,
body.admin-dark .rich-editor-surface h3,
body.dark-mode .rich-editor-surface h2,
body.dark-mode .rich-editor-surface h3 {
    color: #f2f6ff;
}

body.admin-dark .file-dropzone,
body.dark-mode .file-dropzone {
    border-color: #3b4b6d;
    background: #17223b;
}

body.admin-dark .file-dropzone-copy strong,
body.dark-mode .file-dropzone-copy strong {
    color: #e1e9f8;
}

@media (max-width: 620px) {
    .rich-editor-surface {
        min-height: 250px;
        padding: 15px;
        font-size: 13px;
    }

    .rich-editor-toolbar {
        gap: 3px;
        padding: 7px;
    }

    .rich-editor-tool {
        width: 29px;
        height: 29px;
    }

    .rich-editor-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .rich-editor-footer [data-rich-editor-status] {
        max-width: 100%;
        white-space: normal;
    }

    .file-dropzone {
        grid-template-columns: 34px minmax(0, 1fr);
        min-height: 62px;
        gap: 8px;
        padding: 9px 10px;
    }

    .file-dropzone-icon {
        width: 32px;
        height: 32px;
    }

    .file-dropzone-button {
        grid-column: 2;
        justify-self: start;
        padding: 7px 9px;
    }
}

@media (max-width: 380px) {
    .rich-editor-divider {
        margin: 0 1px;
    }

    .rich-editor-tool {
        width: 27px;
        height: 27px;
    }

    .file-dropzone-copy small {
        white-space: normal;
    }
}
