/* LIMES PPTX Tool – Design
   Brand-Violett #5318D2, schwarze/violette Designsprache, helle Arbeitsfläche,
   serifenlose UI-Schrift. */

:root {
  --brand:        #5318D2;
  --brand-dark:   #3d129c;
  --brand-light:  #6d3ce0;
  --black:        #0d0d10;
  --ink:          #1a1a1f;
  --surface:      #f4f4f7;
  --card:         #ffffff;
  --line:         #e2e2ea;
  --muted:        #6b6b78;
  --ok:           #1f9d55;
  --warn:         #c9760b;
  --err:          #cc2936;
  --radius:       10px;
  --shadow:       0 2px 8px rgba(20, 12, 50, 0.08);
  --font: "Inter", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--black);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 2px solid var(--brand);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 3px;
  color: #fff;
}
.brand-mark::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: middle;
}
.brand-sub { color: #b9b9c6; font-size: 13px; letter-spacing: .5px; }
.topbar-actions { display: flex; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-light); }
.btn-ghost { background: transparent; color: #fff; border-color: #3a3a44; }
.btn-ghost:hover { background: #1d1d24; }
/* Sekundäre Buttons auf hellem Grund (Modals): im Ruhezustand klar sichtbar –
   dunkler Text auf Weiß mit sichtbarem Rahmen; Hover nur dezente Abhebung. */
.modal .btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.modal .btn-ghost:hover { background: var(--surface); border-color: var(--muted); }
.btn-outline { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: #f0ebff; }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 80px; align-self: start; }
.content { min-width: 0; }

/* ---------- Panels ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 20px;
}
.panel-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
  display: inline-block;
}
.hint { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
input[type="text"], input[type="number"], select, textarea {
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(83, 24, 210, 0.12);
}
input[readonly] { background: #f0ebff; color: var(--brand-dark); font-weight: 600; }
textarea { resize: vertical; min-height: 64px; }
input[type="file"] { font-size: 12px; padding: 6px 0; border: none; }

/* ---------- Images ---------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.image-card {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fafaff;
}
.image-card .field-label { margin-bottom: 6px; display: block; }
.image-thumb {
  margin-top: 8px;
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: none;
}
.image-thumb.show { display: block; }

/* ---------- Standort-Liste ---------- */
.standort-list { list-style: none; margin: 0 0 8px; padding: 0; max-height: 280px; overflow-y: auto; }
.standort-list li {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
  background: #fff;
  transition: background .12s, border-color .12s;
  word-break: break-all;
}
.standort-list li:hover { background: #f0ebff; border-color: var(--brand); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--black);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
  border-left: 4px solid var(--brand);
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok   { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.err  { border-left-color: var(--err); }

/* ---------- Overlay ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(13, 13, 16, 0.55);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; color: #fff; z-index: 70;
}
.spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(13, 13, 16, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 80; padding: 20px;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modal-card h2 { margin: 0 0 16px; font-size: 17px; color: var(--black); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-card-wide { max-width: 760px; max-height: 82vh; display: flex; flex-direction: column; }
.modal-card p { margin: 0; color: var(--ink); }

/* ---------- Info-Button (Topbar) ---------- */
/* Gleiche Höhe/Polsterung wie die anderen Topbar-Buttons (.btn),
   sekundärer Ghost-Stil wie "Speichern"/"Laden", runde Form (Durchmesser =
   Button-Höhe). */
.btn-icon {
  padding: 9px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid #3a3a44;
  background: transparent;
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-style: italic;
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn-icon:hover { background: #1d1d24; }
.btn-icon:active { transform: translateY(1px); }
.btn-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(83, 24, 210, 0.35);
}

/* ---------- Info-Maske: Feld-Legende ---------- */
.info-content { overflow-y: auto; padding-right: 6px; }
.info-section { margin-bottom: 18px; }
.info-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--brand);
  display: inline-block;
}
.info-note { font-size: 13px; line-height: 1.55; color: var(--ink); }
.info-note code {
  background: #f0ebff; color: var(--brand-dark);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 6px 18px;
}
.info-row { display: flex; align-items: baseline; gap: 10px; padding: 3px 0; }
.info-ph {
  flex: 0 0 auto;
  min-width: 96px;
  background: #f0ebff;
  color: var(--brand-dark);
  font-weight: 600;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
}
.info-label { font-size: 13px; color: var(--ink); }

/* ---------- Custom Vorlagen-Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--font); font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff; color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.dropdown-btn:hover { border-color: var(--brand-light); }
.dropdown.open .dropdown-btn {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(83, 24, 210, 0.12);
}
.dropdown-btn #templateDropdownLabel {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dropdown-caret { color: var(--brand); font-size: 12px; flex: 0 0 auto; }
.dropdown-list {
  list-style: none; margin: 4px 0 0; padding: 4px;
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: 260px; overflow-y: auto;
}
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .12s;
}
.dropdown-item:hover { background: #f0ebff; }
.dropdown-item.active { background: #f0ebff; }
.dropdown-item.active .dropdown-item-name { color: var(--brand-dark); font-weight: 600; }
.dropdown-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-del {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer;
  opacity: 0;                       /* nur beim Hover sichtbar */
  transition: opacity .12s, background .12s, color .12s;
}
.dropdown-item:hover .dropdown-del { opacity: 1; }
.dropdown-del:hover { background: var(--err); color: #fff; }
.dropdown-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }

.hidden { display: none !important; }
