/* ============================================================
   EDITOR – Canvas-Editor Layout
   ============================================================ */

.editor-topbar {
  justify-content: space-between;
}

.editor-name-input {
  border: none;
  background: transparent;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink-900);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  min-width: 200px;
}

.editor-name-input:focus {
  outline: none;
  background-color: var(--petrol-50);
}

.editor-shell {
  display: flex;
  height: calc(100vh - 64px);
  overflow: hidden;
}

/* ============================================================
   GAST-LAYOUT (kein Login, kein .admin-shell/.admin-main mit
   bekannter Sidebar-Höhe). Die öffentliche Nav hat eine andere,
   nicht fest bekannte Höhe als die 64px, von denen .editor-shell
   oben ausgeht – deshalb hier alles (Nav + Topbar + Leinwand) in
   EINE Flex-Spalte packen und die Resthöhe dynamisch verteilen,
   statt mit einem hardcoded vh-Wert zu rechnen. Nur relevant,
   wenn dieser Wrapper tatsächlich im DOM ist (siehe editor.php,
   $is_guest_layout) – für eingeloggte Nutzer inaktiv, weil das
   .editor-guest-shell-Element dann gar nicht existiert.
   ============================================================ */

.editor-guest-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.editor-guest-shell .editor-topbar {
  flex-shrink: 0;
}

.editor-guest-shell .editor-shell {
  flex: 1;
  height: auto; /* überschreibt die calc(100vh - 64px)-Annahme oben, NUR innerhalb dieses Wrappers */
  min-height: 0; /* verhindert, dass Flex-Kinder die Höhe ihres Inhalts erzwingen statt zu schrumpfen */
}

.editor-toolbar {
  width: 64px;
  flex-shrink: 0;
  background-color: #fff;
  border-right: 1px solid var(--ink-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  gap: 6px;
}

.editor-tool {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--ink-600);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.editor-tool:hover {
  background-color: var(--petrol-50);
  color: var(--petrol-800);
}

.editor-tool.active {
  background-color: var(--petrol-700);
  color: #fff;
}

.editor-tool:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ============================================================
   GESPERRTES TOOL (Gast) – z.B. Bild-Upload
   Button bleibt klickbar (öffnet Registrierungs-Hinweis statt
   der eigentlichen Funktion), bekommt aber ein kleines Schloss-
   Badge als visuellen Hinweis.
   ============================================================ */

/* ============================================================
   HINT-BADGE – einheitliche kleine Kreis-Badge oben rechts am
   Button, überall wo ein Login/Profil erwartet wird (Bild-Upload,
   PNG/PDF-Export). Immer dasselbe Schloss-Icon, gleiche Form/
   Farbe/Größe – ein Signal für "hier ist ein Profil im Spiel".
   ============================================================ */

.editor-hint-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--sand-500);
  border: 2px solid #fff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(22,38,36,0.25);
}

.editor-tool--locked {
  position: relative;
  color: var(--ink-400);
}

.editor-tool--locked:hover {
  background-color: var(--sand-50);
  color: var(--sand-700);
}

.editor-tool-divider {
  width: 32px;
  height: 1px;
  background-color: var(--ink-100);
  margin: 4px 0;
}



/* ============================================================
   TOOLTIPS im Editor – schmaler & in Markenfarbe statt
   Bootstrap-Standard-Schwarz mit voller Satzbreite.
   Global (nicht auf .editor-toolbar gescoped), da Bootstrap
   Tooltips standardmäßig an <body> anhängt, nicht an den
   Trigger-Container. editor.css lädt ohnehin nur auf editor.php.
   ============================================================ */

.tooltip .tooltip-inner {
  max-width: 180px !important;
  white-space: normal !important;
  background-color: var(--petrol-900);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
  border-right-color: var(--petrol-900);
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
  border-left-color: var(--petrol-900);
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: var(--petrol-900);
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: var(--petrol-900);
}

.editor-canvas-area {
  flex: 1;
  overflow: auto;
  background-color: #e8eaea;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px;
}

