:root {
  --bg: #0d1321;
  --panel: #151d31;
  --panel-2: #1d2842;
  --line: rgba(255,255,255,0.09);
  --text: #f4f7fb;
  --muted: #a8b5ce;
  --accent: #7bdff2;
  --accent-2: #b2f7ef;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(123,223,242,0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(178,247,239,0.12), transparent 22%),
    linear-gradient(180deg, #0a1020 0%, var(--bg) 100%);
  color: var(--text);
}

a { color: inherit; }
code {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.15rem 0.4rem;
}

.site-header,
.site-footer,
.layout-home,
.layout-trip {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-logo h1 {
  margin: 0;
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
}

.header-logo .logo-icon {
  font-size: 1.8rem;
}

.header-logo img {
  height: 48px;
  width: auto;
  display: block;
}

.top-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.top-nav a,
.nav-dropdown-toggle {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  color: var(--text);
}

.top-nav a:hover,
.nav-dropdown-toggle:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--accent);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-right {
  margin-left: auto;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 220px;
  padding: 8px;
  z-index: 1000;
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 4px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  color: var(--text);
}

.nav-dropdown-menu a:hover {
  background: rgba(255,255,255,0.08);
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--accent-2);
}

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: clamp(2rem, 4vw, 3.6rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.1rem; }
.lead, .muted, .trip-card p, .stop-card p, .meta-list li, .poi-chip { color: var(--muted); }

.layout-home,
.layout-trip {
  display: grid;
  gap: 20px;
  padding-bottom: 32px;
}

.hero-card,
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.panel { padding: 22px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.trip-list,
.stops-list {
  display: grid;
  gap: 14px;
}

.trip-card,
.stop-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.trip-card {
  grid-template-columns: 1.4fr 1fr auto;
  align-items: center;
}

.trip-card .meta,
.stop-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.poi-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(123,223,242,0.08);
  font-size: 0.92rem;
}

.stats-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stat-badge {
  font-weight: 600;
  white-space: nowrap;
}

.stat-badge span {
  color: var(--accent);
  font-weight: 700;
}

.trip-link {
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #06121f;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.map {
  width: 100%;
  height: 460px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.map-large { height: 600px; }

.stop-card {
  grid-template-columns: 88px 1.2fr 1fr;
}

.stop-index {
  display: grid;
  place-items: center;
  background: rgba(123,223,242,0.1);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 1.8rem;
  font-weight: 800;
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.poi-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.site-footer {
  padding: 32px 0 40px;
  margin-top: 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 0.9rem;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f1728;
  color: var(--text);
  border: 1px solid var(--line);
}

.leaflet-popup-content {
  margin: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
}

.popup-card h3 { 
  margin-bottom: 8px;
  color: var(--accent);
}

.popup-card p { 
  margin: 0 0 8px; 
  color: var(--muted);
  line-height: 1.5;
}

.popup-card a { 
  color: var(--accent);
  text-decoration: none;
  padding: 6px 12px;
  background: rgba(123,223,242,0.1);
  border-radius: 8px;
  display: inline-block;
  margin-top: 8px;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.popup-card a:hover {
  background: rgba(123,223,242,0.2);
  border-color: var(--accent);
}

.popup-card .popup-meta {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
  margin: 8px 0;
}

.popup-card .popup-meta span {
  color: var(--text);
}

/* Nummerierte Marker */
.leaflet-div-icon {
  background: var(--accent);
  border: 3px solid #0f1728;
  border-radius: 50%;
  font-weight: bold;
  color: #06121f;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  touch-action: manipulation;
}

.leaflet-div-icon.poi-marker {
  background: var(--accent-2);
  border-color: var(--accent);
}

/* Leaflet Controls auf Touch-Geräten optimiert */
.leaflet-control-zoom a,
.leaflet-control-layers-toggle {
  width: 36px;
  height: 36px;
  line-height: 36px;
}

.leaflet-touch .leaflet-control-zoom a,
.leaflet-touch .leaflet-control-layers-toggle {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 20px;
}

/* Routing Control verstecken (nur Route anzeigen) */
.leaflet-routing-container {
  display: none;
}

.leaflet-control-container .leaflet-routing-container-hide {
  display: none;
}

/* Route-Linie Style */
.leaflet-routing-line {
  stroke: var(--accent);
  stroke-width: 4;
  stroke-opacity: 0.7;
}

/* Distanz-Badge in Stop-Cards */
.distance-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(123,223,242,0.12);
  border: 1px solid var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 8px;
  color: var(--text);
}

.distance-badge:hover {
  background: rgba(123,223,242,0.2);
}

/* Distance separator between stops */
.distance-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
  position: relative;
  min-height: 100px;
}

.distance-separator::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, 
    transparent 0%, 
    var(--accent) 15%, 
    var(--accent) 85%, 
    transparent 100%);
  transform: translateX(-50%);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.distance-separator-content {
  background: var(--panel-2);
  border: 2px solid var(--accent);
  border-radius: 999px;
  padding: 14px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 16px rgba(123, 223, 242, 0.25);
}

