/* fotocollage-maker.ch — Brand-Theme Warm-Korall auf Weiss */

:root {
  --bg:        #ffffff;
  --bg-soft:   #fbf8f4;
  --ink:       #2a2520;
  --ink-soft:  #5a534b;
  --muted:     #f1e8df;
  --line:      #e9dfd2;
  --accent:    #ff6b5b;
  --accent-dark:#e35b4e;
  --highl:     #ffb8a8;
  --highl-soft:#ffd9cf;
  --ok:        #2f9c5b;
  --warn:      #d97706;
  --err:       #c03b2e;
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 6px rgba(42,37,32,.06);
  --shadow:    0 8px 24px rgba(42,37,32,.10);
  --max-w:     1180px;
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/Inter-Light.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-Italic.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Inter-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/SourceSerif4-VF.ttf') format('truetype-variations');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/SourceSerif4-Italic-VF.ttf') format('truetype-variations');
}
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/BebasNeue-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Great Vibes';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/GreatVibes-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/Caveat-VF.ttf') format('truetype-variations');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/JetBrainsMono-Regular.ttf') format('truetype');
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .4em; line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.2rem); letter-spacing: -.005em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}
.site-header .brand {
  font-weight: 800; font-size: 1.25rem; color: var(--ink);
  letter-spacing: -.01em; display: flex; align-items: baseline; gap: 2px;
  text-decoration: none;
}
.site-header .brand .b1 { color: var(--accent); }
.site-header .brand .b2 { color: var(--ink); font-weight: 600; }
.site-nav { display: flex; gap: 8px; align-items: center; }
.site-nav a {
  color: var(--ink); padding: 8px 14px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 500;
}
.site-nav a:hover { background: var(--muted); }
.site-nav .icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 50%; color: var(--ink);
}
.site-nav .icon-btn:hover { background: var(--muted); color: var(--accent); }
.icon-btn__badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; line-height: 18px;
  text-align: center; font-weight: 700;
}

/* Admin: Logout-Button in der Titelzeile + Sub-Navigation darunter */
.admin-logout-form { margin: 0; padding: 0; display: inline-flex; }
.admin-logout-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 4px; padding: 7px 14px;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .88em; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: all .15s ease;
}
.admin-logout-btn:hover {
  background: #fff5f3; color: #c0392b; border-color: #e8a99a;
}
.admin-logout-btn svg { flex-shrink: 0; }