#canvas-container {
  background-color: #fff;
  box-shadow: var(--shadow-lift);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-properties {
  width: 260px;
  flex-shrink: 0;
  background-color: #fff;
  border-left: 1px solid var(--ink-100);
  padding: 20px;
  overflow-y: auto;
}

.editor-properties__empty {
  color: var(--ink-400);
  font-size: 0.8125rem;
  text-align: center;
  margin-top: 40px;
}

.editor-prop-group {
  margin-bottom: 18px;
}

.editor-prop-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-500);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.editor-prop-input {
  width: 100%;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.875rem;
}

textarea.editor-prop-input {
  resize: vertical;
}

.editor-prop-color {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
}

.editor-prop-color:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.editor-prop-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-700);
  cursor: pointer;
}

.editor-prop-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--petrol-700);
  cursor: pointer;
}

.editor-sticker-picker {
  position: fixed;
  left: 72px;
  top: 100px;
  width: 460px;
  background-color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 16px;
  z-index: 500;
}

.editor-sticker-picker__search {
  width: 100%;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.875rem;
  margin-bottom: 10px;
}

.editor-sticker-picker__search:focus {
  outline: none;
  border-color: var(--petrol-500);
}

.editor-sticker-picker__tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 4px;
}

.editor-sticker-picker__tab {
  flex-shrink: 0;
  border: none;
  background-color: var(--ink-50);
  color: var(--ink-600);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
}

.editor-sticker-picker__tab:hover {
  background-color: var(--petrol-50);
}

.editor-sticker-picker__tab.active {
  background-color: var(--petrol-700);
  color: #fff;
}

.editor-sticker-picker__grid {
  display: grid;
  /* auto-fill statt fester Spaltenzahl: 11 Spalten a 36px + 10 Luecken
     a 4px ergaben 436px, das Panel bietet aber nur 428px (460px minus
     2x16px Innenabstand) - die 8px Differenz erzeugten eine waagerechte
     Scrollleiste. Die Spaltenzahl richtet sich jetzt nach dem
     verfuegbaren Platz, damit passt es auch, wenn sich die Panelbreite
     mal aendert. */
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
}

.editor-sticker-picker__item {
  /* Feste Breite ergab zusammen mit 1fr-Spalten einen Widerspruch:
     das Raster rechnet mit flexiblen Spalten, die Kachel bestand auf
     36px. Die Kachel fuellt jetzt ihre Spalte, die Mindestbreite steckt
     oben in minmax(). */
  width: 100%;
  min-width: 0;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-sticker-picker__item:hover {
  background-color: var(--petrol-50);
}

@media (max-width: 900px) {
  .editor-toolbar {
    width: 56px;
  }
  .editor-properties {
    width: 220px;
  }
  .editor-name-input {
    min-width: 100px;
  }
}


/* ============================================================
   ERWEITERTE EDITOR-FEATURES
   ============================================================ */

/* Schriftarten-Dropdown: Vorschau in eigener Schrift */
#prop-font-family option {
  padding: 6px;
}

.editor-format-select {
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-700);
  background-color: #fff;
  cursor: pointer;
}

.editor-format-select:focus {
  outline: none;
  border-color: var(--petrol-500);
}


/* ============================================================
   EBENEN-PANEL (ausklappbar wie Photoshop)
   ============================================================ */

.editor-layers-panel {
  width: 0;
  flex-shrink: 0;
  background-color: #fff;
  border-right: 1px solid var(--ink-100);
  overflow: hidden;
  transition: width 0.2s ease;
}

.editor-layers-panel.open {
  width: 240px;
}

.editor-layers-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-100);
  font-weight: 800;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.editor-layers-panel__close {
  border: none;
  background: transparent;
  color: var(--ink-400);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.editor-layers-panel__close:hover {
  background-color: var(--ink-50);
  color: var(--ink-900);
}

.editor-layers-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
}

.editor-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--ink-700);
  white-space: nowrap;
  user-select: none;
  margin-bottom: 2px;
}

.editor-layer-item:hover {
  background-color: var(--petrol-50);
}

.editor-layer-item.selected {
  background-color: var(--petrol-700);
  color: #fff;
}

