/* =========================================================
   KISS FM KIEZ WM – Fanzone-Karte
   CI: Roboto · Schwarz / Weiß / Rot (#FF0000)
   ========================================================= */

:root {
  --rot: #ff0000;
  --rot-dark: #cc0000;
  --schwarz: #000000;
  --weiss: #ffffff;

  --ink: #0a0a0a;
  --ink-soft: #5a5a5a;
  --line: #e6e6e6;
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
  --bg-mute: #fafafa;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, .12);
  --shadow-lg: 0 -8px 30px rgba(0, 0, 0, .18);

  --header-h: 60px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* App-Shell: nur innere Bereiche scrollen */
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--rot);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 2000;
  background: var(--schwarz);
  color: var(--weiss);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: calc(var(--safe-top) + 8px); text-decoration: none; }

/* ---------------- Header ---------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: var(--schwarz);
  color: var(--weiss);
  padding-top: var(--safe-top);
  box-shadow: var(--shadow-sm);
}
.app-header__inner {
  height: var(--header-h);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--weiss);
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand__logo {
  display: block;
  height: 38px;
  width: auto;
}
.brand__sub {
  font-weight: 700;
  font-size: .62rem;
  letter-spacing: 2.5px;
  color: var(--weiss);
  background: var(--rot);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  line-height: 1;
  white-space: nowrap;
}

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

/* ---------------- Sound / Live-Stream Button ---------------- */
.sound-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid rgba(255, 255, 255, .22);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .8);
  font: inherit;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.sound-btn:hover { color: var(--weiss); border-color: rgba(255, 255, 255, .4); }
.sound-btn .sound-btn__ico { flex: 0 0 auto; }
.sound-btn__ico--on { display: none; }
.sound-btn__eq { display: none; }
.sound-btn__label { letter-spacing: .5px; }

/* Aktiver Zustand: Ton an */
.sound-btn.is-on {
  background: var(--rot);
  border-color: var(--rot);
  color: var(--weiss);
  box-shadow: 0 2px 10px rgba(255, 0, 0, .45);
}
.sound-btn.is-on .sound-btn__ico--muted { display: none; }
.sound-btn.is-on .sound-btn__ico--on { display: block; }

/* Live-Equalizer Animation (nur sichtbar wenn Ton an) */
.sound-btn.is-on .sound-btn__eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}
.sound-btn__eq i {
  width: 3px;
  height: 100%;
  background: var(--weiss);
  border-radius: 2px;
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}
.sound-btn__eq i:nth-child(2) { animation-delay: .2s; }
.sound-btn__eq i:nth-child(3) { animation-delay: .4s; }
.sound-btn__eq i:nth-child(4) { animation-delay: .1s; }
@keyframes eq {
  0%, 100% { transform: scaleY(.35); }
  50% { transform: scaleY(1); }
}

/* Pulsierender Hinweis solange noch stumm */
.sound-btn:not(.is-on) .sound-btn__label::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--rot);
  vertical-align: middle;
  animation: livepulse 1.4s ease-in-out infinite;
}
@keyframes livepulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}

/* ---------------- Segmented Toggle ---------------- */
.segmented {
  position: relative;
  display: inline-flex;
  background: rgba(255, 255, 255, .12);
  border-radius: var(--radius-pill);
  padding: 4px;
  isolation: isolate;
}
.segmented__indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: var(--rot);
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(255, 0, 0, .45);
  transition: transform .32s var(--ease);
}
.segmented[data-active="hamburg"] .segmented__indicator { transform: translateX(100%); }
.segmented__btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .75);
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  padding: 8px 20px;
  min-width: 92px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color .2s var(--ease);
}
.segmented__btn.is-active { color: var(--weiss); }

/* ---------------- Layout ---------------- */
.layout {
  position: relative;
  height: calc(100dvh - var(--header-h) - var(--safe-top));
  display: grid;
  grid-template-columns: minmax(360px, 30vw) 1fr;
}

/* Panel (Liste) */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
  z-index: 600;
}
.sheet-handle { display: none; }

.hero {
  padding: 20px 20px 6px;
}
.hero__title {
  margin: 0 0 8px;
  font-weight: 900;
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem);
  line-height: 1.05;
  letter-spacing: -.5px;
}
.hero__title .accent { color: var(--rot); }
.hero__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: .95rem;
}
.hero__text strong { color: var(--ink); }

