/* =============================================================================
   BSN InfoDisplay 2026 — Basis-Stylesheet (Phase 2)
   Kein Build-Schritt, plain CSS. Wird später ggf. durch Tailwind-Build ersetzt.
   ============================================================================= */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e1e4e8;
  --text: #1f2328;
  --muted: #6a737d;
  --primary: #5e9820;
  --primary-hover: #4c7c1a;
  --brand-color: #8dc63f;
  --error-bg: #ffe9e9;
  --error-text: #a1211e;
  --success-bg: #e6f4ea;
  --success-text: #1a6c2e;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1.25rem;
  background: var(--surface);
  border-bottom: 3px solid var(--brand-color);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.topbar .brand:hover { text-decoration: none; }
.brand-logo { height: 28px; display: block; }
.brand-name { font-size: .9rem; color: var(--muted); font-weight: 500; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.topbar .user { color: var(--muted); font-size: .9rem; text-decoration: none; }
.topbar .user:hover { color: var(--text); text-decoration: underline; }
.topbar .inline { display: inline; margin: 0; }
.topbar .link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.topbar .link:hover { text-decoration: underline; }

.footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

/* ---------- Auth ---------- */
body.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.auth-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.3rem; }

/* ---------- Form ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; }
.form input[type=text],
.form input[type=password],
.form input[type=email] {
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
}
.form input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.btn {
  display: inline-block;
  padding: .55rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); }

/* ---------- Alerts ---------- */
.alert {
  padding: .6rem .8rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
}
.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
}

/* ---------- Cards ---------- */
.cards {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
}
.card a { color: var(--text); }
.card a:hover { color: var(--primary); text-decoration: none; }

/* ---------- Auth-Logo ---------- */
.auth-logo { text-align: center; margin-bottom: 1.25rem; }
.auth-logo img { height: 36px; width: auto; max-width: 100%; display: block; margin: 0 auto; }

/* ---------- Tabs ---------- */
.tabs {
  position: sticky;
  top: 2.75rem; /* Höhe der Topbar */
  z-index: 99;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  display: flex;
  gap: .25rem;
  overflow-x: auto;
}
.tab {
  padding: .8rem 1rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}
