/* YouTube-Video-Analyse GUI – Google-Stil (Material, light) */
:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --border: #dadce0;
  --border-soft: #e8eaed;
  --text: #202124;
  --text-2: #5f6368;
  --text-3: #80868b;
  --blue: #1a73e8;
  --blue-dark: #1765cc;
  --blue-soft: #e8f0fe;
  --ok: #188038;
  --ok-soft: #e6f4ea;
  --err: #d93025;
  --err-soft: #fce8e6;
  --warn: #b05e0c;
  --warn-soft: #fef7e0;
  --mono: "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }

/* ---------- Kopfzeile ---------- */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  height: 64px; padding: 0 24px;
  background: #fff; border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue-soft); color: var(--blue);
  display: flex; align-items: center; justify-content: center;
}
h1 { font-size: 18px; font-weight: 500; margin: 0; letter-spacing: -0.2px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  background: #f1f3f4; border-radius: 999px; padding: 5px 13px;
  transition: background .15s, color .15s;
}
.pill.running { color: var(--warn); background: var(--warn-soft); }
.pill.done { color: var(--ok); background: var(--ok-soft); }
.pill.error { color: var(--err); background: var(--err-soft); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-soft); background: #fff; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: #f1f3f4; color: var(--text); }

/* ---------- Layout ---------- */
main {
  display: grid; grid-template-columns: minmax(340px, 42%) 1fr;
  gap: 20px; padding: 20px 24px 48px; max-width: 1440px; margin: 0 auto;
}
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: 12px; box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  padding: 20px; margin-bottom: 20px;
}
.card h2 { font-size: 14px; font-weight: 600; color: var(--text-2); margin: 0 0 14px; }
.hint { color: var(--text-3); font-weight: 400; font-size: 12.5px; }

/* ---------- Formulare ---------- */
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin: 12px 0 6px; }
textarea, select, input[type="text"], input[type="password"] {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 12.5px; }
textarea:focus, select:focus, input[type="text"]:focus, input[type="password"]:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--text); font-weight: 400; }
.check input { accent-color: var(--blue); width: 15px; height: 15px; }
.check.inline { margin: 0; white-space: nowrap; font-size: 12.5px; color: var(--text-2); }
.btn-primary {
  margin-top: 16px; width: 100%;
  background: var(--blue); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 24px; font: 500 14px/1.4 inherit; font-family: inherit;
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3); }
.btn-primary:disabled { background: #d2e3fc; cursor: not-allowed; box-shadow: none; }
.btn-text {
  background: none; border: 0; color: var(--blue); border-radius: 6px;
  padding: 9px 18px; font: 500 14px/1.4 inherit; font-family: inherit; cursor: pointer;
}
.btn-text:hover { background: var(--blue-soft); }
.error { color: var(--err); margin: 10px 0 0; font-size: 13px; }

/* ---------- Log ---------- */
#log {
  margin: 0; background: #f8f9fa; border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 12px 14px; height: 320px; overflow-y: auto;
  font: 12.5px/1.6 var(--mono); color: #3c4043;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- Ergebnisse ---------- */
.result-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; background: #fff;
  transition: background .12s, border-color .12s;
}
.result-item:hover { background: #f8f9fa; border-color: var(--border); }
.ri-main { display: flex; flex-direction: column; min-width: 0; }
.ri-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-meta { font-size: 12px; color: var(--text-3); }
.ri-badge { font-size: 11.5px; color: var(--text-3); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.md h2, .md h3, .md h4 { margin: 18px 0 8px; font-weight: 500; }
.md h2 { font-size: 16px; border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; }
.md h3 { font-size: 15px; }
.md h4 { font-size: 14px; color: var(--blue); }
.md p { margin: 6px 0; }
.md ul { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { background: #f1f3f4; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; font-family: var(--mono); }
.ts { color: var(--blue); font-family: var(--mono); font-size: .9em; }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 10px 0; }
.frame { margin: 0; background: #fff; border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; }
.frame img { width: 100%; display: block; }
.frame figcaption { font-size: 11.5px; color: var(--text-2); padding: 8px 10px; }
.transcript { margin-top: 16px; }
.transcript summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 500; }
.tlines {
  margin-top: 8px; max-height: 400px; overflow-y: auto;
  background: #f8f9fa; border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 10px 12px;
}
.tline { font-size: 12.5px; padding: 2px 0; }

/* ---------- Einstellungen-Dialog (Modal) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(32, 33, 36, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px 16px;
}
.overlay[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 16px;
  width: min(720px, 100%); max-height: calc(100vh - 96px);
  display: flex; flex-direction: column;
  box-shadow: 0 12px 32px rgba(60, 64, 67, 0.35);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px 0;
}
.modal-head h2 { font-size: 18px; font-weight: 500; margin: 0; color: var(--text); }
.modal-body { padding: 10px 24px 24px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .btn-primary { width: auto; margin: 0; }
.sep { border: 0; border-top: 1px solid var(--border-soft); margin: 18px 0; }
.keyrow { display: flex; gap: 10px; align-items: center; }
.keyrow input {
  flex: 1; font-family: var(--mono); font-size: 12.5px;
}
.promptbox {
  margin-top: 14px; border: 1px solid var(--border-soft);
  border-radius: 8px; padding: 6px 14px 10px; background: #fafbfd;
}
.promptbox summary {
  cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 500;
  padding: 6px 0;
}
.promptbox .hint { margin-top: 8px; }
.prompt-grid { display: grid; gap: 14px; margin-top: 10px; }
.prompt-grid textarea { font-family: var(--mono); font-size: 12px; }
.linkbtn {
  background: none; border: 0; color: var(--blue);
  font-size: 12px; font-family: inherit;
  padding: 0; margin: 6px 0 0; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }
.hint.ok { color: var(--ok); }
code { font-family: var(--mono); font-size: .95em; background: #f1f3f4; padding: 1px 4px; border-radius: 3px; }
