/* =====================================================================
   Blog Automation – article editor + AI wizard additions (loaded last): language picker with flags (js/langs.js),
   length cards with credits, outline rows, editor that stays in view while the cards on the right scroll.
   ===================================================================== */

/* ---------- flags + language picker ---------- */
.flag { display: inline-block; flex: none; width: 20px; height: 14px; border-radius: 2px; overflow: hidden; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }
.flag svg { display: block; width: 100%; height: 100%; }
.flag-none { display: inline-flex; align-items: center; justify-content: center; font: 700 8px/1 var(--font); background: var(--surface-3); color: var(--text-2); }
.lang-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: var(--ctrl-h); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: var(--fs)/1.4 var(--font); text-align: left; cursor: pointer; }
.lang-btn .lang-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-btn > .ico:last-child { width: 16px; height: 16px; color: var(--text-3); transition: rotate .15s; }
.lang-btn[aria-expanded="true"] > .ico:last-child { rotate: 180deg; }
.lang-btn:hover:not(:disabled) { border-color: var(--text-3); }
.lang-btn:focus-visible, .lang-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); outline: none; }
.lang-btn:disabled { opacity: .6; cursor: not-allowed; }
.dd-langs > a { gap: 12px; }
.dd-menu > a[hidden] { display: none; }
.dd-search { position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; gap: 8px; margin: -6px -6px 4px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dd-search .ico { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.dd-search input { height: 32px; border: 0; padding: 0; background: transparent; box-shadow: none; font-size: var(--fs-sm); }
.dd-search input:focus { box-shadow: none; }

/* ---------- AI wizard: length cards with credits, "which AI" line ---------- */
.bp-lens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bp-len { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bp-len:hover { border-color: var(--text-3); }
.bp-len.active { border-color: var(--accent); background: var(--accent-50); box-shadow: inset 0 0 0 1px var(--accent); }
.bp-len:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bp-len-cr { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 8px; border-radius: 999px; background: var(--surface-3);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.bp-len-cr .ico { width: 12px; height: 12px; }
.bp-len.active .bp-len-cr { background: var(--accent); color: var(--accent-contrast); }
[data-mode="dark"] .bp-len.active { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.bp-aiwho { display: flex; align-items: center; gap: 8px; min-height: var(--ctrl-h); padding: 6px 12px; border-radius: var(--radius); background: var(--surface-3);
  color: var(--text-2); font-size: var(--fs-sm); line-height: 1.35; }
.bp-aiwho .ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
[data-mode="dark"] .bp-aiwho .ico { color: var(--text); }
@media (max-width: 600px) { .bp-lens { grid-template-columns: minmax(0, 1fr); } }

/* ---------- outline: section input and its remove button on one line ---------- */
.bp-outline .bp-ol-row { display: flex; align-items: center; gap: 6px; }
.bp-outline .bp-ol-row > input { flex: 1; width: auto; min-width: 0; height: 38px; }
.bp-outline .bp-ol-row > .btn { flex: none; color: var(--text-3); }
.bp-outline .bp-ol-row > .btn:hover { color: var(--err); background: var(--err-bg); }
.bp-outline li > .xs { margin: 4px 0 0 2px; }

/* ---------- editor: all cards on the right are open; the writing area on the left stays in view while they scroll ---------- */
@media (min-width: 901px) {
  .bp-side { position: static; }
  .bp-main { position: sticky; top: 72px; }
  .bp-main .bp-paper { display: flex; flex-direction: column; max-height: calc(100vh - 88px); }
  .bp-main .bp-paper > :not(.bp-quill) { flex-shrink: 0; }   /* only the text area may shrink – the title, AI bar and word count keep their height */
  .bp-main .bp-quill { flex: 1; min-height: 240px; display: flex; flex-direction: column; }
  .bp-main .bp-quill .ql-toolbar.ql-snow { position: static; }
  .bp-main .bp-quill .ql-container { flex: 1; min-height: 0; overflow-y: auto; }
  .bp-main .bp-quill .ql-editor { min-height: 100%; }
}

/* ---------- Settings → KI: own AI key ---------- */
.c-keyform { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.c-keyform .b-pw { flex: 1 1 280px; }

/* ---------- automation editor: website time zone vs. the person's ---------- */
.b-tzbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 2px 0 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-3); font-size: var(--fs-sm); color: var(--text-2); }
.b-tzbar > span { flex: 1 1 260px; }
.b-tzbar.warn { background: var(--warn-bg); color: var(--text); }
.b-tzbar .ico { flex: none; }

/* ---------- address search (js/address.js): suggestion list under the street field ---------- */
.adr-wrap { position: relative; }
.adr-list { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; animation: dd-in .12s ease-out; }
.adr-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.adr-opt .ico { width: 16px; height: 16px; margin-top: 2px; flex: none; color: var(--text-3); }
.adr-opt b { display: block; font-weight: 600; font-size: var(--fs-sm); }
.adr-opt small { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.adr-opt:hover, .adr-opt.on { background: var(--surface-3); }
.adr-opt.on .ico, .adr-opt:hover .ico { color: var(--accent); }
[data-mode="dark"] .adr-opt.on .ico, [data-mode="dark"] .adr-opt:hover .ico { color: var(--text); }
.adr-foot { padding: 6px 10px 2px; border-top: 1px solid var(--border); margin-top: 4px; font-size: 11px; color: var(--text-3); }
