/* ===================================================================
   share-map.css  –  Viewer (minimalistisch) + Editor (Sidebar)
   =================================================================== */

:root {
  --sm-bg: #ecf2f7;
  --sm-panel: rgba(247, 250, 252, 0.96);
  --sm-panel-strong: rgba(255, 255, 255, 0.98);
  --sm-border: rgba(15, 23, 42, 0.10);
  --sm-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
  --sm-text: #132235;
  --sm-muted: #5f7084;
  --sm-accent: #0f766e;
  --sm-accent2: #155e75;
  --sm-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: var(--sm-text);
  background: #e8eff5;
}

/* ===================================================================
   OUTER LAYOUT
   =================================================================== */

/* Default: Viewer (full-screen map, no sidebar) */
.sm-layout {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: row;
}

/* Editor: sidebar + map side by side */
.sm-layout.mode-editor {
  flex-direction: row;
}

/* ===================================================================
   MAP WRAPPER  –  immer sichtbar, füllt verbleibenden Platz
   =================================================================== */

.sm-map-wrap {
  flex: 1 1 auto;
  position: relative;
  min-width: 0;
  min-height: 0;
}

#shareMap {
  position: absolute;
  inset: 0;
}

/* Im Editor: etwas Abstand + runde Ecken */
.mode-editor #shareMap {
  inset: 14px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.20);
}

/* ===================================================================
   VIEWER OVERLAYS
   =================================================================== */

/* Topbar (floating, oben) */
.sv-topbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--sm-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--sm-border);
  border-radius: 18px;
  box-shadow: var(--sm-shadow);
  flex-wrap: wrap;
}

.sv-topbar[hidden] { display: none; }

.sv-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.sv-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.sv-title-wrap { min-width: 0; }

.sv-title {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.sv-subtitle {
  font-size: 12px;
  color: var(--sm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.sv-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sv-btn {
  padding: 7px 13px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  transition: opacity 0.15s, background 0.15s;
}
.sv-btn-ghost {
  background: rgba(15, 23, 42, 0.07);
  color: var(--sm-text);
}
.sv-btn-ghost:hover { background: rgba(15, 23, 42, 0.13); }
.sv-btn-primary {
  background: var(--sm-accent);
  color: #fff;
}
.sv-btn-primary:hover { opacity: 0.88; }

/* Sheet Toggle (bottom-left floating button) */
.sv-sheet-toggle {
  position: absolute;
  bottom: 22px;
  left: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--sm-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  box-shadow: var(--sm-shadow);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--sm-text);
  cursor: pointer;
}
.sv-sheet-toggle[hidden] { display: none; }
.sv-sheet-toggle:hover { background: var(--sm-panel-strong); }

.sv-sheet-toggle-icon { font-size: 14px; }

/* Feature Sheet (slide-up panel) */
.sv-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--sm-panel-strong);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.15);
  padding: 0 16px 16px;
  max-height: 65vh;
  overflow-y: auto;
  transform: translateY(0);
  transition: transform 0.25s ease;
}
.sv-sheet[hidden] { display: none; }

.sv-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
  position: sticky;
  top: 0;
  background: var(--sm-panel-strong);
  border-bottom: 1px solid var(--sm-border);
  margin-bottom: 10px;
}
.sv-sheet-title {
  font-size: 15px;
  font-weight: 800;
}
.sv-sheet-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  font-size: 13px;
  cursor: pointer;
  color: var(--sm-muted);
}
.sv-sheet-close:hover { background: rgba(15, 23, 42, 0.12); }

