/* Insta-Overlay — gemeinsame Styles für Overlay (OBS) und Einrichtung. */

:root {
  color-scheme: dark;
  --u: 1px; /* wird im Overlay auf (Höhe / 1080) gesetzt */
  --color-primary: #feda75;
  --color-secondary: #e1306c;
  --ig-gradient: linear-gradient(45deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
  --color-text: #ffffff;
  --color-text-dim: rgba(255, 255, 255, 0.65);
  --color-bg-panel: rgba(22, 19, 32, 0.85);
  --color-success: #2ecc71;
  --color-warn: #f5b942;
  --color-danger: #ff4d6d;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-ui: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  color: var(--color-text);
}

/* ================= Overlay (OBS Browser-Quelle) ================= */

body.overlay-body {
  background: transparent;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.ig-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ig-slot {
  position: absolute;
  inset: 0;
  display: flex;
  padding: calc(var(--u) * 48);
}
.ig-slot.pos-center       { align-items: center;     justify-content: center; }
.ig-slot.pos-right        { align-items: center;     justify-content: flex-end; }
.ig-slot.pos-left         { align-items: center;     justify-content: flex-start; }
.ig-slot.pos-top-right    { align-items: flex-start; justify-content: flex-end; }
.ig-slot.pos-top-left     { align-items: flex-start; justify-content: flex-start; }
.ig-slot.pos-bottom-right { align-items: flex-end;   justify-content: flex-end; }
.ig-slot.pos-bottom-left  { align-items: flex-end;   justify-content: flex-start; }

.ig-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--u) * 26);
  overflow: hidden;
  will-change: transform, opacity;
}

.ig-head {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 14);
  padding: calc(var(--u) * 16) calc(var(--u) * 20);
  font-size: calc(var(--u) * 28);
  font-weight: 700;
  white-space: nowrap;
}
.ig-avatar {
  flex: 0 0 auto;
  width: calc(var(--u) * 50);
  height: calc(var(--u) * 50);
  border-radius: 50%;
  background: var(--ig-gradient);
  display: grid;
  place-items: center;
  color: #fff;
}
.ig-avatar svg { width: 60%; height: 60%; }
.ig-user { overflow: hidden; text-overflow: ellipsis; }

.ig-media { position: relative; line-height: 0; }
.ig-img { display: block; object-fit: cover; }
.ig-badge {
  position: absolute;
  top: calc(var(--u) * 14);
  right: calc(var(--u) * 14);
  z-index: 1;
  line-height: 1;
  font-size: calc(var(--u) * 22);
  font-weight: 700;
  padding: calc(var(--u) * 8) calc(var(--u) * 14);
  border-radius: calc(var(--u) * 30);
  background: rgba(0, 0, 0, .6);
  color: #fff;
}

.ig-foot {
  padding: calc(var(--u) * 14) calc(var(--u) * 20) calc(var(--u) * 18);
  font-size: calc(var(--u) * 24);
  line-height: 1.3;
}
.ig-cta { font-size: calc(var(--u) * 19); opacity: .7; margin-top: calc(var(--u) * 4); }

.ig-progress { height: calc(var(--u) * 7); }
.ig-progress i {
  display: block;
  height: 100%;
  background: var(--ig-gradient);
  transform-origin: 0 50%;
}