.editor-layer-item__icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.editor-layer-item__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ============================================================
   EIGENES TOOLTIP-DESIGN (überschreibt Bootstrap)
   ============================================================ */

.tooltip {
  opacity: 1 !important;
}

.tooltip.show {
  opacity: 1 !important;
}

.tooltip .tooltip-inner {
  position: relative;
  z-index: 1;
  background-color: var(--ink-800);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  max-width: 220px;
  white-space: nowrap;
}

.tooltip .tooltip-arrow {
  width: 12px;
  height: 12px;
  z-index: 0;
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
  border-right-color: var(--ink-800);
  border-width: 0.4rem 0.4rem 0.4rem 0;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
  border-left-color: var(--ink-800);
  border-width: 0.4rem 0 0.4rem 0.4rem;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: var(--ink-800);
  border-width: 0.4rem 0.4rem 0;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: var(--ink-800);
  border-width: 0 0.4rem 0.4rem;
}


/* ============================================================
   EIGENER FARBWÄHLER (ersetzt native <input type="color">)
   Läuft komplett innerhalb der Seite statt als OS-Dialog außerhalb
   des Browsers.
   ============================================================ */

.editor-prop-color {
  display: block;
}

.color-popover {
  position: fixed;
  width: 220px;
  background-color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 14px;
  z-index: 600;
}

.color-popover__sv {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-sm);
  background-color: #ff0000;
  background-image:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
  cursor: crosshair;
  margin-bottom: 12px;
  touch-action: none;
  user-select: none;
}

.color-popover__sv-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35), var(--shadow-card);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.color-popover__hue {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  background: linear-gradient(to right,
    #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  cursor: pointer;
}

.color-popover__hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #fff;
  border: 2px solid var(--ink-900);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.color-popover__hue::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #fff;
  border: 2px solid var(--ink-900);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.color-popover__bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.color-popover__preview {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ink-200);
  flex-shrink: 0;
}

.color-popover__hex {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: lowercase;
}

.color-popover__hex:focus {
  outline: none;
  border-color: var(--petrol-500);
}

.color-popover__swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.color-popover__swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid var(--ink-200);
  cursor: pointer;
  padding: 0;
}

.color-popover__swatch:hover {
  border-color: var(--petrol-500);
  transform: scale(1.08);
}

/* ============================================================
   EBENEN PER DRAG & DROP NEU ANORDNEN (Figma-Style)
   ============================================================ */

.editor-layer-item {
  position: relative;
  cursor: grab;
}

.editor-layer-item__grip {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  color: var(--ink-300);
  font-size: 0.8125rem;
  cursor: grab;
}

.editor-layer-item:hover .editor-layer-item__grip {
  color: var(--ink-500);
}

.editor-layer-item.selected .editor-layer-item__grip {
  color: rgba(255, 255, 255, 0.7);
}

.editor-layer-item--dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.editor-layer-item--drop-above::before,
.editor-layer-item--drop-below::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: var(--radius-full);
  background-color: var(--petrol-500);
}

.editor-layer-item--drop-above::before {
  top: 0;
}

.editor-layer-item--drop-below::after {
  bottom: 0;
}


/* ============================================================
   PUNKTRASTER-HINTERGRUND FÜR DAS BOARD
   Feines Dot-Grid wie im Screenshot – als Modifier-Klasse, damit
   der Standard-Hintergrund von #canvas-container (weiß) unberührt
   bleibt. Klasse ".canvas-bg-dots" auf #canvas-container bzw. das
   jeweilige Board-Element setzen, um das Punktraster einzuschalten.
   ============================================================ */

