/* ========================= NETZWERK-ROUTING APP STYLES ========================= */

/* ===== CSS CUSTOM PROPERTIES (THEME SYSTEM) ===== */
* {
  font-family:'Avenir','Helvetica',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Dark Theme (Standard) */
:root{
  --bg:#151515;
  --panel:#222222;
  --text:#e5ecff;
  --muted:#9aa4b2;
  --border:#454545;
  --primary:#38bdf8;
  --primary-h:#0ea5e9;
  --danger:#ef4444;
  --shadow:rgba(0,0,0,.35);
  --chip:#1b2437;
  --list:#2e2e2e;
  --overlay:#00000080;
  --sidebar-width: 460px;
}

/* Light Theme */
:root[data-theme="light"]{
  --bg:#f5f7fb;
  --panel:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#0ea5e9;
  --primary-h:#0284c7;
  --danger:#ef4444;
  --shadow:rgba(16,24,40,.06);
  --chip:#e5e7eb;
  --list:#fafafa;
  --overlay:#00000040;
}

/* ===== LAYOUT STRUCTURE ===== */
body{
  margin:0;
  background:var(--bg);
  color:var(--text)
}

.container{
  display:flex;
  height:100vh;
  position:relative
}

/* ===== SIDEBAR ===== */
.sidebar{
  width: var(--sidebar-width);
  background:var(--panel);
  padding:20px;
  box-shadow:2px 0 10px var(--shadow);
  overflow-y:auto;
  transition: width .22s ease, transform .22s ease, padding .22s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

body[data-collapsed="1"] .sidebar{
  transform: translateX(-100%);
  width: 0;
  padding: 0;
  box-shadow: none;
}

/* ===== MAP CONTAINER ===== */
.map-container{
  flex:1;
  position:relative
}

#map{
  width:100%;
  height:100%
}

/* ===== SIDEBAR RESIZER ===== */
.resizer{
  width: 6px;
  cursor: col-resize;
  background: transparent;
  transition: background-color .15s ease;
}

.resizer:hover{
  background: rgba(14,165,233,.25);
}

.resizer:active{
  background: rgba(14,165,233,.45);
}

body[data-collapsed="1"] .resizer{
  display:none;
}

/* ===== COLLAPSE BUTTON ===== */
.collapse-btn {
  position: absolute;
  z-index: 1200;
  top: 10px;
  left: 11px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0px 8.5px 1px 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--shadow);
  font-size: 25px;
  font-weight: bolder;
}

body[data-collapsed="1"] .collapse-btn{
  left:10px;
}

/* ===== TYPOGRAPHY ===== */
h2{
  margin:0 0 8px
}
h3{
  margin:0 0 8px;
  font-size:16px
}

/* ===== HEADER & NAVIGATION ===== */
.header-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px
}

.header-line .inline{
  flex-wrap: nowrap;
  gap: 6px;
}

.header-line .button{
  margin-right: 0;
  padding: 6px 9px;
  font-size: 18px;
  line-height: 1;
  border-radius: 8px;
}

/* ===== TAB SYSTEM ===== */
.tabs{
  display:flex;
  border-bottom:1px solid var(--border);
  margin-bottom:12px
}

.tab{
  padding:10px 14px;
  cursor:pointer;
  border:1px solid var(--border);
  border-bottom:none;
  border-radius:10px 10px 0 0;
  background:var(--list);
  margin-right:8px;
  font-weight:600;
  color:var(--text);
  opacity:.85;
}

.tab.active{
  background:var(--panel);
  opacity:1
}

.panel{
  display:none
}
.panel.active{
  display:block
}

/* ===== GLOBAL SEARCH ===== */
.global-search {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.global-search input {
  background: var(--list);
  border: 1px solid var(--border);
}

.global-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.global-search .button {
  margin-right: 0;
  margin-bottom: 0;
}

/* ===== SECTIONS ===== */
.section{
  margin-bottom:18px;
  padding-bottom:14px;
  border-bottom:1px solid var(--border)
}

/* ===== COLLAPSIBLE SECTIONS ===== */
.collapsible .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 8px 0;
  transition: all 0.2s ease;
  user-select: none;
}