.sv-sheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}
.sv-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  font-size: 12px;
  font-weight: 600;
}
.sv-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Popup in Viewer */
.sv-popup-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}
.sv-popup-meta,
.sv-popup-desc {
  font-size: 12px;
  color: var(--sm-muted);
  line-height: 1.4;
}
.sv-popup-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.sv-popup-actions a {
  background: #102033;
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* Feature list in sheet */
.sv-feat-list { display: grid; gap: 8px; }
.sv-feat-item {
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.sv-feat-item:hover {
  border-color: rgba(21, 94, 117, 0.25);
  box-shadow: 0 2px 8px rgba(21, 94, 117, 0.08);
}
.sv-feat-item.active {
  border-color: rgba(21, 94, 117, 0.4);
  box-shadow: 0 6px 18px rgba(21, 94, 117, 0.12);
}
.sv-feat-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sv-feat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sv-feat-name {
  font-size: 13px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sv-feat-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sm-muted);
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.sv-feat-meta {
  font-size: 11px;
  color: var(--sm-muted);
  margin-top: 3px;
}
.sv-feat-desc {
  font-size: 12px;
  color: var(--sm-muted);
  margin-top: 5px;
  line-height: 1.4;
}
.sv-feat-actions {
  margin-top: 8px;
  display: flex;
  gap: 7px;
}
.sv-feat-route {
  padding: 5px 11px;
  background: #102033;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* Editor map-hint overlay */
.se-map-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 9px 18px;
  background: rgba(16, 32, 51, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}
.se-map-hint[hidden] { display: none; }

/* ===================================================================
   EDITOR SIDEBAR
   =================================================================== */

.se-sidebar {
  flex: 0 0 340px;
  width: 340px;
  height: 100%;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(240, 246, 251, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--sm-border);
}

.se-sidebar[hidden] { display: none; }

/* Shared card style (used in editor sidebar) */
.share-card {
  background: var(--sm-panel-strong);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  padding: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.share-card-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sm-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-feature-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--sm-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.share-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--sm-panel-strong);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
}
.share-brand-name { font-size: 13px; font-weight: 800; }
.share-brand-sub { font-size: 11px; color: var(--sm-muted); }

/* ===================================================================
   EDITOR FIELDS / FORM ELEMENTS
   =================================================================== */

.editor-field { margin-top: 10px; }
.editor-field:first-child { margin-top: 0; }

.editor-label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sm-muted);
  margin-bottom: 4px;
}

.editor-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.editor-field-row .editor-label { margin-bottom: 0; }

.editor-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--sm-border);
  border-radius: 9px;
  background: #fff;
  color: var(--sm-text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.editor-input:focus {
  border-color: var(--sm-accent);
  box-shadow: 0 0 0 2.5px rgba(15, 118, 110, 0.12);
}
.editor-input.input-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 2.5px rgba(220, 38, 38, 0.12);
}
.editor-textarea { resize: vertical; min-height: 58px; }

.editor-map-toggle { display: flex; gap: 4px; }
.editor-map-mode {
  padding: 5px 11px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: rgba(15, 118, 110, 0.08);
  color: var(--sm-accent2);
}
.editor-map-mode.active {
  background: linear-gradient(135deg, var(--sm-accent) 0%, var(--sm-accent2) 100%);
  color: #fff;
}

.editor-tools-row { display: flex; gap: 8px; margin-bottom: 8px; }
.editor-tool-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 11px 6px;
  border: 1.5px solid var(--sm-border);
  border-radius: 12px;
  background: #fff;
  color: var(--sm-text);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.editor-tool-btn:hover {
  border-color: var(--sm-accent);
  background: rgba(15, 118, 110, 0.05);
}
.editor-tool-btn.active {
  border-color: var(--sm-accent);
  background: rgba(15, 118, 110, 0.10);
  box-shadow: 0 0 0 2.5px rgba(15, 118, 110, 0.12);
  color: var(--sm-accent);
}
.editor-tool-icon { font-size: 18px; line-height: 1; }

.editor-hint {
  margin: 0;
  font-size: 11px;
  color: var(--sm-muted);
  line-height: 1.4;
}

.editor-form-card {
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow: 0 3px 14px rgba(15, 118, 110, 0.08);
}

