/* =========================================================
   SlideForge – Design Tokens
   Konzept: "Backstage" – dunkle Bühnenatmosphäre, Karten wirken
   wie kleine beleuchtete Bühnen. Farbcode zeigt Berechtigung:
   Amber = Owner/Edit, Teal = View-only.
   ========================================================= */

:root {
  /* ---- Corporate Design (Farbvariationen.pdf/svg) ---- */
  --brand-blau: #3a6c8d;    /* Brilliant Blau */
  --brand-gruen: #87b42b;   /* Blümchen Grün */
  /* weitere Palette-Töne aus der Vorgabe, für spätere Hintergrund-Presets (Phase 3) */
  --brand-gold: #d1b633;
  --brand-braun: #85612d;
  --brand-hellblau: #94c2dc;
  --brand-graublau: #6a8aa1;
  --brand-terracotta: #d67d5d;
  --brand-beere: #862b6e;
  --brand-taupe: #917158;
  --brand-himmelblau: #61a8e0;
  --brand-limette: #97c764;
  --brand-dunkelgruen: #252e1b;
  --brand-rostrot: #64180b;
  --brand-hellgruen: #b7de45;
  --brand-indigo: #4449a5;

  --bg: #14171c;
  --surface: #1b1f27;
  --surface-raised: #232833;
  --border: #2c3240;
  --text: #edeae3;
  --text-muted: #8b92a3;
  --accent: var(--brand-blau);        /* Owner / Edit */
  --accent-dim: #2c5570;
  --accent-view: var(--brand-gruen);  /* View-only */
  --danger: #e8636f;

  /* Vorgabe: Open Sans für Überschriften, Myriad Pro für Fliesstext.
     Myriad Pro ist eine kostenpflichtige Adobe-Schrift und daher hier durch
     PT Sans ersetzt (freier, sehr ähnlicher Charakter) - bei vorhandener
     Adobe-Fonts-Lizenz einfach durch 'Myriad Pro' ersetzen. */
  --font-display: 'Open Sans', 'Segoe UI', sans-serif;
  --font-body: 'PT Sans', 'Myriad Pro', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

body {
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(58, 108, 141, 0.14), transparent 60%),
    radial-gradient(ellipse 700px 400px at 100% 0%, rgba(135, 180, 43, 0.10), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(58, 108, 141, 0.8);
}
.topbar-user {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.topbar-user a.button-ghost { margin-left: 4px; }

/* ---------- Buttons & Forms ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #f4f8fb;
  font-weight: 700;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.button:hover {
  box-shadow: 0 0 0 3px rgba(58, 108, 141, 0.35);
  text-decoration: none;
}
.button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-view);
  outline-offset: 2px;
}
.button-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.button-ghost:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }
.button-danger { background: var(--danger); color: #2a0a0d; }
.button-sm { padding: 6px 12px; font-size: 0.82rem; }

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
}
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.form-card {
  max-width: 400px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.form-card h1 { font-size: 1.4rem; }
.form-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }
.form-card .button { width: 100%; justify-content: center; margin-top: 22px; }
.form-card .switch { margin-top: 18px; font-size: 0.87rem; color: var(--text-muted); text-align: center; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  margin-top: 16px;
}
.alert-error { background: rgba(232,99,111,0.12); color: #ff9aa2; border: 1px solid rgba(232,99,111,0.3); }
.alert-success { background: rgba(79,195,161,0.12); color: var(--accent-view); border: 1px solid rgba(79,195,161,0.3); }

/* ---------- Dashboard ---------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 40px 0 16px;
}
.section-header h2 { font-size: 1.05rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.slide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.slide-card:hover { transform: translateY(-3px); border-color: var(--accent-dim); }

.slide-card .stage {
  aspect-ratio: 16 / 9;
  position: relative;
  background: linear-gradient(160deg, #20242c, #15181e);
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-card .stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, var(--spot-color, var(--accent)) 0%, transparent 55%);
  opacity: 0.18;
}
.slide-card .stage .initial {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--text-muted);
  opacity: 0.5;
  z-index: 1;
}
.slide-card .dims {
  position: absolute;
  bottom: 8px; right: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 4px;
}
.slide-card .badge {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(0,0,0,0.45);
  border: 1px solid var(--badge-color, var(--accent));
  color: var(--badge-color, var(--accent));
}
.slide-card .meta {
  padding: 14px 16px 16px;
}
.slide-card .title {
  font-weight: 600;
  font-size: 0.98rem;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slide-card .owner {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.slide-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Modal (Präsentation erstellen) ---------- */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10,11,14,0.7);
  align-items: center; justify-content: center;
  z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
}
.modal .row { display: flex; gap: 12px; }
.modal .row > div { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- Share-Seite ---------- */
.share-list {
  list-style: none; padding: 0; margin: 14px 0 0;
}
.share-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.perm-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
}
.perm-tag.edit { background: rgba(58, 108, 141, 0.18); color: var(--accent); }
.perm-tag.view { background: rgba(135, 180, 43, 0.18); color: var(--accent-view); }

