/*
style.css — aufgeräumt & ausführlich kommentiert
Projekt: QA System (Test-Template-Lader, Runner & Exporter)
Firma: o-byte.com telekommunikation
Stand: 2025-09-01T17:35:27

Hinweis:
- Funktionen sind mit JSDoc kommentiert (Parameter/Return, Nebenwirkungen).
- Größere Codeabschnitte haben Abschnittsbanner.
- Keine funktionalen Änderungen, nur Kommentare & leichte Struktur.
*/

/* ===== Dark Theme (wie bei dir) ===== */
/* ===== Design-Tokens & Variablen ===== */
:root{
  --bg:#0b0c0f;
  --surface:#0f1117;
  --surface2:#12141a;
  --text:#e7e7ea;
  --muted:#a7a7b0;
  --stroke:#232633;
  --stroke2:#2a2d36;
  --accent:#00A7E6;

  --ok:#22c55e;      /* pass */
  --warn:#f59e0b;    /* blocked */
  --bad:#ef4444;     /* fail */
  --dim:#6b7280;     /* skip */
}

*{ box-sizing:border-box }
html,body{ margin:0; padding:0; background:var(--bg); color:var(--text); font-family:Inter, system-ui, Segoe UI, Roboto, Arial, sans-serif }
a{ color:#8ec7ff }

/* Header */
/* ===== Kopfbereich ===== */
header { display:flex; align-items:center; gap:12px; padding:12px 10px 8px 10px }
.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brand img{ height:28px; width:auto; max-width:220px; object-fit:contain; }
h1{ margin:0; font-size:22px; white-space:nowrap; }
.tag{
  display:inline-block; font-size:12px; line-height:1;
  padding:6px 8px; border:1px solid var(--stroke2); border-radius:999px;
  color:var(--muted); background:#12141a;
}

/* Panels / Layout */
.wrapper{ padding: 10px }
.panel{
  background:var(--surface);
  border:1px solid var(--stroke);
  border-radius:12px;
  padding:12px;
  margin-bottom:10px;
}

/* Meta-Form */
section.meta{
  display:grid; grid-template-columns: repeat(6, 1fr);
  gap:12px; margin-bottom:8px;
}
section.meta .row{ grid-column:1/-1; display:flex; gap:10px; align-items:center }
label.btn.like-label{
  display:inline-block; padding:8px 14px; border-radius:12px; cursor:pointer;
  background:var(--surface2); border:1px solid var(--stroke2); color:var(--text);
}
#yamlFile{ display:none }
section.meta label{ display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted) }
section.meta input{
  padding:10px 12px; border:1px solid var(--stroke2); border-radius:10px;
  background:var(--surface2); color:var(--text);
}

/* Buttons */
button,.btn{
  background:var(--surface2); border:1px solid var(--stroke2); color:var(--text);
  padding:10px 14px; border-radius:12px; cursor:pointer; transition:.15s; height:40px
}
button:hover,.btn:hover{ filter:brightness(1.1) }

/* Steps-Tabelle */
/* ===== Tabelle der Testschritte ===== */
#stepsTable { width:100%; border-collapse:separate; border-spacing:0 8px; table-layout: fixed; }
#stepsTable thead th{
  text-align:left; font-size:14px; color:#c7cfe1;
  padding:8px 10px; border-bottom:1px solid var(--stroke);
}
#stepsTable tbody tr{ background:var(--surface); border:1px solid var(--stroke2); border-radius:12px; }
#stepsTable td{ padding:10px; vertical-align:top; }

/* Gruppenzeile */
tr.group-row{
  background: linear-gradient(0deg, rgba(0,167,230,0.10), rgba(0,167,230,0.10));
  border:1px solid var(--stroke2);
  border-left:3px solid var(--accent);
}
tr.group-row .group-title{
  font-weight:700; letter-spacing:.2px;
}

/* Kleine Utilitys für Status-Buttons an Gruppen */
.group-row .group-actions{
  display:flex; gap:6px; align-items:center;
}
.group-row .btn-group-status{
  padding:4px 8px; font-size:12px; line-height:1;
}

