/* ============================================================
   main.css — App-Oberfläche (Dashboard + Editor-Chrome)
   Marken-Tokens von prop-mind übernommen.
   ============================================================ */
:root {
  --bg: #f6f4ee;
  --surface: #fdfcfa;
  --tinted: #efede8;
  --border: #dbd9d5;
  --text: #14110c;
  --muted: #4d4d4d;
  --accent: #fa541c;
  --accent-hover: #db2b00;
  --radius: 10px;
  --header-h: 64px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: inherit; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 15px;
}
.brand small { color: var(--muted); font-weight: 500; font-size: 13px; }
.header-spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--tinted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--tinted); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-icon { padding: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Dashboard ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 20px 64px; }
.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -.5px; }
.hero p { color: var(--muted); font-size: 16px; margin: 0 auto; max-width: 620px; }

.create-row { display: flex; gap: 14px; justify-content: center; margin: 26px 0 40px; flex-wrap: wrap; }
.create-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; width: 260px; text-align: left; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.create-card:hover { transform: translateY(-3px); box-shadow: 0 6px 28px rgba(0,0,0,.1); }
.create-card .ico { font-size: 26px; }
.create-card h3 { margin: 10px 0 4px; font-size: 17px; }
.create-card p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.section-title { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 30px 0 14px; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px,1fr)); gap: 16px; }
.doc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.doc-thumb { height: 120px; background: var(--tinted); display: grid; place-items: center; color: var(--muted); border-bottom: 1px solid var(--border); position: relative; }
.doc-thumb .badge { position: absolute; top: 8px; left: 8px; background: var(--text); color:#fff; font-size: 11px; padding: 3px 8px; border-radius: 20px; }
.doc-body { padding: 12px 14px; }
.doc-body h4 { margin: 0 0 3px; font-size: 15px; }
.doc-body .meta { color: var(--muted); font-size: 12px; }
.doc-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.empty-state { text-align:center; color: var(--muted); padding: 40px; border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Editor Layout ---------- */
.editor-body { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - var(--header-h)); overflow: hidden; }
.panel { border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.panel-inner { padding: 18px 18px 60px; }
.preview-area { background: #e9e7e1; overflow-y: auto; padding: 28px; display: flex; justify-content: center; align-items: flex-start; }

/* Tabs im Editor */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); background: var(--surface); padding: 0 12px; position: sticky; top: 0; z-index: 5; }
.tab { padding: 12px 12px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* Formularfelder */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check-inline { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.check-inline input { width: auto; }

.subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 10px; display:flex; align-items:center; justify-content: space-between; }

/* Wiederholbare Einträge */
.item-card { border: 1px solid var(--border); border-radius: 9px; padding: 12px; margin-bottom: 10px; background: #fff; }
.item-card .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-card .item-head strong { font-size: 13px; }
.tag-add { width: 100%; border: 1px dashed var(--border); background: var(--tinted); color: var(--muted); border-radius: 8px; padding: 9px; font-weight: 600; font-size: 13px; }
.tag-add:hover { border-color: var(--accent); color: var(--accent); }

/* KI-Button (Platzhalter) */
.ai-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #e0c9ff; background: linear-gradient(90deg,#f5ecff,#eef2ff);
  color: #6d28d9; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 7px;
}
.ai-btn:hover { border-color: #c4a6ff; }
.ai-badge { font-size: 9px; background:#6d28d9; color:#fff; padding:1px 5px; border-radius: 20px; letter-spacing:.03em; }

/* Toolbar (Vorlage/Farbe/Export) */
.toolbar { display: flex; align-items: center; gap: 10px; }
.color-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.color-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.color-dot.active { box-shadow: 0 0 0 2px var(--accent); }

/* Template-Auswahl (Modal / Panel) */
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tpl-card { border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background:#fff; transition: border-color .12s, transform .12s; }
.tpl-card:hover { transform: translateY(-2px); }
.tpl-card.active { border-color: var(--accent); }
.tpl-preview { height: 150px; overflow: hidden; position: relative; background:#fff; }
.tpl-preview .mini { transform: scale(.34); transform-origin: top left; width: 210mm; pointer-events: none; }
.tpl-name { padding: 8px 10px; font-size: 12.5px; font-weight: 600; border-top: 1px solid var(--border); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 760px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display:flex; align-items:center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; max-height: 66vh; overflow-y: auto; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color:#fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ---------- Score-Strip ---------- */
.score-strip {
  position: sticky; bottom: 0; background: var(--surface);
  border-top: 1px solid var(--border); padding: 12px 16px 14px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.score-strip-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:7px; }
.score-track { height: 7px; background: #eee; border-radius: 10px; overflow:hidden; margin-bottom: 8px; }
.score-fill { height: 100%; border-radius: 10px; transition: width .4s ease, background .4s; width: 0%; }
.score-tips { list-style:none; margin:0; padding:0; }
.score-tips li { font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.score-tips li::before { content:"→ "; }

/* ---------- Phrase-Popover ---------- */
.phrase-popover {
  position: absolute; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); z-index: 20; overflow: hidden;
}
.popover-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 8px 12px 6px; border-bottom: 1px solid var(--border); }
.popover-item { padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border); line-height: 1.4; }
.popover-item:last-child { border-bottom: none; }
.popover-item:hover { background: var(--tinted); }

/* ---------- Phrase Chips (Skills / Interessen) ---------- */
.phrase-chips { display:flex; flex-wrap:wrap; gap:6px; margin: 6px 0 14px; }
.phrase-chip {
  display: inline-block; padding: 5px 10px; border-radius: 20px; font-size: 12px;
  background: var(--tinted); border: 1px solid var(--border); cursor: pointer; user-select:none;
}
.phrase-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Suggestion Button ---------- */
.sugg-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--muted); background: var(--tinted);
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; cursor: pointer; margin-left: 6px;
}
.sugg-btn:hover { background: var(--border); }

/* ---------- Sektion-Reihenfolge ---------- */
.section-order-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sec-order-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-size: 13px;
}
.sec-order-item.has-data { border-color: var(--accent); background: #fff8f5; }
.sec-count { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 20px; margin-left: 4px; }

/* ---------- Keyword-Modal Ergebnis ---------- */
.kw-section { margin-bottom: 14px; }
.kw-title { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kw-chip { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.kw-chip.missing { background: #fdeaea; color: #b91c1c; border: 1px solid #fca5a5; }
.kw-chip.found   { background: #e6f7f1; color: #166534; border: 1px solid #86efac; }

.export-item {
  display: block; width: 100%; text-align: left; padding: 11px 16px;
  font-size: 14px; font-weight: 500; background: none; border: none;
  color: var(--text); cursor: pointer; font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.export-item:last-child { border-bottom: none; }
.export-item:hover { background: var(--tinted); }

.doc-title-input { border:none; background: transparent; font-size: 15px; font-weight: 700; color: var(--text); padding: 6px 8px; border-radius: 7px; width: 220px; }
.doc-title-input:hover { background: var(--tinted); }
.doc-title-input:focus { outline: 2px solid var(--accent); background:#fff; }

@media (max-width: 860px) {
  .editor-body { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .panel { border-right: none; border-bottom: 1px solid var(--border); }
}