.public-link-box {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.public-link-box input {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.inline-form { display: inline; }

.back-link { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Editor ---------- */
.editor-topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.editor-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.editor-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 140px;
  text-align: right;
}

.editor-layout {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  height: calc(100vh - 130px);
  min-height: 500px;
}

/* Linke Spalte: Werkzeuge / Hintergrund / Übergang */
.options-panel {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 14px;
}
.options-section { margin-bottom: 26px; }
.options-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.tool-btn-block {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  margin-bottom: 8px;
}
.tool-btn-block:hover { border-color: var(--accent); }
.toolbar-inline-block {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-muted);
}
.toolbar-inline-block input[type=color] {
  width: 44px; height: 30px; padding: 2px; border: 1px solid var(--border); background: var(--surface-raised); border-radius: 4px;
}

/* Folien-Tabs */
.slide-tabs-bar {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  overflow-x: auto;
}
.slide-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.slide-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 20px;
  padding: 5px 8px 5px 6px;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}
.slide-tab.active { border-color: var(--accent); background: var(--surface-raised); }
.slide-tab.dragging { opacity: 0.4; }
.slide-tab .tab-swatch {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2); flex-shrink: 0;
}
.slide-tab .tab-num {
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
}
.slide-tab.active .tab-num { color: var(--text); }
.slide-tab .tab-action {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.75rem; padding: 2px 4px; border-radius: 3px; line-height: 1;
}
.slide-tab .tab-action:hover { color: var(--text); background: var(--border); }
.tab-add {
  flex-shrink: 0;
  background: var(--surface-raised);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  width: 30px; height: 30px;
  cursor: pointer;
  font-size: 1rem;
}
.tab-add:hover { border-color: var(--accent); color: var(--accent); }

.canvas-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.canvas-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background:
    linear-gradient(45deg, #101318 25%, transparent 25%),
    linear-gradient(-45deg, #101318 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #101318 75%),
    linear-gradient(-45deg, transparent 75%, #101318 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #0c0e12;
}
.stage-wrap {
  position: relative;
  box-shadow: 0 0 0 1px var(--border), 0 12px 32px rgba(0,0,0,0.5);
}
.stage-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.stage-bg-layer video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
#stageContainer { position: relative; }

/* Hintergrund-Typ-Tabs */
.bg-type-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.bg-type-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 4px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.76rem;
}
.bg-type-btn.active { background: var(--surface); color: var(--text); }
.bg-panel .row { display: flex; gap: 8px; margin-bottom: 4px; }
.bg-panel .row > div { flex: 1; }
.bg-panel input[type=range] { width: 100%; }
.options-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 12px 0 6px;
}
.brand-palette {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.brand-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  padding: 0;
}
.brand-swatch:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

.bg-panel input[type=file] {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.bg-asset-preview { margin-top: 10px; }
.bg-asset-preview img, .bg-asset-preview video {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 8px;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
}

.props-panel {
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
}
.props-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
}
.props-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.props-section .row { display: flex; gap: 10px; }
.props-section .row > div { flex: 1; }
.props-section input[type=range] { width: 100%; }
.align-buttons { display: flex; gap: 6px; margin-top: 6px; margin-bottom: 4px; }
.align-btn {
  flex: 1; background: var(--surface-raised); border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 0; border-radius: 4px; cursor: pointer; font-size: 0.8rem;
}
.align-btn.active { border-color: var(--accent); color: var(--accent); }
.props-layer-actions { display: flex; gap: 8px; margin-top: 18px; }
.props-layer-actions .button { flex: 1; }
.mini-tabs { margin-bottom: 10px; }
.props-video-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; height: auto; }
  .options-panel, .props-panel { border: none; border-top: 1px solid var(--border); }
}
