/* ─── Reset & Basis ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #2d6a4f;
  --primary-dark:  #1b4332;
  --primary-light: #52b788;
  --accent:        #d4a017;
  --bg:            #f8f7f4;
  --card-bg:       #ffffff;
  --text:          #1a1a1a;
  --text-muted:    #6b7280;
  --border:        #e5e7eb;
  --error:         #dc2626;
  --error-bg:      #fef2f2;
  --success:       #15803d;
  --success-bg:    #f0fdf4;
  --info-bg:       #eff6ff;
  --info:          #1d4ed8;
  --radius:        12px;
  --shadow:        0 2px 16px rgba(0,0,0,0.08);
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family:      var(--font);
  background-color: var(--bg);
  color:            var(--text);
  min-height:       100vh;
  display:          flex;
  flex-direction:   column;
  font-size:        16px;
  line-height:      1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--primary-dark);
  color:       white;
  padding:     1rem 1.5rem;
}
.header-inner {
  max-width:   800px;
  margin:      0 auto;
  display:     flex;
  align-items: center;
}
.logo {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  color:       white;
  font-size:   1.2rem;
  text-decoration: none;
}
.logo-icon { font-size: 1.5rem; }
.logo-text strong { color: var(--accent); }

/* ─── Main ───────────────────────────────────────────────────────────────── */
.main-content {
  flex:       1;
  max-width:  860px;
  width:      100%;
  margin:     0 auto;
  padding:    2rem 1rem;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  text-align:  center;
  color:       var(--text-muted);
  font-size:   0.85rem;
  padding:     1.5rem 1rem;
  border-top:  1px solid var(--border);
  margin-top:  auto;
}

/* ─── Fortschrittsanzeige ───────────────────────────────────────────────── */
.progress-bar-wrapper { margin-bottom: 2rem; overflow-x: auto; }
.progress-steps {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             0;
  padding:         0.5rem 0;
}
.progress-step {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            0.25rem;
  min-width:      70px;
}
.step-bubble {
  width:           34px;
  height:          34px;
  border-radius:   50%;
  background:      var(--border);
  color:           var(--text-muted);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-weight:     600;
  font-size:       0.9rem;
  transition:      all 0.25s;
}
.progress-step.active  .step-bubble { background: var(--primary); color: white; }
.progress-step.done    .step-bubble { background: var(--primary-light); color: white; }
.step-label { font-size: 0.72rem; color: var(--text-muted); text-align: center; }
.progress-step.active .step-label,
.progress-step.done   .step-label  { color: var(--primary); font-weight: 600; }

.progress-connector {
  flex:            1;
  height:          2px;
  background:      var(--border);
  min-width:       16px;
  transition:      background 0.25s;
  margin-bottom:   18px;
}
.progress-connector.done { background: var(--primary-light); }

/* ─── Wizard-Karte ──────────────────────────────────────────────────────── */
.wizard-card {
  background:    var(--card-bg);
  border-radius: var(--radius);
  box-shadow:    var(--shadow);
  padding:       2rem;
  max-width:     560px;
  margin:        0 auto;
}
.wizard-card-wide { max-width: 1100px; }
.wizard-card-icon {
  font-size:     2.5rem;
  text-align:    center;
  margin-bottom: 0.5rem;
}
.wizard-title {
  font-size:     1.5rem;
  font-weight:   700;
  text-align:    center;
  color:         var(--primary-dark);
  margin-bottom: 0.5rem;
}
.wizard-subtitle {
  text-align:    center;
  color:         var(--text-muted);
  margin-bottom: 1.5rem;
  font-size:     0.95rem;
}
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 0.85rem; }
.highlight-box {
  display:       inline-block;
  border:        2px solid rgba(255,255,255,0.8);
  padding:       0 4px;
  background:    rgba(255,255,255,0.2);
  border-radius: 3px;
}

