/* ===================================================
   PfadFinder+ Builder – Dark Theme Stylesheet
   =================================================== */

/* hidden-Attribut darf NICHT von display:flex überschrieben werden */
[hidden] { display: none !important; }

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

:root {
  --bg:        #0F0F1E;
  --surface:   #1E1E3A;
  --surface2:  #2A2A4A;
  --accent:    #7C9FF5;
  --accent-dim: rgba(124, 159, 245, 0.18);
  --text:      #E0E0F0;
  --text-dim:  #8888AA;
  --success:   #66BB6A;
  --error:     #EF5350;
  --border:    #333355;
  --header-h:  50px;
  --tabbar-h:  44px;
  --chrome-h:  94px; /* header + tabbar */
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ===================================================
   SCROLLBAR
   =================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===================================================
   LOGIN OVERLAY
   =================================================== */
#login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #0F0F1E 0%, #1A1A3E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}

.login-logo {
  font-size: 2.8rem;
  margin-bottom: 4px;
}

.login-brand {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.login-brand span {
  color: var(--text);
}

.login-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

#login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===================================================
   APP SHELL
   =================================================== */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===================================================
   HEADER
   =================================================== */
#app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.header-logo {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.header-title strong {
  color: var(--accent);
}

.dirty-dot {
  color: var(--error);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-username {
  color: var(--text-dim);
  font-size: 0.88rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================================================
   TAB BAR
   =================================================== */
#tab-bar {
  height: var(--tabbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

#tab-bar::-webkit-scrollbar { height: 0; }

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ===================================================
   TAB CONTENT
   =================================================== */
.tab-content {
  display: none;        /* hidden by default; JS toggles .active */
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

.tab-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===================================================
   SECTION CARDS
   =================================================== */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-card.no-margin {
  border-radius: 12px 12px 0 0;
  border-bottom: none;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.sub-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

/* ===================================================
   FORMS
   =================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

textarea {
  resize: vertical;
  min-height: 60px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238888AA' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

select option {
  background: var(--surface2);
  color: var(--text);
}

input[type="color"].color-input {
  padding: 2px 4px;
  height: 38px;
  cursor: pointer;
  border-radius: 8px;
}

.emoji-input {
  font-size: 1.6rem;
  text-align: center;
  padding: 4px 8px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.form-actions-sm {
  margin-top: 0;
}

/* ===================================================
   TOGGLE
   =================================================== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text);
  cursor: default;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 9px 18px;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  line-height: 1;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #0F0F1E;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: rgba(239, 83, 80, 0.15);
  border: 1px solid var(--error);
  color: var(--error);
}

.btn-danger:hover:not(:disabled) { background: rgba(239, 83, 80, 0.3); }

.btn-full { width: 100%; }

.btn-sm {
  font-size: 0.82rem;
  padding: 6px 12px;
}

.btn-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ===================================================
   HINTS & MESSAGES
   =================================================== */
.hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.error-msg {
  color: var(--error);
  font-size: 0.88rem;
  background: rgba(239,83,80,0.12);
  border: 1px solid rgba(239,83,80,0.3);
  border-radius: 8px;
  padding: 8px 12px;
}

.count-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
}

.mono { font-family: 'Consolas', 'Courier New', monospace; font-size: 0.8rem; color: var(--text-dim); }

/* ===================================================
   ITEM LIST
   =================================================== */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.item-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.item-card:hover {
  border-color: var(--accent);
  background: rgba(124, 159, 245, 0.06);
}

.item-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.item-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.item-card-body {
  flex: 1;
  min-width: 0;
}

.item-card-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ===================================================
   LIST HEADER
   =================================================== */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 8px;
}

.list-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

/* ===================================================
   EDIT FORM (inline in list side)
   =================================================== */
.edit-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.edit-form h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ===================================================
   ZONES TAB – SPLIT LAYOUT
   =================================================== */
.zones-layout {
  height: calc(100vh - var(--chrome-h));
  overflow: hidden;
}

.tab-content.active.zones-layout {
  flex-direction: row;
}

.zones-map-side {
  flex: 0 0 70%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.zones-list-side {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  gap: 8px;
}

.zones-list-side .side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zones-list-side .side-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.zones-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.draw-hint {
  font-size: 0.82rem;
  color: var(--accent);
  font-style: italic;
}

.toolbar-spacer {
  flex: 1;
}

.address-search {
  display: flex;
  align-items: center;
  gap: 4px;
}

.address-search input {
  width: 200px;
  padding: 5px 10px;
  font-size: 0.82rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.address-search input:focus {
  border-color: var(--accent);
}

@media (max-width: 700px) {
  .address-search input { width: 120px; }
}

#map {
  flex: 1;
  height: calc(100vh - var(--chrome-h) - 53px); /* minus toolbar */
}

/* ===================================================
   DIALOGUES TAB – SPLIT LAYOUT
   =================================================== */
.dialogues-layout {
  height: calc(100vh - var(--chrome-h));
  overflow: hidden;
}

.tab-content.active.dialogues-layout {
  flex-direction: row;
}

.dialogue-list-side {
  flex: 0 0 30%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.dialogue-list-side .side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dialogue-list-side .side-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.dialogue-list-side #dialogue-list {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.dialogue-editor-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

#dialogue-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ===================================================
   NODE LIST (Dialogue editor)
   =================================================== */
.node-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.node-card-header .node-index {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.node-card-header select {
  flex-shrink: 0;
  width: auto;
  padding: 4px 28px 4px 8px;
  font-size: 0.82rem;
}

.node-card-header .btn-sm {
  margin-left: auto;
}

.node-card textarea {
  font-size: 0.88rem;
  min-height: 50px;
}

.node-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.node-card-footer label {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.node-card-footer input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.choices-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choices-section label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.choice-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.choice-row input[type="text"] {
  flex: 1;
  font-size: 0.85rem;
  padding: 5px 8px;
}

.choice-row input[type="text"].next-id {
  flex: 0 0 120px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.choice-row .choice-dlg {
  flex: 0 0 150px;
  font-size: 0.78rem;
  padding: 4px 24px 4px 8px;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ===================================================
   FILE TAB
   =================================================== */
.file-info-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-info-box p {
  font-size: 0.88rem;
  color: var(--text-dim);
}

.file-info-box strong {
  color: var(--text);
  min-width: 80px;
  display: inline-block;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-action-btn {
  min-width: 160px;
  padding: 14px 20px;
  flex-direction: column;
  gap: 6px;
  border-radius: 10px;
  cursor: pointer;
}

.file-action-btn .btn-icon {
  font-size: 1.6rem;
}

/* ===================================================
   QUIZ ANSWERS
   =================================================== */
.quiz-answer-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.quiz-answer-row input[type="text"] {
  flex: 1;
}

.quiz-answer-row input[type="checkbox"] {
  width: auto;
  accent-color: var(--success);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.quiz-answer-row .btn-sm {
  padding: 4px 8px;
}

/* ===================================================
   LEAFLET OVERRIDES
   =================================================== */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip {
  background: var(--surface) !important;
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  font-family: 'Segoe UI', system-ui, sans-serif !important;
  font-size: 0.9rem !important;
  line-height: 1.5 !important;
}

.leaflet-popup-content strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.leaflet-popup-content .popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.leaflet-popup-content .popup-actions button {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}

.leaflet-popup-content .popup-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.leaflet-popup-close-button {
  color: var(--text-dim) !important;
  font-size: 1.2rem !important;
  padding: 6px 8px !important;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface2) !important;
}

.leaflet-control-attribution {
  background: rgba(15, 15, 30, 0.75) !important;
  color: var(--text-dim) !important;
  font-size: 0.7rem !important;
}

.leaflet-control-attribution a { color: var(--accent) !important; }

/* ===================================================
   ABLAUF – NODE GRAPH
   =================================================== */

/* Hint bar */
#flow-hint-bar {
  flex-shrink: 0;
  padding: 7px 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* Canvas wrapper */
#flow-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: auto;
  background: var(--bg);
  background-image:
    radial-gradient(circle, rgba(124,159,245,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}

#flow-svg {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  overflow: visible;
}

#flow-nodes {
  position: relative;
}

/* ── Node Cards ── */
.fn-card {
  position: absolute;
  border-radius: 12px;
  overflow: visible;   /* allow ports to extend outside */
  user-select: none;
}

/* Zone card */
.fn-zone {
  border: 2px solid rgba(124,159,245,0.45);
  background: rgba(124,159,245,0.06);
  min-width: 240px;
}

/* Task card (middle column) */
.fn-task {
  border: 2px solid rgba(255,183,77,0.45);
  background: rgba(255,183,77,0.06);
  min-width: 200px;
}

/* Dialogue card */
.fn-dialogue {
  border: 2px solid rgba(93,173,226,0.6);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  min-width: 210px;
}

/* ── Headers ── */
.fn-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  border-radius: 10px 10px 0 0;
}

.fn-zone-header {
  background: rgba(124,159,245,0.18);
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}
.fn-zone-header:hover { background: rgba(124,159,245,0.3); }

.fn-dlg-header {
  background: rgba(93,173,226,0.2);
  font-weight: 700;
  color: #5DADE2;
  cursor: pointer;
  transition: background 0.15s;
}
.fn-dlg-header:hover { background: rgba(93,173,226,0.35); }

.fn-task-header {
  background: rgba(255,183,77,0.18);
  font-weight: 700;
  color: #FFB74D;
  cursor: pointer;
  transition: background 0.15s;
}
.fn-task-header:hover { background: rgba(255,183,77,0.3); }

/* Sequenz-Titel in Zone-Karte */
.fn-seq-title {
  padding: 5px 14px 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.75;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

/* Sequenz-Zeilen-Nummer */
.fn-seq-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.7;
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
}

/* Gefüllter Sequenz-Slot */
.fn-seq-filled {
  background: rgba(124,159,245,0.05);
}
.fn-seq-filled .fn-seq-num { opacity: 1; }

/* Leerer Sequenz-Slot (Hinweis) */
.fn-seq-empty {
  opacity: 0.55;
  font-style: italic;
}
.fn-seq-empty .fn-row-label { color: var(--text-dim); }
.fn-seq-empty:hover { opacity: 0.85; background: rgba(124,159,245,0.08); }

/* ── Rows (within zone card) ── */
.fn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: relative;
  transition: background 0.12s;
}
.fn-row:last-child  { border-bottom: none; border-radius: 0 0 10px 10px; }
.fn-row:hover       { background: rgba(255,255,255,0.04); }
.fn-row.clickable   { cursor: pointer; }

.fn-row-icon {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.fn-row-label {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

/* Dialogue meta */
.fn-meta {
  padding: 7px 14px;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-radius: 0 0 10px 10px;
}

/* ── Port circles ── */
.fn-port {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: crosshair;
  z-index: 10;
  top: 50%;
  transform: translateY(-50%);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.fn-port:hover {
  border-color: var(--accent);
  background: var(--accent);
  transform: translateY(-50%) scale(1.4);
}
.fn-port-out { right: -8px; }
.fn-port-in  { left:  -8px; }

.fn-port.connected {
  border-color: var(--accent);
  background: rgba(124,159,245,0.45);
}
.fn-port-in.connected {
  border-color: #5DADE2;
  background: rgba(93,173,226,0.45);
}
/* Task zone-input port: orange when connected */
.fn-port-in.zone-connected {
  border-color: #FFB74D;
  background: rgba(255,183,77,0.45);
}

/* Empty state */
.fn-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

/* Drag cursor */
body.flow-dragging,
body.flow-dragging * { cursor: crosshair !important; }

/* ===================================================
   UPLOAD RESULT MESSAGE
   =================================================== */
.upload-msg {
  margin-top: 12px;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.upload-msg--success {
  background: rgba(102, 187, 106, 0.12);
  border: 1px solid rgba(102, 187, 106, 0.35);
  color: #66BB6A;
}

.upload-msg--error {
  background: rgba(239,83,80,0.12);
  border: 1px solid rgba(239,83,80,0.3);
  color: var(--error);
}

/* GWR badge */
.gwr-copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gwr-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(124,159,245,0.12);
  border: 1.5px solid rgba(124,159,245,0.4);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.inline-copy-gwr {
  margin-left: 8px;
  vertical-align: middle;
}

/* ===================================================
   ZONE ITEMS (Gegenstände)
   =================================================== */
.item-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.item-row-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.item-row-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.badge-sm {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(124, 159, 245, 0.15);
  color: var(--accent);
  border: 1px solid rgba(124, 159, 245, 0.3);
  margin-left: 4px;
  vertical-align: middle;
}

/* ===================================================
   SUB-FORM (Item Bearbeitung innerhalb Zone)
   =================================================== */
.sub-form {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.sub-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* Drawing cursor */
body.draw-mode { cursor: crosshair !important; }
body.draw-mode #map { cursor: crosshair !important; }

.message-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.72);
}
.message-modal-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 18px 70px rgba(0,0,0,0.45);
}
.message-modal-card h2 { color: var(--accent); margin-bottom: 10px; font-size: 1.1rem; }
.message-modal-text { line-height: 1.55; white-space: pre-wrap; margin-bottom: 12px; }
.message-modal-text hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.message-modal textarea {
  width: 100%;
  min-height: 90px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  resize: vertical;
  margin-bottom: 10px;
}
.message-modal label { display: flex; gap: 8px; align-items: center; color: var(--text-dim); margin-bottom: 12px; }
.message-modal .btn:disabled { opacity: .45; cursor: default; }