.editor-form-actions { display: flex; gap: 7px; margin-top: 12px; }
.editor-save-btn,
.editor-cancel-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.editor-save-btn {
  background: linear-gradient(135deg, var(--sm-accent), var(--sm-accent2));
  color: #fff;
}
.editor-save-btn:hover { opacity: 0.9; }
.editor-save-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.editor-cancel-btn { background: rgba(15, 23, 42, 0.07); color: var(--sm-muted); }
.editor-cancel-btn:hover { background: rgba(15, 23, 42, 0.12); }

.editor-colors { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.editor-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s;
}
.editor-color-swatch:hover { transform: scale(1.15); }
.editor-color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--sm-text);
  transform: scale(1.1);
}

.editor-pick-block {
  margin-bottom: 10px;
  padding: 9px 11px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 10px;
}
.editor-pick-row { display: flex; align-items: center; gap: 7px; }
.editor-pick-connector { width: 2px; height: 10px; background: var(--sm-border); margin-left: 7px; border-radius: 2px; }
.editor-pick-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px currentColor;
}
.editor-pick-dot-start { background: #16a34a; color: #16a34a; }
.editor-pick-dot-end   { background: #dc2626; color: #dc2626; }
.editor-pick-value { flex: 1; font-size: 11px; color: var(--sm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-pick-btn {
  padding: 4px 9px;
  border: 1px solid var(--sm-border);
  border-radius: 7px;
  background: #fff;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  color: var(--sm-accent2);
  white-space: nowrap;
}
.editor-pick-btn:hover, .editor-pick-btn.active {
  background: rgba(15, 118, 110, 0.08);
  border-color: var(--sm-accent);
}
.editor-route-status { margin: 5px 0 0; font-size: 11px; color: var(--sm-muted); }

.editor-feature-list { display: grid; gap: 7px; max-height: 230px; overflow-y: auto; }
.editor-empty-msg { margin: 4px 0 0; font-size: 12px; color: var(--sm-muted); }

.editor-feat-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s;
}
.editor-feat-item:hover { border-color: rgba(21, 94, 117, 0.25); }
.editor-feat-color { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.editor-feat-info { flex: 1; min-width: 0; }
.editor-feat-title {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-feat-type {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sm-muted);
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 5px;
  border-radius: 999px;
}
.editor-feat-subtitle { font-size: 10px; color: var(--sm-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-feat-btns { display: flex; gap: 3px; flex-shrink: 0; }
.editor-feat-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sm-border);
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  color: var(--sm-muted);
}
.editor-feat-btn:hover { background: rgba(15, 23, 42, 0.08); color: var(--sm-text); }
.editor-feat-btn-del:hover { background: rgba(220, 38, 38, 0.09); color: #dc2626; border-color: rgba(220, 38, 38, 0.22); }

/* Export */
.editor-copy-row { display: flex; gap: 5px; margin-top: 5px; }
.editor-copy-row-code { align-items: flex-start; }
.editor-url-input { flex: 1; font-size: 11px; font-family: monospace; }
.editor-iframe-textarea { resize: none; font-size: 10px; line-height: 1.4; }
.editor-iframe-height { font-size: 11px; padding: 5px 7px; }
.editor-copy-btn {
  padding: 8px 11px;
  border: none;
  border-radius: 9px;
  background: #102033;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.editor-copy-btn:hover { background: #1e3a5f; }
.editor-preview-btn {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sm-accent), var(--sm-accent2));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.editor-preview-btn:hover { opacity: 0.9; }

/* Route Pick-Marker */
.route-pick-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  border: 2px solid #fff;
}
.route-pick-start { background: #16a34a; }
.route-pick-end   { background: #dc2626; }

/* Popup */
.maplibregl-popup-content {
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 800px) {
  .sm-layout.mode-editor {
    flex-direction: column;
  }

  .se-sidebar {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--sm-border);
  }

  .sm-map-wrap {
    flex: 1 1 auto;
    min-height: 55vh;
  }
}

@media (max-width: 600px) {
  .sv-topbar-right .sv-btn-ghost:not(#svModeBtn) {
    display: none;
  }
  .sv-topbar {
    gap: 6px;
    padding: 8px 10px;
  }
}