/* Toolbar / Suche */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 14px 20px 10px;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 14px;
  color: var(--ink-soft);
  pointer-events: none;
}
.search__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 13px 44px 13px 44px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--ink);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.search__input::placeholder { color: #9a9a9a; }
.search__input:focus {
  outline: none;
  border-color: var(--rot);
  background: var(--weiss);
}
.search__clear {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #e2e2e2;
  color: #333;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.search__clear:hover { background: #d4d4d4; }

.toolbar__count {
  margin: 10px 2px 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Liste */
.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(28px + var(--safe-bottom));
  scroll-padding-top: 8px;
}

.kiez-group { margin-top: 18px; }
.kiez-group:first-child { margin-top: 6px; }
.kiez-group__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 10px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.kiez-group__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Karte/Card */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--weiss);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.card:hover {
  border-color: #d0d0d0;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card:active { transform: translateY(0) scale(.995); }
.card.is-active {
  border-color: var(--rot);
  box-shadow: 0 0 0 2px rgba(255, 0, 0, .18), var(--shadow-md);
}

.card__top {
  display: flex;
  align-items: center;
  gap: 13px;
}
.card__pin {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--rot);
  color: var(--weiss);
  box-shadow: 0 3px 8px rgba(255, 0, 0, .28);
}
.card__pin svg { width: 21px; height: 21px; }

.card__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card__name {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.1px;
  overflow-wrap: anywhere;
}
.card__addr {
  font-size: .86rem;
  line-height: 1.35;
  color: var(--ink-soft);
}
.card__chevron {
  flex: 0 0 auto;
  color: #cbcbcb;
  display: flex;
  transition: color .18s var(--ease), transform .18s var(--ease);
}
.card__chevron svg { width: 18px; height: 18px; }
.card:hover .card__chevron { color: var(--rot); transform: translateX(2px); }
.card.is-active .card__chevron { color: var(--rot); }

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 53px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { text-decoration: none; border-color: #c9c9c9; }
.chip--primary {
  background: var(--schwarz);
  color: var(--weiss);
  border-color: var(--schwarz);
}
.chip--primary:hover { background: #1a1a1a; }
.chip svg { width: 15px; height: 15px; }

/* CTA am Listenende */
.list-cta {
  margin: 22px 4px 6px;
  padding: 22px;
  text-align: center;
  background: var(--schwarz);
  color: var(--weiss);
  border-radius: var(--radius);
}
.list-cta p {
  margin: 0 0 14px;
  font-weight: 700;
  font-size: 1rem;
}

/* Empty State */
.empty {
  margin: 10px 4px;
  padding: 30px 22px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-mute);
}
.empty__emoji { font-size: 2.4rem; line-height: 1; }
.empty__title {
  margin: 14px 0 6px;
  font-weight: 900;
  font-size: 1.25rem;
}
.empty__text {
  margin: 0 auto 18px;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: .95rem;
}
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--rot);
  color: var(--weiss);
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(255, 0, 0, .35);
}
.btn-cta:hover { background: var(--rot-dark); text-decoration: none; }

/* ---------------- Karte ---------------- */
.map-wrap {
  position: relative;
  min-height: 0;
  z-index: 400;
}
#map {
  position: absolute;
  inset: 0;
  background: var(--bg-soft);
}
.map-fab {
  position: absolute;
  right: 14px;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 900;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--weiss);
  color: var(--schwarz);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform .15s var(--ease), color .15s var(--ease);
}
.map-fab:hover { color: var(--rot); }
.map-fab:active { transform: scale(.94); }

/* Leaflet Marker (eigene DivIcons) */
.pin {
  width: 30px;
  height: 30px;
  position: relative;
  transition: transform .18s var(--ease);
}
.pin__dot {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--schwarz);
  border: 2px solid var(--weiss);
  box-shadow: var(--shadow-sm);
}
.pin__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--weiss);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}
.pin.is-active { transform: scale(1.25); z-index: 1000; }
.pin.is-active .pin__dot { box-shadow: 0 0 0 4px rgba(255, 0, 0, .25), var(--shadow-md); }

/* Leaflet Popup im CI */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.leaflet-popup-content { margin: 12px 14px; font-family: inherit; }
.popup__name { font-weight: 700; font-size: 1rem; }
.popup__addr { color: var(--ink-soft); font-size: .85rem; margin: 3px 0 8px; }
.popup__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: .85rem;
}
.leaflet-container { font-family: inherit; }
.leaflet-bar a { color: var(--schwarz); }

/* ---------------- Footer ---------------- */
.app-footer {
  display: none; /* auf Desktop in den Panel-Flow integriert; bleibt schlank */
}

/* =========================================================
   MOBILE: Karte oben + ziehbares Bottom-Sheet
   ========================================================= */
@media (max-width: 860px) {
  .layout {
    display: block;
    height: calc(100dvh - var(--header-h) - var(--safe-top));
    overflow: hidden;
  }

  .map-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  .panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    height: 100%;
    border-right: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    transform: translate3d(0, 60%, 0);
    transition: transform .42s cubic-bezier(.32, .72, 0, 1); /* iOS-artig */
    will-change: transform;
    backface-visibility: hidden;
  }
  .panel.is-dragging { transition: none; }

  /* Greifzone: Handle + Hero sind ziehbar (kein Browser-Scroll dort) */
  .sheet-handle,
  .panel > .hero {
    touch-action: none;
  }

  /* Liste scrollt normal */
  .list { touch-action: pan-y; }

  .sheet-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0 8px;     /* größere Trefferfläche */
    margin-top: -2px;
    cursor: grab;
  }
  .sheet-handle:active { cursor: grabbing; }
  .sheet-handle span {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: #d4d4d4;
    transition: background .2s var(--ease), width .2s var(--ease);
  }
  .panel.is-dragging .sheet-handle span { background: var(--rot); width: 56px; }

  /* Hero als Greifzone optisch andeuten */
  .panel > .hero { cursor: grab; padding: 2px 18px 4px; user-select: none; }
  .hero__title { font-size: 1.4rem; }
  .hero__text { font-size: .9rem; }

  .toolbar { padding: 10px 18px 8px; }
  .list { padding: 4px 14px calc(40px + var(--safe-bottom)); }

  .map-fab { bottom: auto; top: 14px; }
}

@media (max-width: 720px) {
  .sound-btn { padding: 0; width: 40px; justify-content: center; }
  .sound-btn__label { display: none; }
}
@media (max-width: 420px) {
  .app-header__inner { padding: 0 10px; }
  .header-right { gap: 8px; }
  .segmented__btn { min-width: 68px; padding: 8px 10px; font-size: .85rem; }
  .brand__logo { height: 30px; }
  .sound-btn { width: 38px; height: 38px; }
}
@media (max-width: 360px) {
  .brand__sub { display: none; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
