/* Admin rich editor, focus mode and backups */

.editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.editor-main,
.editor-side {
    margin-bottom: 0;
}

.editor-section + .editor-section,
.config-block + .config-block {
    margin-top: 18px;
}

.editor-title-row,
.editor-summary-row {
    display: grid;
}

.editor-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-label-row .form-label {
    margin-bottom: 0.5rem;
}

.editor-side {
    position: sticky;
    top: 20px;
}

.editor-side-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.editor-side-head span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.editor-side-head h2 {
    margin: 2px 0 0;
    font-size: 1.2rem;
}

.config-block {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.config-block:last-of-type {
    padding-bottom: 0;
    border-bottom: 0;
}

.config-block h3,
.archive-box h3 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 900;
}

.compact-checks {
    display: grid;
    gap: 8px;
}

.editor-actions {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 36px;
    padding: 2px 6px 2px 0;
    margin-right: 4px;
    border-right: 1px solid var(--line);
}

.toolbar-group:last-child {
    padding-right: 0;
    margin-right: 0;
    border-right: 0;
}

.toolbar-icon,
.rich-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #4b5563;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
}

.toolbar-text-button {
    min-width: auto;
    height: 30px;
    padding: 0 9px;
    color: #4b5563;
    font-size: 0.84rem;
    font-weight: 700;
}

.toolbar-text-button[data-block-format="P"] {
    font-weight: 600;
}

.toolbar-text-button[data-block-format="H2"] {
    color: #111827;
    font-size: 0.9rem;
    font-weight: 800;
}

.toolbar-text-button[data-block-format="H3"] {
    font-size: 0.86rem;
    font-weight: 700;
}

.toolbar-text-button[data-block-format="BLOCKQUOTE"] {
    color: #6b7280;
    font-style: italic;
    font-weight: 600;
}

.toolbar-icon:hover,
.toolbar-icon.is-active,
.toolbar-text-button.is-active,
.rich-toolbar button:hover {
    border-color: #e5e7eb;
    background: #f9fafb;
    color: #991b1b;
}

.toolbar-icon i,
.rich-toolbar button i {
    font-size: 1rem;
    line-height: 1;
}

.toolbar-icon .bi-caret-down-fill {
    font-size: 0.58rem;
    margin-left: 1px;
}

.toolbar-divider {
    display: inline-block;
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: var(--line);
}

.toolbar-select {
    height: 34px;
    min-width: 118px;
    padding: 0 28px 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 700;
}

.toolbar-select:hover,
.toolbar-select:focus {
    border-color: #e5e7eb;
    background: #f3f4f6;
    outline: 0;
}

.rich-menu {
    position: relative;
    display: inline-flex;
}

.rich-menu-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    display: none;
    min-width: 280px;
    padding: 8px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
}

.rich-menu.is-open .rich-menu-popover {
    display: grid;
}

.rich-menu-popover button {
    justify-content: flex-start;
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 0;
    color: #374151;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: left;
}

.rich-menu-popover button + button {
    border-top: 1px solid var(--line);
}

.rich-menu-label {
    display: block;
    padding: 10px 12px 6px;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rich-menu-label + button {
    border-top: 1px solid var(--line);
}

.rich-menu-popover button i {
    width: 22px;
    color: #6b7280;
}

.color-popover {
    min-width: 176px;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 10px;
}

.color-popover .color-swatch {
    display: grid;
    place-items: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-top: 0;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: var(--swatch);
}

.color-popover .color-swatch:hover {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.10);
}

.rich-editor {
    min-height: 460px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    background: white;
    line-height: 1.75;
    outline: 0;
}

.html-editor {
    width: 100%;
    min-height: 460px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 0 0 8px 8px;
    background: #111827;
    color: #f9fafb;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 0.94rem;
    line-height: 1.65;
    outline: 0;
    resize: vertical;
}

.html-editor:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.tinymce-textarea {
    min-height: 320px;
}