/* Stil 1: Instagram — weiße Karte mit Farbverlauf-Rahmen */
.ig-card.style-insta {
  color: #1c1c1e;
  background: linear-gradient(#fff, #fff) padding-box, var(--ig-gradient) border-box;
  border: calc(var(--u) * 6) solid transparent;
  box-shadow: 0 calc(var(--u) * 18) calc(var(--u) * 50) rgba(0, 0, 0, .45);
}
.ig-card.style-insta .ig-by b { color: #d62976; }

/* Stil 2: Polaroid — leicht schräg, breiter weißer Rand */
.ig-card.style-polaroid {
  background: #fbfaf6;
  color: #222;
  border-radius: calc(var(--u) * 6);
  padding: calc(var(--u) * 20) calc(var(--u) * 20) 0;
  transform: rotate(-2.5deg);
  box-shadow: 0 calc(var(--u) * 20) calc(var(--u) * 45) rgba(0, 0, 0, .5);
}
.ig-card.style-polaroid .ig-head { padding: 0 0 calc(var(--u) * 14); }
.ig-card.style-polaroid .ig-foot { padding: calc(var(--u) * 18) calc(var(--u) * 4) calc(var(--u) * 26); text-align: center; }
.ig-card.style-polaroid .ig-progress { margin: 0 calc(var(--u) * -20); }

/* Stil 3: Dunkel — passt zu dunklen Szenen */
.ig-card.style-dark {
  background: rgba(18, 16, 26, .92);
  color: #fff;
  border: calc(var(--u) * 2) solid rgba(255, 255, 255, .14);
  box-shadow: 0 calc(var(--u) * 18) calc(var(--u) * 50) rgba(0, 0, 0, .55);
}
.ig-card.style-dark .ig-by b { color: #feda75; }

/* Einblenden: kommt von der Seite, auf der es steht (Mitte: ploppt auf) */
.ig-slot.enter .ig-card { animation: ig-in-right .7s cubic-bezier(.2, .9, .3, 1.15) both; }
.ig-slot.pos-left.enter .ig-card,
.ig-slot.pos-top-left.enter .ig-card,
.ig-slot.pos-bottom-left.enter .ig-card { animation-name: ig-in-left; }
.ig-slot.pos-center.enter .ig-card { animation-name: ig-in-pop; }
.ig-slot.enter .ig-card.style-polaroid { animation-name: ig-in-polaroid; }

.ig-slot.leave .ig-card { animation: ig-out-right .6s cubic-bezier(.5, 0, .8, .4) forwards; }
.ig-slot.pos-left.leave .ig-card,
.ig-slot.pos-top-left.leave .ig-card,
.ig-slot.pos-bottom-left.leave .ig-card { animation-name: ig-out-left; }
.ig-slot.pos-center.leave .ig-card,
.ig-slot.leave .ig-card.style-polaroid { animation-name: ig-out-fade; }

@keyframes ig-in-right { from { opacity: 0; transform: translateX(60%) rotate(6deg); } to { opacity: 1; transform: none; } }
@keyframes ig-in-left  { from { opacity: 0; transform: translateX(-60%) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes ig-in-pop   { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes ig-in-polaroid {
  from { opacity: 0; transform: translateY(40%) rotate(8deg) scale(.9); }
  to   { opacity: 1; transform: rotate(-2.5deg); }
}
@keyframes ig-out-right { to { opacity: 0; transform: translateX(70%) rotate(8deg); } }
@keyframes ig-out-left  { to { opacity: 0; transform: translateX(-70%) rotate(-8deg); } }
@keyframes ig-out-fade  { to { opacity: 0; transform: translateY(8%) scale(.92); } }

/* ================= Einrichtung ================= */

body.dashboard-body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #2e1f3d 0%, #0c0a14 65%);
  padding: 24px;
}

.dashboard-shell { max-width: 1080px; margin: 0 auto; }
.dashboard-shell h1 { font-size: 26px; margin: 0 0 4px; }
.subtitle { color: var(--color-text-dim); margin: 0 0 20px; }

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  background: var(--color-bg-panel);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 18px;
  font-size: 13px;
}
.statusbar .dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-danger);
  margin-right: 6px;
  vertical-align: -1px;
}
.statusbar .dot.ok { background: var(--color-success); }
.statusbar .dot.warn { background: var(--color-warn); }
.statusbar code { user-select: all; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn { background: rgba(255, 255, 255, .06); color: var(--color-text-dim); }
.tab-btn.active { background: var(--ig-gradient); color: #fff; }
.tab-btn .count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 10px;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
}
.tab-btn .count:empty { display: none; }
.tab-panel[hidden] { display: none; }

.card {
  background: var(--color-bg-panel);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 18px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; color: #ff8fb1; }

.field-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 160px; }
.field.narrow { flex: 0 0 130px; min-width: 110px; }
.field label { font-size: 12px; color: var(--color-text-dim); }
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="url"],
.field select {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 14px;
}
select option { background: #1b1726; color: #fff; }
.field input[type="range"] { width: 100%; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field.checkbox label { font-size: 14px; color: var(--color-text); }

button {
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text);
  transition: transform .1s ease, opacity .2s ease, background .2s;
}
button:active { transform: scale(.97); }
button.primary { background: var(--ig-gradient); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
button.secondary { background: rgba(255, 255, 255, .1); }
button.secondary:hover { background: rgba(255, 255, 255, .16); }
button.ok { background: rgba(46, 204, 113, .22); color: #b6f5cf; }
button.ok:hover { background: rgba(46, 204, 113, .35); }
button.danger { background: rgba(255, 77, 109, .18); color: #ffb3c1; }
button.danger:hover { background: rgba(255, 77, 109, .3); }
button.small { padding: 6px 10px; font-size: 12px; }
button:disabled { opacity: .4; cursor: not-allowed; }

.button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hint { font-size: 12px; color: var(--color-text-dim); margin: 4px 0 0; line-height: 1.5; }
.hint code, .card code { background: rgba(255, 255, 255, .08); padding: 1px 5px; border-radius: 4px; }
.save-status { font-size: 13px; }
.save-status.ok { color: var(--color-success); }
.save-status.err { color: var(--color-danger); }

/* Warteschlange */
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-list .empty { color: var(--color-text-dim); font-size: 13px; }
.post {
  display: flex;
  gap: 14px;
  align-items: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  padding: 10px;
}
.post.pending { border-color: rgba(245, 185, 66, .45); }
.post .thumb {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #221f30;
  cursor: zoom-in;
}
.post.big .thumb { width: 170px; height: 170px; }
.post .info { flex: 1; min-width: 0; font-size: 14px; line-height: 1.5; }
.post .info .ig { font-weight: 700; }
.post .info .meta { color: var(--color-text-dim); font-size: 12px; }
.post .info a { color: #9fd8ff; }
.post .actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 300px; }
.post .tag { font-size: 11px; padding: 1px 7px; border-radius: 8px; background: rgba(255, 255, 255, .1); margin-left: 6px; }
.post .tag.warn { background: rgba(245, 185, 66, .25); color: #ffe2a6; }
.post .tag.bad { background: rgba(255, 77, 109, .25); color: #ffb3c1; }
@media (max-width: 640px) {
  .post { flex-wrap: wrap; }
  .post .actions { max-width: none; justify-content: flex-start; }
}

.live-box { display: flex; align-items: center; gap: 14px; }
.live-box .bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; margin-top: 8px; }
.live-box .bar i { display: block; height: 100%; background: var(--ig-gradient); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 4, 10, .85);
  display: grid;
  place-items: center;
  padding: 30px;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius-md); }

/* Ereignis-Log */
.diag-list { font-family: Consolas, monospace; font-size: 12px; max-height: 320px; overflow-y: auto; }
.diag-list .row { padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.diag-list .row .t { color: var(--color-text-dim); margin-right: 8px; }
.diag-list .row.show .k,
.diag-list .row.queue .k { color: var(--color-success); }
.diag-list .row.ignored .k { color: var(--color-warn); }
.diag-list .row.error .k { color: var(--color-danger); }

.preview-frame-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(135deg, #2b5876, #4e4376);
  aspect-ratio: 16 / 9;
  position: relative;
}
.preview-frame-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 1920px; height: 1080px;
  border: none;
  transform-origin: 0 0;
}