.collapsible .section-header:hover {
  background: rgba(56, 189, 248, 0.05);
  border-radius: 6px;
  padding-left: 8px;
  padding-right: 8px;
}

.collapse-icon {
  font-size: 18px;
  font-weight: bold;
  color: var(--muted);
  transition: transform 0.3s ease, color 0.2s ease;
  min-width: 20px;
  text-align: center;
}

.section-header:hover .collapse-icon {
  color: var(--primary);
}

.collapsible.collapsed .collapse-icon {
  transform: rotate(90deg);
}

.section-content {
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  max-height: 1000px;
  opacity: 1;
}

.collapsible.collapsed .section-content {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.collapsible.loaded .section-header h3::after {
  content: " ✓";
  color: var(--primary);
  margin-left: 8px;
}

/* ===== BUTTONS ===== */
.button{
  background:var(--primary);
  color:#fff;
  border:none;
  padding:10px 14px;
  border-radius:8px;
  cursor:pointer;
  font-size:14px;
  margin-right:8px;
  margin-bottom:8px;
  transition: all 0.2s ease;
}

.button:hover{
  background:var(--primary-h)
}

.secondary{
  background:#444444
}
.secondary:hover{
  background:#475569
}

:root[data-theme="light"] .secondary{
  background:#6b7280
}
:root[data-theme="light"] .secondary:hover{
  background:#4b5563
}

.danger{
  background:var(--danger)
}
.danger:hover{
  background:#dc2626
}

/* ===== INPUT ELEMENTS ===== */
input[type="text"], input[type="number"], select {
  border:1px solid var(--border);
  background:var(--list);
  color:var(--text);
  border-radius:8px;
  padding:8px;
  font-size:14px;
  outline:none;
  transition: all 0.2s ease;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* ===== FILE INPUTS ===== */
input[type="file"] {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--list);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="file"]:hover, input[type="file"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* ===== RANGE INPUTS ===== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  outline: none;
  border-radius: 3px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* ===== COLOR INPUTS ===== */
input[type="color"] {
  width: 40px;
  height: 35px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 2px;
  transition: all 0.2s ease;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

/* ===== CHECKBOXES ===== */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===== SELECT DROPDOWN ===== */
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'><polyline points='6,9 12,15 18,9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  cursor: pointer;
}

/* ===== LAYOUT HELPERS ===== */
.inline{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap
}

.info{
  font-size:13px;
  color:var(--muted)
}
.label{
  font-size:14px;
  color:var(--muted)
}
.filemeta{
  font-size:12px;
  color:var(--muted)
}

/* ===== EXPORT-SEKTION STYLING ===== */
.export-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  background: var(--list);
  border-radius: 8px;
  min-height: 48px;
  align-items: center;
}

.export-status-pills:empty {
  display: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chip);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.pill-icon {
  font-size: 14px;
  line-height: 1;
}

.export-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--list);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.button-group:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.1);
}

.button-group-title {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.button-group-icon {
  font-size: 14px;
}

.button.compact {
  padding: 8px 12px;
  font-size: 13px;
  margin: 0;
  flex: 1 1 auto;
  min-width: 120px;
  white-space: nowrap;
}

.export-advanced {
  padding: 12px;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  margin-top: 8px;
}

/* ===== LISTS ===== */
.list{
  max-height:220px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px;
  background:var(--list)
}

/* ===== WAYPOINT ITEMS ===== */
.wp-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 0;
  font-size:13px
}

.wp-item:not(:last-child){
  border-bottom:1px solid var(--border)
}

.wp-coord{
  color:var(--muted)
}

/* ===== REMOVE BUTTON ===== */
.remove{
  background:var(--danger);
  color:#fff;
  border:none;
  padding:2px 8px;
  border-radius:14px;
  cursor:pointer;
  font-size:12px;
  line-height:22px
}

/* ===== STATUS MESSAGES ===== */
.status{
  padding:10px;
  border-radius:8px;
  margin-top:10px;
  font-size:13px;
  border:1px solid transparent
}