.tox-tinymce {
    border-color: var(--line) !important;
    border-radius: 8px !important;
}

.tox-tinymce-aux {
    z-index: 3000 !important;
}

.content-media-hidden {
    display: none;
}

.rich-editor p {
    margin: 0 0 1.1em;
    font-size: 1rem;
    font-weight: 400;
}

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

.rich-editor .text-color-ink {
    color: #111827;
}

.rich-editor .text-color-red {
    color: #b91c1c;
}

.rich-editor .text-color-orange {
    color: #c2410c;
}

.rich-editor .text-color-blue {
    color: #2563eb;
}

.rich-editor .text-color-green {
    color: #15803d;
}

.rich-editor .text-color-teal {
    color: #0f766e;
}

.rich-editor .text-color-gold {
    color: #a16207;
}

.rich-editor .text-color-gray {
    color: #6b7280;
}

.rich-editor .text-align-left {
    text-align: left;
}

.rich-editor .text-align-center {
    text-align: center;
}

.rich-editor .text-align-right {
    text-align: right;
}

.rich-editor .text-align-justify {
    text-align: justify;
}

.rich-editor:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.rich-editor h2 {
    margin: 18px 0 10px;
    font-size: 1.45rem;
    font-weight: 800;
}

.rich-editor h3 {
    margin: 16px 0 8px;
    font-size: 1.18rem;
    font-weight: 800;
}

.rich-editor blockquote {
    margin: 18px 0;
    padding: 10px 14px;
    border-left: 4px solid var(--brand);
    background: #f9fafb;
}

.rich-editor img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 14px 0;
    border-radius: 8px;
}

.rich-editor img.image-size-small {
    width: min(33%, 260px);
}

.rich-editor img.image-size-medium {
    width: min(50%, 420px);
}

.rich-editor img.image-size-large {
    width: min(75%, 680px);
}

.rich-editor img.image-size-full {
    width: 100%;
}

.rich-editor img.image-align-left {
    margin-left: 0;
    margin-right: auto;
}

.rich-editor img.image-align-center {
    margin-left: auto;
    margin-right: auto;
}

.rich-editor img.image-align-right {
    margin-left: auto;
    margin-right: 0;
}

.rich-editor img.image-align-justify {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.rich-editor img.is-selected-media {
    outline: 3px solid rgba(185, 28, 28, 0.35);
    outline-offset: 3px;
}

.rich-editor iframe,
.rich-editor video,
.rich-editor audio {
    display: block;
    width: 100%;
    margin: 14px 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111827;
}

.rich-editor iframe,
.rich-editor video {
    aspect-ratio: 16 / 9;
    min-height: 260px;
}

.rich-editor audio {
    background: #f3f4f6;
}

.field-hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.cover-preview {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.current-status {
    flex: 0 0 auto;
    margin-top: 0;
    padding: 6px 10px;
    border: 1px solid #fee2e2;
    border-radius: 999px;
    background: #fff7f7;
    color: #991b1b;
    font-size: 0.78rem;
    font-weight: 900;
}

.archive-box {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
}

.archive-box h3 {
    color: #92400e;
}

.editor-focus-mode .sidebar,
.editor-focus-mode .topbar,
.editor-focus-mode .page-heading,
.editor-focus-mode .editor-side {
    display: none;
}

.editor-focus-mode .admin-layout,
.editor-focus-mode .editor-grid {
    display: block;
}

.editor-focus-mode .content {
    padding: 0;
}

.editor-focus-mode .editor-main {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
}

.editor-focus-mode .rich-editor {
    min-height: calc(100vh - 240px);
}

.editor-focus-mode .tox-tinymce {
    min-height: calc(100vh - 170px);
}

.backup-panel p,
.deploy-list {
    color: var(--muted);
    line-height: 1.6;
}

.backup-actions {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.import-form {
    display: grid;
    gap: 10px;
    max-width: 520px;
}

.import-option {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 0.92rem;
}

.deploy-list li {
    margin-bottom: 8px;
}

