/* Rich text editor - Pages/Shared/_RichTextEditor.cshtml, used by /Admin/About (page text and FAQ
   answers). Quill's snow theme supplies the toolbar mechanics (pages load quill.snow.css in their
   Head section); these rules re-skin it onto the site tokens so it follows the light/dark theme. */

.rte { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.rte-label { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; }
.rte-label label { font-family: var(--font-display); font-weight: 600; font-size: .95rem; color: var(--ink); }
.rte-label span { font-size: .8rem; color: var(--muted); }

.rte-frame {
    background: var(--surface); border: 1px solid var(--muted); border-radius: .6rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.rte-frame:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent); }

/* ---------- Toolbar ---------- */
.rte .rte-toolbar.ql-toolbar.ql-snow, .rte .rte-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .15rem;
    padding: .4rem .55rem; border: 0; border-bottom: 1px solid var(--border);
    background: var(--surface-2); border-radius: .6rem .6rem 0 0;
    font-family: var(--font-sans);
}
.rte .ql-toolbar.ql-snow .ql-formats { display: inline-flex; align-items: center; margin-right: 0; padding-right: .35rem; border-right: 1px solid var(--border); }
.rte .ql-toolbar.ql-snow .ql-formats:nth-last-child(2) { border-right: 0; }
.rte .ql-snow.ql-toolbar button { width: 32px; height: 32px; padding: 7px; border-radius: .4rem; }
.rte .ql-snow.ql-toolbar button:hover, .rte .ql-snow.ql-toolbar button:focus-visible { background: var(--surface); }
.rte .ql-snow.ql-toolbar button.ql-active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.rte .ql-snow.ql-toolbar button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.rte .ql-snow .ql-stroke { stroke: var(--ink-soft); }
.rte .ql-snow .ql-fill, .rte .ql-snow .ql-stroke.ql-fill { fill: var(--ink-soft); }
.rte .ql-snow.ql-toolbar button:hover .ql-stroke, .rte .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.rte .ql-snow .ql-picker-label:hover .ql-stroke, .rte .ql-snow .ql-picker-label.ql-active .ql-stroke { stroke: var(--blue); }
.rte .ql-snow.ql-toolbar button:hover .ql-fill, .rte .ql-snow.ql-toolbar button.ql-active .ql-fill,
.rte .ql-snow .ql-picker-label:hover .ql-fill, .rte .ql-snow .ql-picker-label.ql-active .ql-fill { fill: var(--blue); }

.rte .ql-snow .ql-picker { color: var(--ink-soft); height: 32px; }
.rte .ql-snow .ql-picker.ql-header { width: 112px; }
.rte .ql-snow .ql-picker-label { border-radius: .4rem; display: flex; align-items: center; }
.rte .ql-snow .ql-picker.ql-header .ql-picker-label { border: 1px solid var(--border); background: var(--surface); }
.rte .ql-snow .ql-picker-label:hover, .rte .ql-snow .ql-picker-label.ql-active { color: var(--blue); }
.rte .ql-snow .ql-picker-options {
    background: var(--surface); border: 1px solid var(--border) !important; border-radius: .5rem;
    box-shadow: var(--shadow-lg) !important; color: var(--ink);
}
.rte .ql-snow .ql-picker-item:hover, .rte .ql-snow .ql-picker-item.ql-selected { color: var(--blue); }
.rte .ql-snow .ql-color-picker .ql-picker-item { border: 1px solid var(--border); }

.rte-mode { margin-left: auto; display: inline-flex; align-items: center; gap: .75rem; }
.rte-mode-label { font-family: var(--font-display); font-weight: 600; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rte-mode-btn {
    min-height: 32px; padding: 0 .7rem; border-radius: .4rem; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--ink);
    font-family: var(--font-display); font-weight: 600; font-size: .75rem; letter-spacing: .06em;
}
.rte-mode-btn:hover, .rte-mode-btn:focus-visible { border-color: var(--blue); color: var(--blue); }
.rte-mode-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.rte.is-html .rte-wysiwyg { display: none !important; }
/* Before the script runs (or without it) only the textarea is useful. */
.rte:not(.is-ready) .rte-toolbar, .rte:not(.is-ready) .rte-editor { display: none; }

/* ---------- Editing area ---------- */
.rte .ql-container.ql-snow { border: 0; font-family: var(--font-sans); font-size: .95rem; color: var(--ink-soft); }
.rte-editor[hidden], .rte-source[hidden] { display: none !important; }
.rte .ql-editor {
    min-height: inherit; max-height: 70vh; overflow-y: auto;
    padding: 1.25rem 1.5rem; line-height: 1.65;
}
.rte .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; left: 1.5rem; right: 1.5rem; }
.rte .ql-editor h1, .rte .ql-editor h2, .rte .ql-editor h3, .rte .ql-editor h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.15; margin: 1.4rem 0 .6rem; }
.rte .ql-editor h1 { font-size: 1.9rem; margin-top: 0; }
.rte .ql-editor h2 { font-size: 1.45rem; }
.rte .ql-editor h3 { font-size: 1.2rem; }
.rte .ql-editor h4 { font-size: 1.05rem; }
.rte .ql-editor p { margin: 0 0 .8rem; }
.rte .ql-editor strong { color: var(--ink); }
.rte .ql-editor a { color: var(--blue); }
.rte .ql-snow .ql-tooltip {
    background: var(--surface); color: var(--ink); border: 1px solid var(--border);
    border-radius: .5rem; box-shadow: var(--shadow-lg); z-index: 5;
}
.rte .ql-snow .ql-tooltip input[type=text] { background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: .35rem; }
.rte .ql-snow .ql-tooltip a { color: var(--blue); }

.rte-source {
    display: block; width: 100%; box-sizing: border-box; resize: vertical;
    padding: 1rem 1.25rem; border: 0; border-radius: 0 0 .6rem .6rem; background: var(--surface);
    color: var(--ink); font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: .85rem; line-height: 1.55;
}
.rte-source:focus { outline: none; }
.rte:not(.is-ready) .rte-source { border-radius: .6rem; }