/* Drag & Drop – visuelle Hinweise */
tr.dragging{
  opacity:.55;
}
tr.drag-over{
  outline:2px dashed var(--accent);
  outline-offset:-2px;
}
tr.drag-over[data-pos="before"]{
  box-shadow: 0 -3px 0 var(--accent) inset;
}
tr.drag-over[data-pos="after"]{
  box-shadow: 0 3px 0 var(--accent) inset;
}
/* Bessere Klick-Ziele für Header-Aktionen */
.group-row .step-head > div{
  display:flex; gap:6px; align-items:center;
}


/* Collapse: versteckte Step-Zeilen */
tr[data-hidden="1"]{ display:none; }
.group-row .btn-toggle-group{ margin-left:8px; }
.group-row .btn-toggle-group .chev{
  display:inline-block; transition:transform .15s ease;
}
.group-row[data-collapsed="1"] .btn-toggle-group .chev{
  transform: rotate(-90deg);
}

/* Beim Browser-Druck (nur Editor-Ansicht) – optional */
@media print{
  .group-row{ break-before: page; }
}

/* Spaltenbreiten */
#stepsTable th:nth-child(1), #stepsTable td:nth-child(1){ width:25%; }  /* Step + Titel */
#stepsTable th:nth-child(2), #stepsTable td:nth-child(2){ width:28%; }  /* Expected */
#stepsTable th:nth-child(3), #stepsTable td:nth-child(3){ width:5%; }  /* Status */
#stepsTable th:nth-child(4), #stepsTable td:nth-child(4){ width:26%; }  /* Kommentar/Evidenz */

/* Gruppe: Eingabefeld */
.tpl-group-title{
  width:100%; padding:10px 12px; border:1px solid var(--stroke2); border-radius:10px; background:var(--surface2); color:var(--text);
}

/* Eingabefelder */
#stepsTable input[type="text"], #stepsTable textarea, #stepsTable select{
  width:100%; max-width:100%; box-sizing:border-box;
  border:1px solid var(--stroke2); border-radius:10px;
  background:var(--surface2); color:var(--text); padding:10px; font-size:14px; outline:none;
}

/* Erste Spalte: ID | Titel | Pin | Löschen */
#stepsTable td.cell-step .step-head{
  display:grid; grid-template-columns:auto 1fr auto auto; gap:8px; align-items:center; margin-bottom:6px;
}
#stepsTable td.cell-step .tpl-id{ width:15ch }
#stepsTable td.cell-step .tpl-title{
  display:block; width:100%;
  min-height:40px;
  resize:vertical;
  overflow-wrap:break-word; word-break:break-word;
}
#stepsTable td.cell-step .req-pin{ opacity:.9 }
#stepsTable td.cell-step .btn-delete-step{
  width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; padding:0; margin:0; line-height:1;
}
#stepsTable td.cell-step .req-row{
  display:inline-flex; gap:6px; align-items:center; font-size:12px; color:var(--muted);
}

/* Expected */
#stepsTable .tpl-expected{ min-height:90px }

/* Status-Färbung für Select */
select.status.st-pass   { background:rgba(34,197,94,.12);  border-color:rgba(34,197,94,.25) }
select.status.st-fail   { background:rgba(239,68,68,.12);  border-color:rgba(239,68,68,.25) }
select.status.st-skip   { background:rgba(107,114,128,.12);border-color:rgba(107,114,128,.25) }
select.status.st-blocked{ background:rgba(245,158,11,.12); border-color:rgba(245,158,11,.25) }

/* Deutlichere Färbung für ganze Zeile */
tr.row-pass {
  background-color: rgba(34,197,94,0.18) !important;
  border-color: rgba(34,197,94,0.35) !important;
}
tr.row-fail {
  background-color: rgba(239,68,68,0.18) !important;
  border-color: rgba(239,68,68,0.35) !important;
}
tr.row-skip {
  background-color: rgba(107,114,128,0.18) !important;
  border-color: rgba(107,114,128,0.35) !important;
}
tr.row-blocked {
  background-color: rgba(245,158,11,0.18) !important;
  border-color: rgba(245,158,11,0.35) !important;
}

/* Footer Buttons */
.footer-actions{ display:flex; flex-wrap:wrap; gap:12px; margin-top:8px }

