/* LH editor (resources/assets/js/lh-editor.js): theme colours from themes.css, accent from --p / --p-rgb (owner colour). */
.lhe { position: relative; display: flex; flex-direction: column; border: 1px solid var(--color-border-main); border-radius: 10px; background: var(--color-panel); transition: border-color .15s, box-shadow .15s; }
.lhe:focus-within { border-color: rgb(var(--p-rgb) / .55); box-shadow: 0 0 0 1px rgb(var(--p-rgb) / .2); }
.lhe.lhe-invalid { border-color: #ef4444; box-shadow: 0 0 0 1px rgb(239 68 68 / .25); }

.lhe-bar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; border-bottom: 1px solid var(--color-border-main); border-radius: 10px 10px 0 0; background: var(--color-card); }
.lhe-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--color-border-light); }
.lhe-push { margin-left: auto; }
.lhe-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--color-text-muted); font-size: 12px; line-height: 1; cursor: pointer; transition: background-color .12s, color .12s, border-color .12s; }
.lhe-btn:hover:not(:disabled) { background: var(--color-panel); color: var(--color-text-main); }
.lhe-btn.is-on { background: rgb(var(--p-rgb) / .12); border-color: rgb(var(--p-rgb) / .28); color: var(--p); }
.lhe-btn:disabled { opacity: .3; cursor: default; }
.lhe-format { min-width: 118px; justify-content: space-between; font-weight: 700; font-size: 11.5px; }
.lhe-color-a { position: relative; font-weight: 900; font-size: 13px; font-family: Georgia, serif; padding-bottom: 3px; }
.lhe-color-a i { position: absolute; left: -1px; right: -1px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--p); }

.lhe-area { flex: 1; max-height: 70vh; overflow: auto; resize: vertical; padding: 14px 16px; outline: none; color: var(--color-text-main); font-size: 14px; line-height: 1.65; word-wrap: break-word; }
.lhe-area > :first-child { margin-top: 0; }
.lhe-area p, .lhe-area ul, .lhe-area ol, .lhe-area blockquote, .lhe-area pre { margin: 0 0 .75em; }
.lhe-area h1, .lhe-area h2, .lhe-area h3, .lhe-area h4 { margin: .9em 0 .45em; font-weight: 800; line-height: 1.25; }
.lhe-area h1 { font-size: 1.75em; } .lhe-area h2 { font-size: 1.45em; } .lhe-area h3 { font-size: 1.2em; } .lhe-area h4 { font-size: 1.05em; }
.lhe-area ul { list-style: disc; padding-left: 1.6em; } .lhe-area ol { list-style: decimal; padding-left: 1.6em; }
.lhe-area blockquote { padding: .4em 1em; border-left: 3px solid var(--p); background: rgb(var(--p-rgb) / .06); border-radius: 0 6px 6px 0; color: var(--color-text-muted); }
.lhe-area pre { padding: .7em 1em; border-radius: 8px; background: var(--color-base); border: 1px solid var(--color-border-main); font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.lhe-area a { color: var(--p); text-decoration: underline; text-underline-offset: 2px; }
.lhe-area hr { margin: 1em 0; border: 0; border-top: 1px solid var(--color-border-light); }
.lhe-area img { max-width: 100%; height: auto; border-radius: 6px; }
.lhe-area:empty::before { content: 'Write here...'; color: var(--color-text-muted); opacity: .6; }

.lhe-src { display: none; width: 100%; resize: vertical; padding: 14px 16px; border: 0; outline: none; background: var(--color-base); color: var(--color-text-main); font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; border-radius: 0 0 10px 10px; }
.lhe.is-source .lhe-area { display: none; }
.lhe.is-source .lhe-src { display: block; }

.lhe.lhe-full { position: fixed; inset: 14px; z-index: 300; box-shadow: 0 30px 80px rgb(0 0 0 / .55); }
.lhe.lhe-full .lhe-area, .lhe.lhe-full .lhe-src { flex: 1; max-height: none; resize: none; height: auto !important; }
body.lhe-lock { overflow: hidden; }

.lhe-pop { position: absolute; z-index: 20; min-width: 230px; padding: 10px; border: 1px solid var(--color-border-light); border-radius: 10px; background: var(--color-card); box-shadow: 0 14px 34px rgb(0 0 0 / .4); }
.lhe-menu { display: flex; flex-direction: column; min-width: 170px; margin: -4px; }
.lhe-menu-item { padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--color-text-main); text-align: left; cursor: pointer; }
.lhe-menu-item:hover { background: var(--color-panel); }
.lhe-fmt-p { font-size: 13px; } .lhe-fmt-h1 { font-size: 19px; font-weight: 800; } .lhe-fmt-h2 { font-size: 17px; font-weight: 800; }
.lhe-fmt-h3 { font-size: 15px; font-weight: 800; } .lhe-fmt-h4 { font-size: 13.5px; font-weight: 800; }
.lhe-fmt-blockquote { font-size: 13px; font-style: italic; color: var(--color-text-muted); } .lhe-fmt-pre { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }

.lhe-form { display: flex; flex-direction: column; gap: 8px; width: 270px; }
.lhe-field { display: flex; flex-direction: column; gap: 4px; }
.lhe-field > span { font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted); }
.lhe-input { width: 100%; padding: 7px 9px; border: 1px solid var(--color-border-main); border-radius: 7px; background: var(--color-panel); color: var(--color-text-main); font-size: 12.5px; outline: none; }
.lhe-input:focus { border-color: rgb(var(--p-rgb) / .6); }
.lhe-input.is-bad { border-color: #ef4444; }
.lhe-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-text-main); cursor: pointer; }
.lhe-check input { accent-color: var(--p); }
.lhe-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.lhe-act { padding: 6px 12px; border: 1px solid var(--color-border-light); border-radius: 7px; background: var(--color-panel); color: var(--color-text-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.lhe-act:hover { color: var(--color-text-main); }
.lhe-act.is-primary { background: rgb(var(--p-rgb) / .12); border-color: rgb(var(--p-rgb) / .3); color: var(--p); }
.lhe-act.is-primary:hover { background: var(--p); color: #fff; }

.lhe-colors { display: flex; flex-direction: column; gap: 10px; }
.lhe-swatches { display: grid; grid-template-columns: repeat(8, 22px); gap: 5px; }
.lhe-swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgb(255 255 255 / .12); cursor: pointer; transition: transform .1s; }
.lhe-swatch:hover { transform: scale(1.15); }
.lhe-color-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--color-text-muted); }
.lhe-color-row input[type=color] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--color-border-light); border-radius: 6px; background: none; cursor: pointer; }
.lhe-color-row .lhe-actions { margin: 0 0 0 auto; }

/* Before lh-editor.js replaces it, the raw <textarea data-editor> (HTML source) would flash for a moment:
   show it as an empty box in the editor colours instead. */
textarea[data-editor] { color: transparent !important; caret-color: transparent; background: var(--color-panel) !important; border: 1px solid var(--color-border-main) !important; border-radius: 10px; resize: none; overflow: hidden; }