.admin-subnav {
  background: linear-gradient(to bottom, #fbf8f3, #f4ede2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: var(--admin-subnav-top, 68px); z-index: 80;
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.admin-subnav__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 6px 0; overflow-x: auto;
}
.admin-subnav__link {
  display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .9em; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: all .15s ease;
}
.admin-subnav__link:hover {
  background: rgba(255,107,91,.08); color: var(--accent);
}
.admin-subnav__link.is-active {
  background: var(--ink); color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.12);
}
.admin-subnav__link.is-active:hover { background: var(--ink); color: #fff; }
.admin-subnav__logout { margin: 0 0 0 auto; padding: 0; display: inline-flex; }
.admin-subnav__link--logout {
  border: none; background: transparent; cursor: pointer; font: inherit;
  color: var(--ink-soft);
}
.admin-subnav__link--logout:hover { background: rgba(192, 57, 43, .08); color: #c0392b; }
@media (max-width: 768px) {
  .admin-subnav__inner { padding: 4px 8px; }
  .admin-subnav__link { padding: 6px 10px; font-size: .85em; }
  .admin-logout-btn span { display: none; }
  .admin-subnav { --admin-subnav-top: 56px; }
}
.icon-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 6px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  color: var(--ink); transition: all .15s; font-family: inherit;
}
.icon-action:hover { border-color: var(--accent); color: var(--accent); }
.icon-action--save { color: var(--accent); border-color: var(--accent-light, #ffb8a8); }
.icon-action--save:hover { background: var(--accent); color: #fff; }
.icon-action--delete { color: #c0392b; }
.icon-action--delete:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.product-row.dragging { opacity: 0.4; }
.product-row[draggable="true"] { cursor: default; }
.product-row .drag-handle { cursor: grab; }
.product-row .drag-handle:active { cursor: grabbing; }
.container--wide { max-width: 1280px; }

/* Footer */
.site-footer {
  margin-top: 64px;
  padding: 48px 0 24px;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}
.site-footer h4 { color: var(--ink); margin-bottom: 12px; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }
.site-footer .legal { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .9em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: white; padding: 12px 22px;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  transition: background .15s, transform .05s;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); color: white; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--secondary {
  background: var(--bg); color: var(--ink); border: 2px solid var(--line);
}
.btn--secondary:hover { background: var(--muted); color: var(--ink); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--muted); }
.btn--danger {
  background: var(--err); color: #fff; border: none;
}
.btn--danger:hover { background: #a83524; color: #fff; }
.btn--lg { padding: 16px 28px; font-size: 1.05rem; }
.btn--sm { padding: 6px 12px; font-size: .9em; font-weight: 500; }
.btn--block { width: 100%; justify-content: center; }

/* Cards */
.card {
  background: white; border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card--soft { background: var(--bg-soft); }

/* Form */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=date], input[type=tel], input[type=url], textarea, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line);
  background: white; color: var(--ink); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,107,91,.18);
}
label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--ink-soft); font-size: .9rem; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Hero */
.hero { padding: 64px 0 48px; }
.hero h1 { margin-bottom: 16px; }
.hero p.lead, .hero .lead { font-size: 1.15rem; color: var(--ink-soft); margin-bottom: 28px; max-width: 56ch; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero mit Hintergrundbild: Text auf die linke Hälfte begrenzen, damit er nicht
   ins Bild läuft. Ein dezenter weisser Verlauf von links hält die Lesbarkeit
   auch über helleren Bildbereichen stabil. */
.hero--has-bg { position: relative; }
.hero--has-bg::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to right,
      rgba(255,255,255,.92) 0%,
      rgba(255,255,255,.75) 38%,
      rgba(255,255,255,.25) 58%,
      rgba(255,255,255,0) 72%);
  pointer-events: none;
}
.hero--has-bg .container { position: relative; z-index: 1; }
.hero--has-bg .hero__content { max-width: 50%; }
.hero--has-bg .hero__content .lead { max-width: none; }

/* Vorlagen-Grid — Masonry-Layout. JS (public.js) verteilt die .template-card
   in Round-Robin auf .fm-col-Container; bis JS lädt, zeigt die Fallback-
   Grid-Definition die Karten als reguläres Grid. */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.template-grid.fm-active {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.template-grid .fm-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.template-card {
  position: relative;
  display: block;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.template-card:hover,
.template-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.template-card .thumb {
  display: block;
  background: #fafafa;
  /* aspect-ratio sorgt dafür, dass der Container seine Höhe schon kennt, bevor
     das Bild geladen ist. Ohne das verändern lazy-loadende Bilder die Spalten-
     höhen während des Scrolls — und der Anker-Sprung landet bei der falschen
     Kategorie. Generische Karten (Generator/Compound/Bordüre) bekommen 4:3,
     Preset-Karten überschreiben das per inline style mit ihrem echten cw/ch. */
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.template-card .thumb img {
  width: 100%; height: 100%; display: block; object-fit: cover;
}
.template-card .info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.5) 60%, rgba(0,0,0,0) 100%);
  color: #fff;
  pointer-events: none;
}
.template-card .info h3 {
  margin: 0; color: #fff; font-size: 1em; line-height: 1.2;
}
.template-card .info p {
  margin: 2px 0 0; color: rgba(255,255,255,.85); font-size: .82em;
}
/* Hover-Reveal nur auf echten Hover-Geräten (Desktop). Auf Touch-Geräten
   bleibt die Beschriftung permanent sichtbar, damit der Anwender ohne
   Klick weiß, was die Karte ist. */