/* ─── Formulare ─────────────────────────────────────────────────────────── */
.wizard-form { margin-top: 1.5rem; }
.form-group  { margin-bottom: 1.25rem; }

label {
  display:       block;
  font-weight:   600;
  margin-bottom: 0.4rem;
  font-size:     0.95rem;
}
.form-control {
  width:         100%;
  padding:       0.65rem 0.9rem;
  border:        1.5px solid var(--border);
  border-radius: 8px;
  font-size:     1rem;
  font-family:   var(--font);
  background:    white;
  color:         var(--text);
  transition:    border-color 0.2s;
}
.form-control:focus {
  outline:       none;
  border-color:  var(--primary);
  box-shadow:    0 0 0 3px rgba(45,106,79,0.12);
}
.form-hint {
  font-size:  0.82rem;
  color:      var(--text-muted);
  margin-top: 0.3rem;
}
.char-counter {
  font-size:  0.8rem;
  color:      var(--text-muted);
  text-align: right;
  margin-top: 0.2rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  gap:             0.35rem;
  padding:         0.6rem 1.4rem;
  border-radius:   8px;
  border:          none;
  font-size:       0.95rem;
  font-weight:     600;
  cursor:          pointer;
  text-decoration: none;
  transition:      all 0.2s;
  font-family:     var(--font);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: white; text-decoration: none; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; color: var(--text); text-decoration: none; }
.btn-ghost  { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.btn-lg { padding: 0.75rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

.wizard-actions {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-top:      1.5rem;
  gap:             1rem;
  flex-wrap:       wrap;
}

/* ─── Kontaktfeld (Step 6) ───────────────────────────────────────────────── */
.contact-field {
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.contact-field label { font-weight: 600; display: block; margin-bottom: 0.5rem; }
.contact-optional    { font-weight: 400; font-size: 0.85rem; color: var(--text-muted); }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding:       0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size:     0.92rem;
}
.alert-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #fca5a5; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #93c5fd; }

/* ─── Adress-Suche ───────────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap:     0.5rem;
}
.search-row .form-control { flex: 1; }
.search-results {
  border:        1.5px solid var(--border);
  border-radius: 8px;
  margin-top:    0.25rem;
  background:    white;
  box-shadow:    var(--shadow);
  max-height:    220px;
  overflow-y:    auto;
  z-index:       100;
  position:      relative;
}
.search-item {
  padding:    0.65rem 1rem;
  cursor:     pointer;
  font-size:  0.9rem;
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg); }
.search-item-empty,
.search-item-error { color: var(--text-muted); cursor: default; }

/* ─── Karte ──────────────────────────────────────────────────────────────── */
.map-wrapper  { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); }

/* Quadratischer Map-Wrapper: padding-top Hack (zuverlässig für Leaflet) */
.map-wrapper-square {
  height: 0;
  padding-top: 100%;
}
.map-wrapper-square #map-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
}
.map-overlay-frame {
  position:      absolute;
  top:           50%;
  left:          50%;
  transform:     translate(-50%, -50%);
  width:         calc(100% * 15/17);
  height:        calc(100% * 15/17);
  border:        3px dashed rgba(255,255,255,0.85);
  border-radius: 4px;
  pointer-events: none;
  z-index:        500;
  box-shadow:    inset 0 0 0 1px rgba(0,0,0,0.2);
}

.map-controls {
  display:     flex;
  flex-wrap:   wrap;
  gap:         1.5rem;
  margin-top:  1rem;
  align-items: center;
}
.control-group {
  display:     flex;
  align-items: center;
  gap:         0.75rem;
}
.control-label { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); white-space: nowrap; }