.canvas-bg-dots {
  background-color: var(--cream);
  background-image: radial-gradient(circle, var(--ink-200) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: 0 0;
}


/* ============================================================
   NEU: ZOOM-STAGE-WRAPPER (editor-zoom.js)
   Bekommt beim Zoomen die echte (Layout-)Größe per JS gesetzt,
   damit .editor-canvas-area zuverlässig scrollen/pannen kann.
   ============================================================ */

.zoom-stage-wrapper {
  flex-shrink: 0;
  position: relative;
}


/* ============================================================
   NEU: ZOOM-LEISTE (editor-zoom.js)
   Eigenständiges Modul – wird per JS an document.body angehängt,
   position:fixed, horizontale Position wird per JS berechnet.
   ============================================================ */

.zoom-bar {
  position: fixed;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: #fff;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lift);
  padding: 6px;
  z-index: 300;
}

.zoom-bar__btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  color: var(--ink-600);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.zoom-bar__btn:hover {
  background-color: var(--petrol-50);
  color: var(--petrol-800);
}

.zoom-bar__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.zoom-bar__value {
  min-width: 52px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  color: var(--ink-700);
  font-size: 0.8125rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.zoom-bar__value:hover {
  background-color: var(--ink-50);
}

.zoom-bar__divider {
  width: 1px;
  height: 20px;
  background-color: var(--ink-100);
  margin: 0 4px;
}


/* ============================================================
   MAGNET-TOGGLE (editor-snap.js)
   Schaltet das magnetische Ausrichten ein/aus. Sitzt als normaler
   Toolbar-Button in editor.php (#btn-snap-toggle) - kein position:fixed
   mehr, die Basis-Optik (Größe, Rahmen, Hover) kommt von den
   btn/btn-outline-secondary/btn-sm-Klassen wie bei den Nachbar-Buttons.
   Aktiv = pink, passend zur Farbe der Guide-Linien beim Snappen.
   ============================================================ */

.snap-toggle.active {
  background-color: #ff4d8d;
  border-color: #ff4d8d;
  color: #fff;
}

.snap-toggle.active:hover {
  background-color: #ff2d78;
  border-color: #ff2d78;
  color: #fff;
}


/* ============================================================
   BOARD-LADEANZEIGE (editor.js)
   Erscheint beim initialen Öffnen eines Boards, solange noch
   Elemente (v.a. Bilder – die einzigen mit echtem Netzwerk-Delay)
   nachgeladen werden. Zeigt Gesamtfortschritt + Aufschlüsselung
   nach Elementtyp.
   ============================================================ */

.board-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 20px 24px;
  z-index: 700;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.board-loader.visible {
  opacity: 1;
  pointer-events: auto;
}

.board-loader__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--ink-100);
  border-top-color: var(--petrol-700);
  border-radius: 50%;
  animation: board-loader-spin 0.7s linear infinite;
}

@keyframes board-loader-spin {
  to { transform: rotate(360deg); }
}

.board-loader__title {
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--ink-700);
  text-align: center;
}

.board-loader__breakdown {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.board-loader__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-500);
}

.board-loader__row-done {
  color: var(--petrol-700);
  font-weight: 700;
}


/* ============================================================
   BOARD-VERIFIZIERUNGS-BANNER (editor.js)
   Kleines Pill-Banner oben, zeigt an, dass gerade der aktuelle
   Datenbank-Stand des Boards abgefragt wird (get-board.php), BEVOR
   überhaupt Elemente gerendert werden. Separat von .board-loader,
   da es einen anderen Schritt im Ladevorgang beschreibt.
   ============================================================ */

.board-verify-banner {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lift);
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-700);
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 650;
}

.board-verify-banner.visible {
  display: flex;
}

.board-verify-banner.error {
  color: #c0392b;
}

.board-verify-banner__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink-100);
  border-top-color: var(--petrol-700);
  border-radius: 50%;
  animation: board-loader-spin 0.7s linear infinite;
}

.board-verify-banner.error .board-verify-banner__spinner {
  display: none;
}


/* ============================================================
   VORLAGEN-PANEL (Templates)
   Gleiches Aufklapp-Verhalten wie .editor-layers-panel, eigene Klasse
   nur wegen der abweichenden Breite (Karten brauchen mehr Platz als
   die Ebenen-Liste).
   ============================================================ */

.editor-templates-panel {
  width: 0;
  flex-shrink: 0;
  background-color: #fff;
  border-right: 1px solid var(--ink-100);
  overflow: hidden;
  transition: width 0.2s ease;
}

.editor-templates-panel.open {
  width: 350px;
}