/* === Fix 1: Inputs im Dark-Theme ==================== */
#stepsTable td input,
#stepsTable td textarea,
#stepsTable td select {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--stroke2) !important;
  box-shadow: none !important;
}
#stepsTable ::placeholder { color: var(--muted); opacity: .9; }
#stepsTable input:-webkit-autofill,
#stepsTable textarea:-webkit-autofill,
#stepsTable select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0px 1000px var(--surface2) inset !important;
}

/* === Fix 2: Header spacing =============================== */
/* ===== Kopfbereich ===== */
header {
  padding-top: 14px !important;
  padding-bottom: 10px !important;
}
header .brand img { height: 28px; }
header h1 { margin-left: 2px; }

/* Meta-Panel Abstand */
section.meta { margin-bottom: 14px !important; }
section.meta label { line-height: 1.2; }

/* === Fix 3: Datei auswählen ============================ */
#yamlFile { display: none; }
label.like-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  background: var(--surface2);
  border: 1px solid var(--stroke2);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
label.like-label:hover { filter: brightness(1.08); }
#statusTag {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 8px;
  color: var(--muted);
}

/* === Fix 4: Kommentar/Evidenz Spalte ==================== */
#stepsTable td:nth-child(4) textarea.run-comment {
  min-height: 80px;
}
#stepsTable td:nth-child(4) .run-evidence {
  margin-top: 8px;
  height: 40px;
}

/* === Header Final Fix =================================== */
/* ===== Kopfbereich ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface1);
  border-bottom: 1px solid var(--stroke1);
}
header .brand { display: flex; align-items: center; gap: 10px; }
header .brand img { height: 32px; }
header .brand h1 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
header .actions { display: flex; align-items: center; gap: 10px; }
#statusTag {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--surface2);
  white-space: nowrap;
}


/* === Theming for GitLab dropdown === */
#gitlabTplSelect {
  /* System-Rendering neutralisieren, damit Farben greifen */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: var(--surface2, #1a1a1a);
  color: var(--text, #eaeaea);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 8px 10px;
  border-radius: 8px;
  outline: none;
}
#gitlabTplSelect:focus {
  border-color: var(--accent, #18a0fb);
  box-shadow: 0 0 0 2px rgba(24,160,251,0.25);
}

/* === Group row success/fail highlights === */
tr.group-row.group-ok { background: rgba(16,185,129,0.10); border-left: 4px solid #10b981; }
tr.group-row.group-fail { background: rgba(239,68,68,0.10); border-left: 4px solid #ef4444; }

/* Tag status helpers */
.tag.ok { background: rgba(16,185,129,0.15); color: #d1fae5; border-color: #10b981; }
.tag.bad { background: rgba(239,68,68,0.15); color: #fee2e2; border-color: #ef4444; }
.tag.warn { background: rgba(245,158,11,0.15); color: #ffedd5; border-color: #f59e0b; }


/* === Meta selects (ensures dark theming across engines) === */
section.meta select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: var(--surface2) !important;
  background-color: var(--surface2) !important;
  color: var(--text) !important;
  border: 1px solid var(--stroke2) !important;
  padding: 8px 10px;
  border-radius: 8px;
  outline: none;
}

/* Stronger group-row colors (more visible) */
tr.group-row.group-ok {
  background-color: rgba(34,197,94,0.12) !important;
  border-left: 4px solid #10b981 !important;
}
tr.group-row.group-fail {
  background-color: rgba(239,68,68,0.12) !important;
  border-left: 4px solid #ef4444 !important;
}

/* ===== Drag-Handle nur rechts am Rand ===== */
.drag-handle{
  justify-self:end;
  align-self:stretch;
  padding:0 8px;
  cursor:grab;
  user-select:none;
  display:flex;
  align-items:center;
  font-weight:700;
  letter-spacing:1px;
  opacity:.6;
}
.drag-handle:active{ cursor:grabbing; opacity:.9 }
tr.dragging{ opacity:.85 }

/* Step-Row: +1 Spalte für Handle */
#stepsTable td.cell-step .step-head{ grid-template-columns:auto 1fr auto auto auto; }

/* Group-Row: +1 Spalte für Handle */
.group-row .step-head{ display:grid; grid-template-columns:1fr auto auto; gap:8px; align-items:center; }