@media (hover: hover) {
  .template-card .info {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease;
  }
  .template-card:hover .info,
  .template-card:focus-visible .info {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Kategorientitel auf der Vorlagen-Seite — Titel links, Teaser-Sticker rechts
   auf gleicher Höhe. Auf schmalen Viewports klappt der Sticker unter den Titel. */
.cat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 4px;
  flex-wrap: wrap;
}
.cat-head__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Teaser-Sticker — aufgeklebtes Etikett rechts neben dem Kategorientitel.
   Vier Farb-Töne rotieren, plus minimaler Tilt für „handgemachten" Charakter. */
.cat-teaser {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .82em;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  transform: var(--cat-teaser-tilt, rotate(-4deg));
  box-shadow: 0 3px 10px rgba(42, 37, 32, .10);
  border: 1.5px solid transparent;
  flex: 0 0 auto;
  margin-bottom: 2px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.cat-teaser:hover {
  transform: var(--cat-teaser-tilt, rotate(-4deg)) translateY(-1px);
  box-shadow: 0 5px 14px rgba(42, 37, 32, .14);
}
.cat-teaser--tone-0 { background: #fff1ee; color: var(--accent-dark); border-color: var(--highl-soft); }
.cat-teaser--tone-1 { background: #f1ece4; color: var(--ink);         border-color: var(--line); }
.cat-teaser--tone-2 { background: #e9f5ec; color: #1f7a4d;            border-color: #c9e6d2; }
.cat-teaser--tone-3 { background: #fef4e2; color: #8a5a17;            border-color: #f1dfb6; }

@media (max-width: 520px) {
  .cat-teaser { font-size: .78em; padding: 5px 11px; }
}

/* Multi-Format-Badge: signalisiert, dass eine Vorlage in mehreren handgepflegten
   Formaten zur Verfügung steht. Erscheint in der oberen rechten Ecke der Karte. */
.template-card__group-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 9px;
  background: rgba(255, 107, 91, .96);
  color: #fff;
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .02em;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  pointer-events: none;
  z-index: 2;
}

/* Feature-Bar */
.feature-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px; margin: 48px 0; padding: 28px 0;
}
.feature {
  text-align: center; padding: 18px; border-radius: var(--radius);
  background: var(--bg-soft);
}
.feature .ic { font-size: 1.8rem; margin-bottom: 6px; }
.feature h4 { font-size: 1rem; margin-bottom: 4px; }
.feature p { margin: 0; font-size: .9em; color: var(--ink-soft); }

/* Gleich hohe Kacheln + Buttons auf einer Linie. Grid-Zellen strecken die
   Kacheln bereits auf gleiche Höhe; im Admin-/Edit-Modus schiebt der CMS-
   Wrapper (.cms-editable--block) sich als Grid-Item dazwischen — er muss die
   Zellhöhe an die Kachel durchreichen, sonst stehen Kacheln und Buttons
   unterschiedlich hoch. */
.promo-bar > .cms-editable--block,
.feature-bar > .cms-editable--block { display: flex; }
.promo-bar > .cms-editable--block > .card--promo,
.feature-bar > .cms-editable--block > .feature { flex: 1 1 auto; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin: 12px 0; }
.flash--ok { background: #e6f5ec; color: var(--ok); border-left: 4px solid var(--ok); }
.flash--err { background: #fde6e3; color: var(--err); border-left: 4px solid var(--err); }
.flash--warn { background: #fff4e0; color: var(--warn); border-left: 4px solid var(--warn); }

/* Staging-Banner */
.staging-banner {
  background: var(--warn); color: white; text-align: center;
  padding: 6px; font-weight: 600; font-size: .85rem;
  position: sticky; top: 0; z-index: 1000;
}

/* Konto-Bestellungen — Default (Desktop): Tabelle sichtbar, Card-Liste versteckt.
   `!important` weil das Markup im View nebeneinander gerendert wird und einige
   Browser-/Inline-Defaults bei Listen Vorrang nehmen können. Wir wollen hier
   beidseitig wasserdicht steuern, welche Variante zu sehen ist. */
.account-orders__table { display: table !important; }
.account-orders__cards { display: none !important; list-style: none; padding: 0; margin: 0; gap: 10px; }
@media (max-width: 768px) {
  /* Mobile: Tabelle aus, Card-Liste an. Breakpoint deckungsgleich mit der
     restlichen Mobile-Editor-UI (768 px). */
  .account-orders__table { display: none !important; }
  .account-orders__cards { display: grid !important; }
}

/* Mobile */
@media (max-width: 720px) {
  .hero { padding: 32px 0 24px; }
  /* Mobile: Text nutzt die volle Breite (über dem Bild), braucht aber seitliche
     Polsterung, damit er nicht am Rand klebt, und einen kräftigeren Scrim für
     die Lesbarkeit. */
  .hero--has-bg .hero__content { max-width: 100%; }
  .hero--has-bg::before {
    background: linear-gradient(to bottom,
        rgba(255,255,255,.86) 0%,
        rgba(255,255,255,.72) 60%,
        rgba(255,255,255,.55) 100%);
  }
  .site-nav a { padding: 6px 10px; font-size: .92em; }
  .form-row { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
  /* Container-Sections benutzen oft `padding: 32px 0` inline (Cart, Checkout,
     Thanks, Konto …) — auf Mobile sorgt das dafür, dass der Inhalt am Rand
     klebt. Wir erzwingen hier eine seitliche Mindest-Polsterung. */
  .container[style*="padding"] { padding-left: 16px !important; padding-right: 16px !important; }
  /* Account-Seite: Bestell-Tabelle erlaubt horizontal scrollen, statt das
     Layout zu sprengen, falls eine Spalte (Status-Badge) zu breit wird. */
  .card table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Projekt-Grid auf Mobile: 2 statt 3 Spalten, damit Vorschau gross genug bleibt. */
  body.account-page .card > div[style*="grid-template-columns"],
  .card > div[style*="repeat(auto-fill"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* Card-Padding auf Mobile reduzieren, damit der Inhalt nicht doppelt
     eingerückt wirkt (Container hat schon Seiten-Padding). */
  .card { padding: 16px; }

  /* Konto-Bestellungen: Tabelle/Card-Toggle wird ausserhalb dieses @media-Blocks
     gesteuert (siehe Block oberhalb mit !important), damit der Schalter sicher
     greift. Hier nur Cosmetic-Styles der Card-Liste. */
  .account-orders__card-link {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
  }
  .account-orders__card-link:hover { background: #fbf8f3; text-decoration: none; }
  .account-orders__col-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .account-orders__nr { font-weight: 600; font-size: .95em; color: var(--accent); }
  .account-orders__date { font-size: .82em; color: var(--ink-soft); }
  .account-orders__status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 11px;
    font-size: .72em;
    line-height: 1.2;
    white-space: normal;
    max-width: 110px;
    text-align: center;
  }
  .account-orders__col-total {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: .9em;
    white-space: nowrap;
  }
}
@media (max-width: 480px) {
  .container[style*="padding"] { padding-left: 12px !important; padding-right: 12px !important; }
}

/* Editor (eigene CSS-Datei) — basic Layout */
/* Editor-Seite: Body als Flex-Column, damit .editor-layout exakt den verfügbaren
   Vertikalraum füllt — unabhängig von Staging-Banner-, Header- und Toolbar-Höhe. */
body.editor-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.editor-page > main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
body.editor-page > footer.site-footer { display: none; }
body.editor-page .editor-toolbar { flex: 0 0 auto; }

.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg-soft);
}
.editor-sidebar { background: white; border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; display: flex; flex-direction: column; }
.editor-sidebar > h3 { flex: 0 0 auto; }
.editor-sidebar > .add-tools { flex: 0 0 auto; }
/* Fotos-Abschnitt füllt den verbleibenden Raum bis zum Sidebar-Boden.
   So funktionieren Marquee-Selektion und Datei-Drop auch im Leerraum
   unterhalb der zuletzt geladenen Thumbnail-Reihe. */
.editor-sidebar > #photos-section { flex: 1 1 auto; min-height: 120px; }
.editor-canvas { display: flex; flex-direction: column; overflow: hidden; background: #eee; padding: 8px 20px 10px; min-height: 0; }
.editor-canvas .canvas-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.editor-canvas #konva-container { display: block; max-width: 100%; max-height: 100%; }

/* Bild-Swap zwischen zwei Rahmen — Cursor-Hinweise je nach Modus.
   - swap-drag-active:  Cmd/Ctrl+Drag eines Bilds läuft (Ghost folgt Cursor).
   - swap-pick-active:  Nach Klick auf „Bild tauschen mit…" wartet der Editor
                        auf den Klick auf den Tausch-Partner. */
body.swap-drag-active,
body.swap-drag-active .canvas-stage,
body.swap-drag-active #konva-container { cursor: copy !important; }
body.swap-pick-active,
body.swap-pick-active .canvas-stage,
body.swap-pick-active #konva-container { cursor: crosshair !important; }
.swap-drag-ghost { transition: transform .05s linear; }
.editor-canvas #canvas-hint { flex: 0 0 auto; margin: 8px 0 0; font-size: .82em; color: var(--ink-soft); text-align: center; }
.editor-canvas #canvas-hint kbd { font-family: inherit; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fafafa; }
.editor-properties { background: white; border-left: 1px solid var(--line); padding: 16px; overflow-y: auto; }
@media (max-width: 980px) {
  .editor-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .editor-sidebar, .editor-properties { max-height: 30vh; }
}

.editor-toolbar {
  display: flex; gap: 8px; padding: 8px;
  border-bottom: 1px solid var(--line); background: white;
}
.editor-toolbar button:not(.btn) {
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
  color: var(--ink);
}
.editor-toolbar button:not(.btn):hover { background: var(--muted); border-color: var(--accent); }

/* Toggle-Button (Editor-Toolbar): Boolean-On/Off Schalter, z. B. Einrasten/Raster.
   Inaktiv = heller Hintergrund + dunkler Text; aktiv = Accent-Farbe + weisser Text. */
.editor-toolbar .toggle-btn,
.toggle-btn {
  padding: 6px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: .85em;
  font-weight: 500;
  color: var(--ink);
  transition: all .15s ease;
}
.editor-toolbar .toggle-btn:hover,
.toggle-btn:hover {
  background: var(--muted);
  border-color: var(--accent);
  color: var(--ink);
}
.editor-toolbar .toggle-btn.is-active,
.toggle-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.15), var(--shadow-sm);
}
.editor-toolbar .toggle-btn.is-active:hover,
.toggle-btn.is-active:hover {
  background: var(--accent-dark);
  color: #fff;
  border-color: var(--accent-dark);
}
.editor-toolbar .toggle-btn:focus-visible,
.toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.thumb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.thumb-wrap {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; background: var(--bg-soft);
}
.thumb-wrap img {
  width: 100%; height: 100%; object-fit: cover; cursor: grab; display: block;
}
.thumb-wrap:hover { border-color: var(--accent); }
.thumb-wrap.used { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,107,91,0.18); }
.thumb-badge {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(20,16,12,.78); color: #fff;
  font-size: 11px; line-height: 1; padding: 3px 6px;
  border-radius: 8px; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  font-weight: 600;
}
.thumb-badge--visible { opacity: 1; }
.thumb-x {
  position: absolute; top: 2px; right: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: white; border: none;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  font-family: inherit; padding: 0;
}
.thumb-wrap:hover .thumb-x { display: flex; }
.thumb-x:hover { background: var(--accent); }
.thumb-wrap.loading {
  background: var(--muted); animation: thumb-pulse 1.4s ease-in-out infinite;
}
.thumb-img-ph { width: 100%; height: 100%; background: linear-gradient(135deg, #e9dfd2 0%, #f1e8df 100%); }
.thumb-bar {
  position: absolute; bottom: 0; left: 0; right: 0; height: 4px;
  background: rgba(0,0,0,0.1);
}
.thumb-bar-fill {
  height: 100%; background: var(--accent); width: 0%;
  transition: width .2s ease;
}
.thumb-name {
  position: absolute; bottom: 6px; left: 6px; right: 6px;
  font-size: .7em; color: var(--ink); background: rgba(255,255,255,0.85);
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.thumb-wrap.failed { background: #fff5f4; border-color: #ff6b5b; }
.thumb-wrap.failed .thumb-name { color: #c0392b; background: rgba(255,255,255,0.9); }
@keyframes thumb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }

/* Bild-Platzhalter mit Spinner — verhindert „leere" Vorschauflächen, während
   das serverseitig gerenderte Cart-/Project-Thumb noch berechnet wird. JS
   nimmt die Klasse `is-loading` weg, sobald das eigentliche <img> geladen ist. */
.thumb-placeholder { position: relative; }
.thumb-placeholder .thumb-placeholder__spinner {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  transition: opacity .15s;
}
.thumb-placeholder.is-loading .thumb-placeholder__spinner { opacity: 1; }
.thumb-placeholder .thumb-placeholder__spinner::before {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: clamp(18px, 28%, 36px); height: clamp(18px, 28%, 36px);
  margin: calc(clamp(18px, 28%, 36px) / -2) 0 0 calc(clamp(18px, 28%, 36px) / -2);
  border: 2px solid rgba(0,0,0,.12);
  border-top-color: var(--accent, #ff6b5b);
  border-radius: 50%;
  animation: thumb-spin .9s linear infinite;
}
@keyframes thumb-spin { to { transform: rotate(360deg); } }

.upload-zone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 24px; text-align: center; color: var(--ink-soft);
  cursor: pointer; transition: border-color .15s, background .15s;
  margin-bottom: 12px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--bg-soft); }

/* Umschalter (Toggle-Switch) für Admin-Formulare — ersetzt nackte Checkboxen. */
.switch {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: relative; flex: 0 0 auto; width: 42px; height: 24px;
  background: var(--line); border-radius: 999px; transition: background .15s ease;
}
.switch__thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.switch input:checked ~ .switch__track { background: var(--accent); }
.switch input:checked ~ .switch__track .switch__thumb { transform: translateX(18px); }
.switch input:focus-visible ~ .switch__track { box-shadow: 0 0 0 3px var(--accent-soft, rgba(255,107,91,.35)); }
.switch__label { font-size: .9em; color: var(--ink-soft); }
.switch__label::after { content: 'inaktiv'; }
.switch input:checked ~ .switch__label::after { content: 'aktiv'; }

.autosave-indicator {
  position: fixed; bottom: 16px; right: 16px; z-index: 60;
  height: 38px; padding: 0 14px; gap: 8px;
  display: none; align-items: center; justify-content: center;
  background: #fff; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.18);
  color: #5a534b; transition: opacity .15s;
  pointer-events: none; white-space: nowrap;
}
.autosave-indicator svg { display: block; }
.autosave-indicator__label { font-size: .85em; color: inherit; }
/* Sichtbar nur in den nicht-„gespeichert"-Zuständen. is-saved bleibt versteckt
   (keiner braucht eine permanente „Gespeichert"-Bestätigung im Sichtfeld). */
.autosave-indicator.is-dirty,
.autosave-indicator.is-error,
.autosave-indicator.is-locked { display: inline-flex; }
.autosave-indicator.is-dirty  { color: #c88a2a; }
.autosave-indicator.is-error  { color: #c0392b; }
.autosave-indicator.is-locked { color: #c0392b; }

/* Mobile (< 600px): Editor stapelt vertikal */
@media (max-width: 600px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar, .editor-properties { max-height: 40vh; overflow-y: auto; }
}

/* Range-Slider — Custom-Styling für ein konsistentes Look across Browsers */
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px;
  background: transparent; cursor: pointer;
  padding: 0; margin: 0;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: var(--line);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
input[type=range]::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: var(--line);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(255, 107, 91, .35), 0 2px 6px rgba(0,0,0,.12);
  margin-top: -6px; cursor: grab;
  transition: transform .12s, box-shadow .12s;
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(255, 107, 91, .35), 0 2px 6px rgba(0,0,0,.12);
  cursor: grab;
  transition: transform .12s, box-shadow .12s;
}
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.1); }
input[type=range]:hover::-moz-range-thumb     { transform: scale(1.1); }
input[type=range]:active::-webkit-slider-thumb {
  cursor: grabbing; transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(255, 107, 91, .5), 0 3px 10px rgba(0,0,0,.18);
}
input[type=range]:active::-moz-range-thumb {
  cursor: grabbing; transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(255, 107, 91, .5), 0 3px 10px rgba(0,0,0,.18);
}
input[type=range]:focus { outline: none; }
input[type=range]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(255, 107, 91, .25), 0 2px 6px rgba(0,0,0,.12);
}
input[type=range]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(255, 107, 91, .25), 0 2px 6px rgba(0,0,0,.12);
}

/* Bestätigungs-Modal — ersetzt window.confirm() */
.fcm-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 16, 12, .55);
  z-index: 3500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity .18s ease;
}
.fcm-modal-backdrop.is-visible { opacity: 1; }
.fcm-modal {
  background: #fff; border-radius: 12px;
  padding: 24px 28px; max-width: 480px; width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .25);
  transform: translateY(8px);
  transition: transform .18s ease;
}
.fcm-modal-backdrop.is-visible .fcm-modal { transform: translateY(0); }
.fcm-modal__title {
  margin: 0 0 10px; font-size: 1.15em; line-height: 1.3;
  color: var(--ink); font-weight: 700;
}
.fcm-modal__body {
  margin: 0 0 22px; color: var(--ink);
  font-size: .95em; line-height: 1.5;
}
.fcm-modal__actions {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}
.fcm-modal__confirm--danger {
  background: var(--err); color: #fff; border-color: var(--err);
}
.fcm-modal__confirm--danger:hover { background: #a83524; border-color: #a83524; }

/* Modal-Dialog: einheitliche Confirm/Alert/Prompt-Inhalte innerhalb von makeModal()
   Aufgebaut auf der Modal-Hülle aus modal.js (Header, Backdrop, ESC-Handling).
   Genutzt von confirmDialog/alertDialog/promptDialog. */
@keyframes modal-dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.modal-dialog {
  display: flex; flex-direction: column; gap: 16px;
  padding: 4px 2px 2px;
  max-width: 480px;
  animation: modal-dialog-in .22s cubic-bezier(.2, .8, .2, 1);
}
.modal-dialog__icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; line-height: 1;
  flex: 0 0 auto;
}
.modal-dialog__icon--info {
  background: rgba(255, 107, 91, .12); color: var(--accent);
}
.modal-dialog__icon--success {
  background: rgba(47, 156, 91, .14); color: var(--ok);
}
.modal-dialog__icon--warning {
  background: rgba(217, 119, 6, .15); color: var(--warn);
}
.modal-dialog__icon--error {
  background: rgba(192, 59, 46, .14); color: var(--err);
}
.modal-dialog__title {
  margin: 0; font-size: 1.1rem; font-weight: 700;
  color: var(--ink); line-height: 1.3;
}
.modal-dialog__message {
  margin: 0; color: var(--ink-soft);
  font-size: .96rem; line-height: 1.55;
  white-space: pre-line;
}
.modal-dialog__input {
  width: 100%;
  margin-top: 4px;
}
.modal-dialog__actions {
  display: flex; justify-content: flex-end; align-items: center;
  gap: 10px; flex-wrap: wrap;
  margin-top: 8px;
}
.modal-dialog__actions .btn {
  padding: 10px 18px; font-size: .95rem;
}

/* ── Rabatt-Teaser (Promo-Bar, CMS type=promo) ───────────────────────────── */
.promo-teaser {
  background: var(--promo-bg, #1f7a4d);
  color: var(--promo-fg, #fff);
  font-size: .92rem;
  overflow: hidden;
  transition: height .2s ease, opacity .2s ease;
}
.promo-teaser.is-closing { opacity: 0; height: 0 !important; }
.promo-teaser__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 40px;
}
.promo-teaser__text { font-weight: 600; }
.promo-teaser__code {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.18);
  color: inherit;
  border: 1px dashed currentColor;
  border-radius: var(--radius-sm, 10px);
  padding: 2px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease;
}
.promo-teaser__code:hover  { background: rgba(255,255,255,.30); }
.promo-teaser__code.is-copied { background: rgba(255,255,255,.4); }
.promo-teaser__code-val  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.promo-teaser__copy-icon,
.promo-teaser__check-icon { display: inline-block; opacity: .7; flex: none; }
.promo-teaser__code:hover .promo-teaser__copy-icon { opacity: 1; }
.promo-teaser__check-icon { display: none; opacity: 1; }
.promo-teaser__code.is-copied .promo-teaser__copy-icon  { display: none; }
.promo-teaser__code.is-copied .promo-teaser__check-icon { display: inline-block; }
.promo-teaser__edit,
.promo-teaser__close {
  background: transparent; border: 0; color: inherit;
  cursor: pointer; line-height: 1; opacity: .75; text-decoration: none;
}
.promo-teaser__edit:hover,
.promo-teaser__close:hover { opacity: 1; }
.promo-teaser__close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 1.15rem;
}
@media (max-width: 560px) {
  .promo-teaser { font-size: .82rem; }
  .promo-teaser__inner { gap: 8px; padding: 7px 36px; }
}