.table th, .table td {
  text-align: left;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th {
  background: #fafbfc;
  font-weight: 600;
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: .75rem; align-items: center; }
.table code { font-size: .85rem; background: #f3f3f3; padding: 1px 5px; border-radius: 3px; }

.row-warn { background: #fff8e7; }

/* ---------- Stats / Dashboard ---------- */
.stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 1rem 0 2rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 2rem; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.stat.warn .num { color: #c55300; }

/* ---------- Chips / Pills ---------- */
.chips { list-style: none; padding: 0; margin: .5rem 0 1.5rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .8rem;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-ok  { background: #def7e4; color: #0a7f2e; }
.badge-err { background: #ffe1e1; color: #a1211e; }
.badge-transition { background: #e8f0fb; color: #2b5cb8; font-size: .7rem; font-weight: 600;
                    padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }

/* ---------- Forms zusätzlich ---------- */
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.form fieldset legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.form textarea { padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.form select   { padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: #fff; }
.form .grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.inline-check  { display: flex; align-items: center; gap: .5rem; }
.inline-check input { margin: 0; }
.inline-form   { display: inline-flex; gap: .5rem; align-items: center; }
.inline-form input[type=text] { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); }
.actions { display: flex; gap: .75rem; align-items: center; }

.link.danger { color: var(--error-text); }

/* ---------- Row-Action-Buttons (Status-Toggle, Edit, Delete) ---------- */
.btn-status {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .28rem .75rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid;
  background: none;
  white-space: nowrap;
  line-height: 1.5;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.btn-status.is-on {
  background: #dafbe1;
  color: #116329;
  border-color: rgba(31,136,61,.35);
}
.btn-status.is-on:hover  { background: #c2ebb5; }
.btn-status.is-off {
  background: #f6f8fa;
  color: #57606a;
  border-color: rgba(0,0,0,.18);
}
.btn-status.is-off:hover { background: #eaeef2; }

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: .875rem;
}
.btn-link:hover { text-decoration: underline; }

.btn-sm {
  font: inherit;
  font-size: .82rem;
  padding: .25rem .6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f6f8fa;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background .15s, border-color .15s;
}
.btn-sm:hover { background: #eaeef2; border-color: #b0b8c4; }

.btn-sm-danger {
  background: none;
  border: 1px solid rgba(161,33,30,.25);
  border-radius: var(--radius);
  color: var(--error-text);
  cursor: pointer;
  font: inherit;
  font-size: .82rem;
  padding: .25rem .6rem;
  transition: background .15s, border-color .15s;
}
.btn-sm-danger:hover {
  background: #fff0f0;
  border-color: rgba(161,33,30,.6);
}

/* ---------- Transition Picker ---------- */
.tx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.tx-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, box-shadow .15s;
}
.tx-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.tx-card:hover:not(.is-selected) { border-color: #aab; }
.tx-demo {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a1a2e;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: .75rem;
}
.tx-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
}
.tx-slide-a { background: #1d4ed8; animation: tx-a 3s ease infinite; }
.tx-slide-b { background: #7c3aed; animation: tx-b 3s ease infinite; }

/* fade demo */
.tx-demo.demo-fade .tx-slide-a { animation: tx-fade-a 3s ease infinite; }
.tx-demo.demo-fade .tx-slide-b { animation: tx-fade-b 3s ease infinite; }
@keyframes tx-fade-a { 0%,40%{opacity:1} 50%,90%{opacity:0} 100%{opacity:1} }
@keyframes tx-fade-b { 0%,40%{opacity:0} 50%,90%{opacity:1} 100%{opacity:0} }

/* slide demo */
.tx-demo.demo-slide .tx-slide-a { animation: tx-slide-a 3s ease infinite; }
.tx-demo.demo-slide .tx-slide-b { animation: tx-slide-b 3s ease infinite; }
@keyframes tx-slide-a { 0%,40%{transform:translateX(0)} 50%,90%{transform:translateX(-100%)} 100%{transform:translateX(0)} }
@keyframes tx-slide-b { 0%,40%{transform:translateX(100%)} 50%,90%{transform:translateX(0)} 100%{transform:translateX(100%)} }

/* zoom demo */
.tx-demo.demo-zoom .tx-slide-a { animation: tx-zoom-a 3s ease infinite; }
.tx-demo.demo-zoom .tx-slide-b { animation: tx-zoom-b 3s ease infinite; }
@keyframes tx-zoom-a { 0%,40%{opacity:1;transform:scale(1)} 50%,90%{opacity:0;transform:scale(1.15)} 100%{opacity:1;transform:scale(1)} }
@keyframes tx-zoom-b { 0%,40%{opacity:0;transform:scale(.85)} 50%,90%{opacity:1;transform:scale(1)} 100%{opacity:0;transform:scale(.85)} }

/* cut demo */
.tx-demo.demo-cut .tx-slide-a { animation: tx-cut-a 3s step-end infinite; }
.tx-demo.demo-cut .tx-slide-b { animation: tx-cut-b 3s step-end infinite; }
@keyframes tx-cut-a { 0%,49%{opacity:1} 50%,100%{opacity:0} }
@keyframes tx-cut-b { 0%,49%{opacity:0} 50%,100%{opacity:1} }

/* Encoding Cleanup */
.encode-table td code { word-break: break-all; font-size: .8rem; }
.encode-diff { color: var(--primary); font-weight: 600; }

/* Rechte-Matrix */
.rights-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.rights-row h3 { margin: 0 0 .5rem; font-size: 1rem; }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .4rem;
  margin-bottom: .75rem;
}
.checkbox-grid label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }

.pager { display: flex; gap: 1rem; justify-content: center; padding: 1rem 0; }

/* ---------- Monitor-Grid ---------- */
.monitor-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  margin: 1rem 0;
}
.mon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mon-card.is-offline { border-color: #ffb4b4; }
.mon-thumb {
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mon-thumb img { width: 100%; height: 100%; object-fit: contain; }
.mon-noimg { color: #666; font-size: .85rem; }
.mon-meta { padding: 1rem 1.25rem; flex: 1; }
.mon-meta h3 {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.mon-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .15rem .75rem;
  margin: 0 0 1rem;
  font-size: .85rem;
}
.mon-meta dt { color: var(--muted); }
.mon-meta dd { margin: 0; }
.mon-metrics { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; }
.mon-metric-head { display: flex; justify-content: space-between; font-size: .78rem; margin-bottom: .15rem; color: var(--muted); }
.mon-metric-head span:last-child { font-weight: 600; color: var(--text); }
.mon-bar-bg { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.mon-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

.mon-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.mon-actions .btn { padding: .35rem .7rem; font-size: .85rem; }
.mon-card-link { color: inherit; transition: transform .15s, box-shadow .15s; }
.mon-card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.08); }

/* ---------- Editor ---------- */
.editor-header {
  padding: 1rem 1.25rem .5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.editor-header h1 { margin: 0; }

/* Object list with drag & drop */
.obj-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.obj-item {
  display: grid;
  grid-template-columns: auto 80px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  box-shadow: var(--shadow);
}
.obj-item.dragging { opacity: .4; }
.obj-item .grip { cursor: grab; color: #888; font-size: 1.3rem; user-select: none; }
.obj-item .thumb img { max-width: 80px; max-height: 60px; display: block; border-radius: 3px; }
.obj-item .thumb-ph {
  width: 80px; height: 60px;
  background: #f0f2f5;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; color: #888; letter-spacing: .05em;
}
.obj-item .meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.obj-item .meta small { font-size: .75rem; }
.obj-item .meta small.muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-item .row-actions { display: flex; gap: .75rem; }

/* Ticker preview */
.ticker-preview {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
  font-size: 1.1rem;
}

/* Test frame */
.test-frame {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin: 1rem 0;
}
.test-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Dialog */
dialog#editDialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
dialog::backdrop { background: rgba(0,0,0,.4); }
