/* ClinicalVillage website editor — admin + live editing styles (no Tailwind dependency) */

[x-cloak] { display: none !important; }

/* ---------------- Live editing on the public site ---------------- */
body.cv-editing { padding-bottom: 84px; }
body.cv-editing .cv-t {
    outline: 1px dashed transparent;
    outline-offset: 3px;
    border-radius: 3px;
    cursor: text;
    transition: outline-color .15s, background-color .15s;
}
body.cv-editing .cv-t:hover { outline-color: rgba(59, 109, 243, .65); background: rgba(59, 109, 243, .06); }
body.cv-editing .cv-t:focus { outline: 2px solid #3b6df3; background: rgba(255, 255, 255, .85); color: inherit; }
body.cv-editing .cv-t.cv-saving { outline-color: #f59e0b; }
body.cv-editing .cv-t.cv-saved { outline: 2px solid #10b981; }
body.cv-editing.cv-outline-all .cv-t { outline-color: rgba(59, 109, 243, .35); }
body.cv-editing .cv-t:empty::before { content: '(empty — click to type)'; opacity: .45; font-style: italic; }

.cv-img-btn {
    position: absolute; top: 14px; right: 14px; z-index: 60;
    display: inline-flex; align-items: center; gap: 6px;
    background: #0b1220; color: #fff; border: 0; border-radius: 999px;
    padding: 8px 14px; font: 500 13px/1 system-ui, sans-serif; cursor: pointer;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5);
}
.cv-img-btn:hover { background: #2b56e0; }

.cv-toolbar {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 9998;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
    width: max-content; max-width: calc(100vw - 24px);
    background: #0b1220; color: #e2e8f0; border-radius: 16px; padding: 8px 8px 8px 16px;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .55);
    font: 400 13px/1.3 system-ui, -apple-system, sans-serif;
}
.cv-toolbar .cv-tb-title { display: flex; align-items: center; gap: 8px; margin-right: 6px; }
.cv-toolbar .cv-tb-dot { width: 8px; height: 8px; border-radius: 99px; background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .2); }
.cv-toolbar .cv-tb-hint { color: #94a3b8; }
.cv-toolbar button, .cv-toolbar a, .cv-toolbar select {
    background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px; padding: 8px 12px; font: 500 13px/1 system-ui, sans-serif; cursor: pointer; text-decoration: none;
}
.cv-toolbar select { padding: 7px 8px; max-width: 160px; }
.cv-toolbar select option { color: #0b1220; }
.cv-toolbar button:hover, .cv-toolbar a:hover { background: rgba(255, 255, 255, .16); }
.cv-toolbar .cv-tb-done { background: #2b56e0; border-color: #2b56e0; }
.cv-toolbar .cv-tb-done:hover { background: #2243c4; }
@media (max-width: 720px) { .cv-toolbar .cv-tb-hint { display: none; } }

/* ---------------- Toasts ---------------- */
.cv-toasts { position: fixed; top: 16px; right: 16px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.cv-toast {
    background: #0b1220; color: #fff; padding: 10px 14px; border-radius: 10px; font: 500 13px/1.3 system-ui, sans-serif;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); animation: cvIn .2s ease-out; max-width: 340px;
}
.cv-toast.ok { background: #047857; }
.cv-toast.err { background: #be123c; }
@keyframes cvIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------- Modal (image picker, SEO) ---------------- */
.cv-modal-back { position: fixed; inset: 0; background: rgba(11, 18, 32, .55); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cv-modal {
    background: #fff; color: #0f172a; border-radius: 18px; width: 100%; max-width: 920px; max-height: calc(100vh - 32px);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
    font: 400 14px/1.45 system-ui, -apple-system, sans-serif; text-align: left;
}
.cv-modal.sm { max-width: 520px; }
.cv-modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.cv-modal-h h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.cv-modal-x { background: none; border: 0; font-size: 26px; line-height: 1; color: #64748b; cursor: pointer; padding: 0 4px; }
.cv-modal-b { padding: 18px 20px; overflow-y: auto; flex: 1; }
.cv-modal-f { padding: 14px 20px; border-top: 1px solid #e2e8f0; display: flex; gap: 10px; justify-content: flex-end; align-items: center; background: #f8fafc; }
.cv-modal label { display: block; font-size: 13px; font-weight: 500; color: #334155; margin: 0 0 6px; }
.cv-modal input[type=text], .cv-modal input[type=search], .cv-modal input[type=url], .cv-modal textarea {
    width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; font: inherit; color: #0f172a; background: #fff;
}
.cv-modal input:focus, .cv-modal textarea:focus { outline: 2px solid #93b3fb; border-color: #3b6df3; }
.cv-modal .cv-help { font-size: 12px; color: #64748b; margin-top: 4px; }
.cv-btn {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 9px 16px; font: 500 14px/1 system-ui, sans-serif;
    border: 1px solid #cbd5e1; background: #fff; color: #0f172a; cursor: pointer;
}
.cv-btn:hover { background: #f1f5f9; }
.cv-btn.primary { background: #2b56e0; border-color: #2b56e0; color: #fff; }
.cv-btn.primary:hover { background: #2243c4; }
.cv-btn[disabled] { opacity: .5; cursor: not-allowed; }

.cv-drop {
    border: 2px dashed #cbd5e1; border-radius: 14px; padding: 22px; text-align: center; color: #475569; cursor: pointer;
    transition: border-color .15s, background .15s; background: #f8fafc;
}
.cv-drop:hover, .cv-drop.over { border-color: #3b6df3; background: #eff5ff; color: #2243c4; }
.cv-drop strong { color: #2b56e0; }
.cv-drop small { display: block; margin-top: 4px; color: #94a3b8; font-size: 12px; }
.cv-progress { height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin-top: 12px; }
.cv-progress > div { height: 100%; background: #2b56e0; width: 0; transition: width .15s; }

.cv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.cv-tile {
    position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f1f5f9 center/cover no-repeat;
    border: 2px solid transparent; cursor: pointer; padding: 0;
}
.cv-tile:hover { border-color: #93b3fb; }
.cv-tile.sel { border-color: #2b56e0; box-shadow: 0 0 0 3px rgba(43, 86, 224, .25); }
.cv-tile.sel::after {
    content: '✓'; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 99px; background: #2b56e0; color: #fff;
    font: 700 13px/22px system-ui; text-align: center;
}
.cv-empty { text-align: center; color: #64748b; padding: 30px 10px; }
.cv-row { display: flex; gap: 10px; align-items: center; }
.cv-row > input { flex: 1; }

/* ---------------- Admin helpers ---------------- */
.cv-admin .ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; border-color: #e2e8f0; background: #f8fafc; position: sticky; top: 64px; z-index: 5; }
.cv-admin .ql-container.ql-snow { border-radius: 0 0 12px 12px; border-color: #e2e8f0; font: inherit; font-size: 16px; }
.cv-admin .ql-editor { min-height: 380px; line-height: 1.7; padding: 20px 22px; }
.cv-admin .ql-editor h2 { font-size: 1.6em; margin: 1em 0 .4em; }
.cv-admin .ql-editor h3 { font-size: 1.3em; margin: 1em 0 .4em; }
.cv-admin .ql-editor img { border-radius: 10px; }
.cv-admin .ql-editor.ql-blank::before { font-style: normal; color: #94a3b8; }

.cv-media-input .cv-media-prev {
    width: 100%; aspect-ratio: 16/9; border-radius: 12px; background: #f1f5f9 center/cover no-repeat; border: 1px dashed #cbd5e1;
    display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 13px; cursor: pointer;
}
.cv-media-input.square .cv-media-prev { aspect-ratio: 1; max-width: 140px; background-size: contain; }
.cv-media-input.logo .cv-media-prev { aspect-ratio: 3/1; background-size: contain; background-color: #fff; }
.cv-media-input .cv-media-prev.has { border-style: solid; color: transparent; }

.sortable-ghost { opacity: .4; }
.cv-handle { cursor: grab; }

/* ---------------- Article body (blog posts + pages) ---------------- */
.cv-prose { font-size: 17px; line-height: 1.75; color: #334155; }
.cv-prose > * + * { margin-top: 1.1em; }
.cv-prose h2 { font-size: 1.75em; line-height: 1.2; font-weight: 600; color: #0f172a; margin-top: 1.8em; }
.cv-prose h3 { font-size: 1.35em; line-height: 1.3; font-weight: 600; color: #0f172a; margin-top: 1.6em; }
.cv-prose h4 { font-size: 1.1em; font-weight: 600; color: #0f172a; margin-top: 1.4em; }
.cv-prose a { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }
.cv-prose strong { color: #0f172a; font-weight: 600; }
.cv-prose ul { list-style: disc; padding-left: 1.4em; }
.cv-prose ol { list-style: decimal; padding-left: 1.4em; }
.cv-prose li + li { margin-top: .35em; }
.cv-prose blockquote { border-left: 3px solid var(--brand-500); padding: .2em 0 .2em 1.1em; color: #0f172a; font-size: 1.1em; font-style: italic; }
.cv-prose img { border-radius: 14px; max-width: 100%; height: auto; }
.cv-prose iframe { width: 100%; aspect-ratio: 16/9; height: auto; border-radius: 14px; border: 0; }
.cv-prose pre { background: #0f172a; color: #e2e8f0; padding: 1em 1.2em; border-radius: 12px; overflow-x: auto; font-size: .85em; }
.cv-prose code { background: #f1f5f9; padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.cv-prose pre code { background: none; padding: 0; }
.cv-prose hr { border: 0; border-top: 1px solid #e2e8f0; margin: 2em 0; }
.cv-prose .ql-align-center { text-align: center; }
.cv-prose .ql-align-right { text-align: right; }
.cv-prose .ql-align-justify { text-align: justify; }
.cv-prose table { width: 100%; border-collapse: collapse; font-size: .95em; }
.cv-prose th, .cv-prose td { border: 1px solid #e2e8f0; padding: .5em .7em; text-align: left; }