.status.success{
  background:rgba(16,185,129,.12);
  color:#a7f3d0;
  border-color:rgba(16,185,129,.35)
}

.status.error{
  background:rgba(239,68,68,.12);
  color:#fecaca;
  border-color:rgba(239,68,68,.35)
}

.status.info{
  background:rgba(59,130,246,.12);
  color:#bfdbfe;
  border-color:rgba(59,130,246,.35)
}

:root[data-theme="light"] .status.success{
  background:#ecfdf5;
  color:#065f46;
  border-color:#a7f3d0
}
:root[data-theme="light"] .status.error{
  background:#fef2f2;
  color:#991b1b;
  border-color:#fecaca
}
:root[data-theme="light"] .status.info{
  background:#eff6ff;
  color:#1e40af;
  border-color:#bfdbfe
}

/* ===== ERROR BOXES ===== */
.errors-box{
  background:rgba(239,68,68,.1);
  border:1px solid rgba(239,68,68,.35);
  color:#ffb4b4;
  border-radius:8px;
  padding:10px;
  margin-top:10px;
  display:none
}

:root[data-theme="light"] .errors-box{
  color:#7c2d12;
  background:#fff7ed;
  border-color:#fed7aa
}

.errors-list{
  font-size:12px;
  max-height:160px;
  overflow:auto;
  margin:0;
  padding-left:16px
}

/* ===== SETTINGS MODAL ===== */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:var(--overlay);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:9999;
  backdrop-filter: blur(4px);
}

.modal{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  min-width:480px;
  max-width:640px;
  padding:24px;
  box-shadow:0 25px 60px var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3{
  margin:0 0 20px;
  font-size:20px;
  font-weight:700;
  color:var(--text);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}

/* ===== TOGGLE SWITCHES ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 30px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
  background: var(--primary);
}

input:checked + .toggle-slider:before {
  transform: translateX(30px);
}

/* ===== SETTINGS ROWS ===== */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

:root[data-theme="light"] .settings-row {
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.settings-description {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 0 0;
  line-height: 1.4;
}

/* ===== COLOR GRID ===== */
.color-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 16px;
  align-items: center;
  margin: 16px 0;
}

.color-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.color-input {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  background: none;
  padding: 4px;
  transition: all 0.2s ease;
}

.color-input:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.color-input::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}
.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 8px;
}

/* ===== RANGE CONTROLS (SETTINGS) ===== */
.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 12px 0;
}

.range-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.range-control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.range-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(to right, var(--primary) 0%, var(--primary) 50%, var(--border) 50%, var(--border) 100%);
  outline: none;
  border-radius: 3px;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.range-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.range-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  min-width: 60px;
  text-align: right;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Courier, monospace;
}

/* ===== SELECT INPUTS (SETTINGS) ===== */
.select-input {
  background: var(--list);
  border: 2px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 40px 10px 12px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'><polyline points='6,9 12,15 18,9'></polyline></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.select-input:hover, .select-input:focus {
  border-color: var(--primary);
  background-color: var(--panel);
}

/* ===== CUSTOM CHECKBOXES ===== */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
}