.distance-separator-content .distance-km {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.distance-separator-content .distance-time {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

/* Route labels on map */
.route-label {
  background: rgba(15, 23, 40, 0.5);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.7), 0 0 20px rgba(123, 223, 242, 0.4);
  color: white;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.route-label .label-distance {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.route-label .label-time {
  font-size: 0.7rem;
  color: #b2f7ef;
  font-weight: 500;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  line-height: 1.2;
}

@media (max-width: 980px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-logo {
    width: 100%;
  }

  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .section-head,
  .trip-card,
  .stop-card,
  .hero-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Dropdown auf Tablet-Größe optimiert */
  .nav-dropdown-menu {
    min-width: 240px;
  }
}

@media (max-width: 720px) {
  .layout-home,
  .layout-trip,
  .site-header,
  .site-footer {
    width: min(100% - 20px, 1280px);
  }

  .map,
  .map-large {
    height: 380px;
  }
  
  .distance-separator-content {
    padding: 10px 18px;
  }
  
  .distance-separator-content .distance-km {
    font-size: 1rem;
  }
  
  .distance-separator-content .distance-time {
    font-size: 0.85rem;
  }
  
  .route-label {
    padding: 3px 6px;
  }
  
  .route-label .label-distance {
    font-size: 0.75rem;
  }
  
  .route-label .label-time {
    font-size: 0.65rem;
  }

  /* Größere Touch-Targets auf Mobile */
  .top-nav a,
  .nav-dropdown-toggle {
    padding: 12px 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-dropdown-menu a {
    padding: 14px 16px;
    min-height: 44px;
  }

  .trip-link {
    padding: 14px 20px;
    min-height: 44px;
  }

  .badge {
    padding: 10px 12px;
  }

  /* Header-Navigation auf Mobile optimiert */
  .site-header {
    padding: 16px 0 14px;
    margin-bottom: 20px;
  }

  .header-logo h1 {
    font-size: 1.3rem;
  }

  .header-subtitle {
    font-size: 0.8rem;
  }

  .header-logo img {
    height: 40px;
  }

  /* Panels und Cards auf Mobile */
  .panel,
  .hero-card {
    padding: 18px;
    border-radius: 18px;
  }

  .trip-card,
  .stop-card {
    padding: 16px;
    border-radius: 16px;
  }

  /* Dropdown-Menü auf Mobile angepasst */
  .nav-dropdown-menu {
    position: fixed;
    top: auto;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  /* Bessere Lesbarkeit */
  body {
    font-size: 15px;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1rem;
  }

  .eyebrow {
    font-size: 0.75rem;
  }
}

/* Extra kleine Bildschirme (Smartphones im Hochformat) */
@media (max-width: 480px) {
  .layout-home,
  .layout-trip,
  .site-header,
  .site-footer {
    width: calc(100% - 16px);
  }

  .hero-card,
  .panel {
    padding: 16px;
    border-radius: 16px;
  }

  .trip-card,
  .stop-card {
    padding: 14px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .section-head .muted {
    font-size: 0.85rem;
  }

  .top-nav {
    gap: 6px;
  }

  .hero-badges {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .badge {
    width: 100%;
    justify-content: center;
  }

  .stats-badges {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .stat-badge {
    width: 100%;
    justify-content: center;
  }

  .footer-links {
    flex-direction: column;
    gap: 12px;
  }
}