.arrow-pad {
  display:    grid;
  grid-template-columns: 36px 36px 36px;
  grid-template-rows:    36px 36px;
  gap:        3px;
}
.btn-arrow {
  width:           36px;
  height:          36px;
  background:      var(--card-bg);
  border:          1.5px solid var(--border);
  border-radius:   6px;
  cursor:          pointer;
  font-size:       1rem;
  display:         flex;
  align-items:     center;
  justify-content: center;
  transition:      all 0.15s;
  padding:         0;
}
.btn-arrow:hover { background: var(--primary); color: white; border-color: var(--primary); }
/* Pfeil-Grid Layout */
.btn-arrow[data-dir="up"]    { grid-column: 2; grid-row: 1; }
.btn-arrow[data-dir="left"]  { grid-column: 1; grid-row: 2; }
.btn-arrow[data-dir="down"]  { grid-column: 2; grid-row: 2; }
.btn-arrow[data-dir="right"] { grid-column: 3; grid-row: 2; }

.zoom-controls { display: flex; align-items: center; gap: 0.5rem; }
.zoom-value {
  font-weight:  600;
  font-size:    0.9rem;
  min-width:    70px;
  text-align:   center;
  color:        var(--primary-dark);
}
.map-info {
  margin-top: 0.6rem;
  font-size:  0.85rem;
  color:      var(--text-muted);
}

/* Leaflet-Icon Override */
.custom-map-icon { background: none !important; border: none !important; }

/* ─── Markierungen-Auswahl ───────────────────────────────────────────────── */
.marker-grid {
  display:               grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap:                   0.75rem;
  margin-bottom:         1rem;
}
.marker-card {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            0.4rem;
  padding:        1rem 0.5rem;
  border:         2px solid var(--border);
  border-radius:  10px;
  cursor:         pointer;
  transition:     all 0.2s;
  background:     white;
  text-align:     center;
}
.marker-card input[type="radio"] { display: none; }
.marker-card:hover     { border-color: var(--primary-light); }
.marker-card.selected  { border-color: var(--primary); background: #f0fdf4; box-shadow: 0 0 0 3px rgba(45,106,79,0.15); }
.marker-name           { font-size: 0.82rem; font-weight: 600; color: var(--text); }

/* Kompaktes Grid in Step 5 (Seitenleiste) */
.marker-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.4rem;
}
.marker-grid-compact .marker-card {
  padding: 0.5rem 0.25rem;
  gap: 0.2rem;
}
.marker-grid-compact .marker-name { font-size: 0.72rem; }

/* ─── Vorschau-Layout ────────────────────────────────────────────────────── */
.preview-layout {
  display:   flex;
  gap:       2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  align-items: flex-start;
}
.preview-inputs { flex: 1; min-width: 240px; }

/* Bilderrahmen-Vorschau – Rahmen.png als echtes Bild mit Overlays */
.frame-preview-outer {
  display:         flex;
  justify-content: center;
  align-items:     flex-start;
  flex:            none;        /* nicht strecken – Rahmen bestimmt seine eigene Breite */
  overflow-x:      auto;        /* bei sehr großem Rahmen scrollbar statt geclippt */
}

/* Container: Breite und Höhe werden dynamisch per Inline-CSS aus Admin-Einstellungen gesetzt */
.frame-preview {
  position: relative;
  overflow: hidden;
}