.custom-checkbox {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.custom-checkbox input {
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background: var(--list);
  border: 2px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.custom-checkbox:hover .checkbox-checkmark {
  border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkbox-checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.custom-checkbox input:checked ~ .checkbox-checkmark:after {
  display: block;
}

.custom-checkbox .checkbox-checkmark:after {
  left: 6px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox-description {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ===== MODAL ACTIONS ===== */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.modal-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.modal-button:hover {
  background: var(--primary-h);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.modal-button.secondary {
  background: var(--list);
  color: var(--text);
  border: 2px solid var(--border);
  box-shadow: none;
}

.modal-button.secondary:hover {
  background: var(--border);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.settings-separator {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 24px 0;
}

.theme-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.theme-indicator::before {
  content: "🌙";
}

:root[data-theme="light"] .theme-indicator::before {
  content: "☀️";
}

/* ===== LAYER CONTROL PANEL ===== */
.layer-control-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  pointer-events: auto;
}

.layer-control-toggle {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
}

.layer-control-toggle:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.layer-control-content {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 0 8px 32px var(--shadow);
  backdrop-filter: blur(10px);
  display: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s ease;
}

.layer-control-panel.open .layer-control-content {
  display: block;
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.layer-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.layer-control-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.layer-control-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.layer-control-close:hover {
  background: var(--border);
  color: var(--text);
}

.layer-control-items {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.layer-control-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease;
  font-size: 13px;
  user-select: none;
}

.layer-control-item:hover {
  background: rgba(56, 189, 248, 0.1);
}

.layer-control-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.layer-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.layer-control-item span:last-child {
  flex: 1;
  color: var(--text);
}

.layer-control-actions {
  padding: 8px 12px 12px;
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border);
}

.layer-btn {
  flex: 1;
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.layer-btn:hover {
  background: var(--primary-h);
  transform: translateY(-1px);
}

.layer-btn.secondary {
  background: var(--border);
  color: var(--text);
}

.layer-btn.secondary:hover {
  background: var(--muted);
  color: var(--panel);
}

.layer-btn.small {
  font-size: 11px;
  padding: 4px 8px;
}

.layer-control-toggle #layerControlIcon {
  transition: transform 0.3s ease;
}

.layer-control-panel.open .layer-control-toggle #layerControlIcon {
  transform: rotate(180deg);
}

/* ===== OSM FILTER TABLE ===== */
.filter-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px
}

.filter-table th,.filter-table td{
  border-bottom:1px solid var(--border);
  padding:6px 4px;
  text-align:left
}

.filter-table th{
  text-transform:uppercase;
  font-size:12px;
  color:var(--muted)
}

.filter-badge{
  font-size:11px;
  opacity:.8
}

/* ===== LOADER ===== */
.loader-backdrop{
  position:fixed;
  inset:0;
  z-index:10000;
  display:none;
  align-items:center;
  justify-content:center;
  background: var(--overlay);
  backdrop-filter: blur(2px);
}

.loader-panel{
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 280px;
  max-width: 86vw;
  padding: 18px 20px;
  box-shadow: 0 20px 50px var(--shadow);
  text-align: center;
}

.loader-row{
  display:flex;
  align-items:center;
  gap:12px;
  justify-content:center;
}

.loader-msg{
  font-size:14px;
  opacity:.9;
}

.loader-spinner{
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  animation: spn 0.9s linear infinite;
}

.loader-actions{
  display:flex;
  justify-content:center;
  margin-top:12px;
}

.loader-cancel{
  background:#374151;
  color:#fff;
  border:none;
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  transition: all 0.2s ease;
}

.loader-cancel:hover{
  background:#1f2937;
}

:root[data-theme="light"] .loader-cancel{
  background:#6b7280;
}

:root[data-theme="light"] .loader-cancel:hover{
  background:#4b5563;
}

@keyframes spn {
  to {
    transform: rotate(360deg);
  }
}

/* ===== LEAFLET CUSTOMIZATIONS ===== */
.leaflet-top {
  top: 40px;
}

.station-tooltip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
}

.stop-svg-icon {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== GTFS-SPEZIFISCHE STYLES ===== */
.gtfs-stats {
  background: var(--list);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  line-height: 1.6;
}

.gtfs-routes-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--list);
}

.gtfs-route-item {
  border-bottom: 1px solid var(--border);
}

.gtfs-route-item:last-child {
  border-bottom: none;
}

.gtfs-route-label {
  display: block;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.gtfs-route-label:hover {
  background: rgba(56, 189, 248, 0.1);
}

.gtfs-route-checkbox {
  margin-right: 10px;
}

.gtfs-route-info {
  display: inline-block;
  width: calc(100% - 30px);
}

.gtfs-route-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.gtfs-route-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.gtfs-route-name {
  font-weight: 600;
  color: var(--text);
}

.gtfs-route-type {
  font-size: 11px;
  background: var(--chip);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.gtfs-route-description {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.route-type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.route-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--chip);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.route-type-chip:hover {
  background: var(--primary);
  color: white;
}

.route-type-chip.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== STOP TYPE INDICATORS ===== */
.stop-type-indicator {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid white;
  vertical-align: middle;
  margin-right: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.stop-type-indicator.position {
  background: var(--primary);
}

.stop-type-indicator.platform {
  background: #808080;
}

#stopDetailOptions[style*="opacity: 0.4"] input[type="checkbox"] {
  cursor: not-allowed;
}

.stop-type-info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--text);
}

.stop-popup {
  min-width: 200px;
  max-width: 350px;
}

.stop-name-primary {
  color: var(--primary);
  font-size: 15px;
  display: block;
  margin-bottom: 6px;
  line-height: 1.3;
}

.stop-name-intl {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  line-height: 1.4;
}

.stop-info {
  font-size: 12px;
  margin: 6px 0;
  padding: 4px;
  background: rgba(56, 189, 248, 0.08);
  border-radius: 4px;
}

.stop-type {
  font-weight: 600;
  color: var(--text);
}

.stop-ref {
  color: var(--primary);
  font-weight: 600;
}

.stop-mode, .stop-lines, .stop-operator {
  font-size: 12px;
  margin: 4px 0;
  color: var(--text);
}

.stop-lines {
  font-weight: 500;
}

.stop-operator {
  color: var(--muted);
  font-size: 11px;
}

.stop-tooltip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 8px var(--shadow);
  max-width: 300px;
  white-space: normal;
  line-height: 1.3;
}

.stop-tooltip .ref {
  color: var(--primary);
  font-weight: 600;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px){
  .sidebar {
    width: 360px;
    --sidebar-width: 360px;
  }
  
  .inline {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 820px){
  .resizer{
    width:4px;
  }
}

/* ===== MOBILE SIDEBAR OVERLAY ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 2000;
    max-width: 85vw;
    width: var(--sidebar-width);
    transform: translateX(0);
  }

  body[data-collapsed="1"] .sidebar {
    transform: translateX(-100%);
  }

  .map-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  body[data-collapsed="0"] .map-container::before {
    opacity: 1;
    pointer-events: auto;
  }

  .resizer {
    display: none;
  }

  .collapse-btn {
    z-index: 2100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .button.compact {
    min-width: 100px;
    flex: 1 1 calc(50% - 4px);
  }

  .export-status-pills {
    flex-direction: column;
    align-items: stretch;
  }

  .pill {
    justify-content: center;
  }

  .header-line {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-line h2 {
    text-align: center;
  }

  .tabs {
    justify-content: center;
  }

  .inline {
    flex-direction: column;
    align-items: stretch;
  }

  .collapse-btn {
    font-size: 20px;
    padding: 4px 8px;
  }

  .layer-control-panel {
    top: 50px;
  }
  
  .layer-control-content {
    min-width: 200px;
    right: -5px;
  }
  
  .layer-control-item {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  .layer-icon {
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  .modal {
    margin: 20px;
    min-width: auto;
    max-width: calc(100vw - 40px);
    padding: 20px;
  }

  .color-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .range-control {
    min-width: auto;
  }

  .modal-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .sidebar {
    max-width: 100vw;
    width: 100vw;
    padding: 15px;
  }

  .button.compact {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .button-group-title {
    font-size: 12px;
  }
}

/* ===== TOUCH-OPTIMIERUNG ===== */
@media (pointer: coarse) {
  .button {
    min-height: 44px;
    padding: 12px 16px;
  }

  .button.compact {
    min-height: 40px;
    padding: 10px 14px;
  }

  input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .section-header {
    min-height: 48px;
    padding: 12px 0;
  }

  .collapse-icon {
    font-size: 22px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .button:active {
    transform: scale(0.97);
  }

  .section-header:active {
    background: rgba(56, 189, 248, 0.08);
  }
}

/* ===== SMOOTH TRANSITIONS ===== */
.button-group,
.export-status-pills,
.section {
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .sidebar, .resizer, .collapse-btn, .layer-control-panel {
    display: none;
  }
  .map-container {
    width: 100%;
    height: 100vh;
  }
}