.editor-templates-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-100);
  font-weight: 800;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.editor-templates-grid {
  padding: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
}

.editor-template-category {
  margin-bottom: 20px;
}

.editor-template-category:last-child {
  margin-bottom: 0;
}

.editor-template-category__title {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-400);
  margin: 0 0 8px 2px;
}

.editor-template-category__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-template-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  border: 1.5px solid var(--ink-100);
  border-radius: var(--radius-md);
  background-color: #fff;
  padding: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-template-card:hover {
  border-color: var(--petrol-500);
  box-shadow: var(--shadow-card);
}

.editor-template-card__thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background-color: var(--ink-50);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-300);
  font-size: 1.5rem;
}

.editor-template-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-template-card__name {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-template-card__desc {
  font-size: 0.6875rem;
  color: var(--ink-400);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ============================================================
   TOAST-MELDUNG (editor.js)
   Nicht-blockierende Erfolgsmeldung, z.B. "Vorlage gespeichert" –
   ersetzt alert() an Stellen, wo eine kurze Bestätigung reicht und
   der Nutzer sofort weiterarbeiten soll.
   ============================================================ */

.editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--ink-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  box-shadow: var(--shadow-lift);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.editor-toast.visible {
  opacity: 1;
}


/* ============================================================
   BILD-PLATZHALTER WÄHREND DES LADENS (element-image.js)
   Wird als Konva-Rect+Text direkt auf dem Canvas gezeichnet (nicht als
   HTML-Overlay), da es exakt an Position/Größe des jeweiligen Bildes
   sitzen muss. Farben/Radius hier NUR als Fallback-Referenz – die
   eigentliche Optik entsteht direkt in Konva, siehe element-image.js.
   ============================================================ */


/* ============================================================
   EIGENSCHAFTEN-PANEL: REITER (TABS) STATT LANGER LISTE
   Genutzt von Elementtyp-Modulen mit vielen Eigenschaften (z.B.
   element-image.js) – gruppiert Regler in Allgemein/Rahmen/
   Schatten/Effekte statt alles untereinander zu listen.
   ============================================================ */

.editor-prop-tabs {
  display: flex;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}

.editor-prop-tab {
  flex: 1;
  border: none;
  background-color: #fff;
  color: var(--ink-500);
  font-size: 0.6875rem;
  font-weight: 800;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.editor-prop-tab + .editor-prop-tab {
  border-left: 1.5px solid var(--ink-200);
}

.editor-prop-tab i {
  font-size: 1rem;
}

.editor-prop-tab:hover {
  background-color: var(--petrol-50);
  color: var(--petrol-800);
}

.editor-prop-tab.active {
  background-color: var(--petrol-700);
  color: #fff;
}

.editor-prop-tab-panel {
  display: none;
}

.editor-prop-tab-panel.active {
  display: block;
}

.editor-prop-value {
  font-weight: 800;
  color: var(--ink-700);
  text-transform: none;
  letter-spacing: normal;
}


/* ============================================================
   EIGENSCHAFTEN-PANEL: RESPONSIVES OVERLAY AUF SCHMALEN SCREENS
   Ab 640px verlässt #properties-panel den starren Flex-Layout-Platz
   und legt sich stattdessen als Overlay mit abgedunkeltem Hintergrund
   über den Canvas. Das Ein-/Ausblenden (Klasse "open") übernimmt
   editor.js, sobald ein Element aus-/abgewählt wird – hier wird nur
   das visuelle Verhalten definiert.
   ============================================================ */

@media (max-width: 640px) {
  .editor-shell {
    position: relative;
  }

  .editor-properties {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 85vw);
    border-left: 1px solid var(--ink-100);
    box-shadow: var(--shadow-lift);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 550;
  }

  .editor-properties.open {
    transform: translateX(0);
  }

  .editor-properties-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(22, 27, 27, 0.35);
    z-index: 540;
  }

  .editor-properties-backdrop.open {
    display: block;
  }
}

.editor-templates-panel__filters {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.editor-templates-panel__search {
  flex: 1;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.editor-templates-panel__format-select {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  max-width: 140px;
}