/* Das Rahmen-Foto als Hintergrund */
.frame-bg {
  position: absolute;
  top:  0;
  left: 0;
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* Text oben – Position kommt per Inline-CSS aus Admin-Einstellungen;
   font-family und font-size werden per JS aus Kunden-Einstellung gesetzt */
.frame-overlay-top {
  position:    absolute;
  display:     flex;
  align-items: center;
  justify-content: center;
  text-align:  center;
  font-family: 'Dancing Script', cursive; /* Fallback; wird per JS überschrieben */
  font-size:   24px;                      /* Fallback; wird per JS überschrieben */
  font-weight: 700;
  color:       #1a1a1a;
  line-height: 1;
  z-index:     2;
  word-break:  break-word;
  overflow:    hidden;
}

/* Karten-Overlay – Position kommt per Inline-CSS aus Admin-Einstellungen */
.frame-overlay-map {
  position: absolute;
  overflow: hidden;
  z-index:  2;
}

/* Text unten – Position kommt per Inline-CSS aus Admin-Einstellungen;
   font-family und font-size werden per JS aus Kunden-Einstellung gesetzt */
.frame-overlay-bottom {
  position:       absolute;
  display:        flex;
  align-items:    center;
  justify-content: center;
  text-align:     center;
  font-family:    'Open Sans', sans-serif; /* Fallback; wird per JS überschrieben */
  font-size:      10px;                   /* Fallback; wird per JS überschrieben */
  font-weight:    400;
  color:          #444444;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height:    1.3;
  z-index:        2;
  word-break:     break-word;
  overflow:       hidden;
}

/* Leaflet-Attribution ausblenden */
.frame-overlay-map .leaflet-control-attribution {
  display: none !important;
}

.marker-info-box {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  margin-top:  1rem;
  font-size:   0.9rem;
  color:       var(--text-muted);
}

/* ─── Koordinaten-Toggle in Step 5 ─────────────────────────────────────── */
.coords-toggle {
  margin-bottom: 0.75rem;
  padding:       0.6rem 1rem;
  background:    var(--success-bg);
  border:        1px solid #bbf7d0;
  border-radius: var(--radius);
}
.coords-toggle-label {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  cursor:      pointer;
  font-weight: 600;
  font-size:   0.9rem;
  color:       var(--success);
  user-select: none;
}
.coords-toggle-label input[type="checkbox"] {
  width:  1.1rem;
  height: 1.1rem;
  cursor: pointer;
  accent-color: var(--success);
}
.coords-preview-text {
  margin-top:  0.35rem;
  font-size:   0.78rem;
  color:       var(--success);
  font-family: monospace;
  word-break:  break-all;
}
/* Deaktiviertes Text-Feld bei Koordinaten-Modus */
.form-control:disabled {
  background: var(--border);
  color:      var(--text-muted);
  cursor:     not-allowed;
  opacity:    0.7;
}


.font-controls {
  margin-top:    1rem;
  padding:       0.75rem 1rem;
  background:    var(--info-bg);
  border:        1px solid #bfdbfe;
  border-radius: var(--radius);
}
.font-controls > label:first-child {
  display:     block;
  font-size:   0.8rem;
  font-weight: 600;
  color:       var(--info);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.font-controls .form-control-sm {
  height:    2.1rem;
  font-size: 0.9rem;
  padding:   0.3rem 0.6rem;
}
.font-size-row {
  display:     flex;
  align-items: center;
  gap:         0.75rem;
  margin-top:  0.6rem;
}
.font-size-row label {
  font-size:   0.85rem;
  color:       var(--text-muted);
  white-space: nowrap;
}
.font-size-slider {
  flex:   1;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ─── Zusammenfassung ────────────────────────────────────────────────────── */
.summary-card {
  background:    var(--bg);
  border:        1.5px solid var(--border);
  border-radius: 10px;
  padding:       1.25rem;
  margin-bottom: 1rem;
}
.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th,
.summary-table td {
  padding:    0.5rem 0.75rem;
  text-align: left;
  font-size:  0.92rem;
  border-bottom: 1px solid var(--border);
}
.summary-table tr:last-child th,
.summary-table tr:last-child td { border-bottom: none; }
.summary-table th {
  font-weight: 600;
  color:       var(--text-muted);
  width:       38%;
  white-space: nowrap;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .wizard-card { padding: 1.25rem; }
  .progress-steps { justify-content: flex-start; }
  .step-label { display: none; }
  .map-controls { flex-direction: column; align-items: flex-start; }
  .preview-layout { flex-direction: column; }
  .frame-preview { width: 100%; max-width: 280px; }
  .wizard-actions { flex-direction: column-reverse; }
  .wizard-actions .btn { width: 100%; justify-content: center; }
}
