/* ============================================================
   Therapiepraxen-Karte – Styles
   Design angelehnt an praxis-cebi.de (OceanWP, ruhige Optik)
   ============================================================ */

:root {
  --accent: #2f6f6b;          /* ruhiges Petrol/Teal */
  --accent-dark: #245451;
  --accent-light: #e5f0ef;
  --text: #2b2b2b;
  --text-muted: #6b7280;
  --border: #e3e6e6;
  --bg: #ffffff;
  --bg-soft: #f7f9f9;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --header-h: 84px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ============================= Header ============================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}
.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo { display: inline-flex; align-items: center; }
.site-logo img { height: 56px; width: auto; display: block; }

.site-nav .main-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav .main-menu > li { position: relative; }
.site-nav .main-menu a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
}
.site-nav .main-menu a:hover {
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
}
.nav-arrow { font-size: 12px; margin-left: 2px; }

/* Dropdown */
.sub-menu {
  list-style: none;
  margin: 0;
  padding: 8px;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.has-children:hover > .sub-menu,
.has-children:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.sub-menu a { font-weight: 400; }

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.menu-toggle-bar {
  width: 26px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ============================= Intro ============================= */
.intro { background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.intro-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 22px;
}
.intro h1 {
  margin: 0 0 8px;
  font-size: 28px;
  color: var(--accent-dark);
}
.intro p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 15.5px;
}

/* ============================= Filterleiste ============================= */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 1100;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.filter-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.search-field {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  fill: var(--text-muted);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14.5px;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  transition: all .15s ease;
  user-select: none;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.reset-btn {
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}

/* ============================= Layout ============================= */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 42%) 1fr;
  height: 70vh;
  max-height: calc(100vh - var(--header-h));
  min-height: 460px;
  max-width: 1280px;
  margin: 0 auto 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Listenspalte */
.list-pane {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #fff;
}
.list-head {
  padding: 14px 20px 6px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.result-count { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.practice-list { list-style: none; margin: 0; padding: 8px 12px 24px; }
.list-empty { padding: 24px 20px; color: var(--text-muted); }

.practice-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease;
}
.practice-card:hover,
.practice-card.active {
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}
.practice-card.active { background: var(--accent-light); }
.practice-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--accent-dark);
  line-height: 1.3;
}
.practice-card .addr { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13.5px; }
.card-actions a { display: inline-flex; align-items: center; gap: 4px; }

/* Kartenspalte */
.map-pane { position: relative; }
#map { width: 100%; height: 100%; }

.mobile-view-toggle {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1300;
  padding: 12px 22px;
  border: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
}

/* ============================= Sprach-Button (Neu) ============================= */
.lang-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1300; /* Auf gleicher Ebene wie mobile-view-toggle */
  background: var(--accent); /* Nutzt deine Primärfarbe */
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.lang-toggle-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px); /* Leichter Hover-Effekt nach oben */
}

.lang-toggle-btn:active {
  transform: translateY(0);
}

/* Popups */
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font); }
.popup h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--accent-dark); }
.popup .addr { margin: 0 0 8px; font-size: 13.5px; color: var(--text-muted); line-height: 1.45; }
.popup .popup-actions { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }

/* Cluster-Farben an Akzent angepasst */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large { background: rgba(47, 111, 107, 0.25); }
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div { background: rgba(47, 111, 107, 0.85); color: #fff; }

/* ============================= Kontaktblock ============================= */
.contact-block { background: var(--accent-dark); color: #eef4f3; }
.contact-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 40px;
  align-items: start;
}
.contact-col { min-width: 0; }
.contact-inner h2 { margin: 0 0 8px; font-size: 22px; }
.contact-inner h2 a { color: #fff; }
.contact-role { margin: 2px 0; font-size: 15px; color: #cfe0de; }
.contact-address { margin: 0 0 16px; font-size: 15px; line-height: 1.6; }
.contact-address a,
.contact-details a { color: #fff; text-decoration: underline; }
.contact-details { margin: 0; font-size: 15px; line-height: 1.7; }

/* ============================= Embed-Modus ============================= */
body.embed .site-header,
body.embed .intro,
body.embed .contact-block { display: none; }
body.embed .filter-bar { top: 0; }
body.embed .layout {
  height: 100vh;
  max-height: none;
  min-height: 0;
  margin: 0;
  border: none;
  border-radius: 0;
}

/* ============================= Responsive ============================= */
@media (max-width: 900px) {
  :root { --header-h: 60px; }

  .site-logo img { height: 40px; }
  .site-header-inner { padding: 0 16px; }

  .menu-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  .site-nav.open { max-height: 80vh; overflow-y: auto; }
  .site-nav .main-menu { flex-direction: column; align-items: stretch; padding: 8px; gap: 0; }
  .site-nav .main-menu a { padding: 12px 14px; }
  .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 16px;
  }

  /* Intro kompakt, scrollt weg */
  .intro-inner { padding: 14px 16px 12px; }
  .intro h1 { font-size: 20px; margin-bottom: 4px; }
  .intro p { font-size: 13.5px; line-height: 1.5; }

  /* Filterleiste: eine Zeile, horizontal scrollbar, spart Höhe */
  .filter-bar { position: sticky; }
  .filter-bar::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 48px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%);
    pointer-events: none;
    opacity: 1;
    transition: opacity .25s ease;
    z-index: 2;
  }
  .filter-bar.scroll-end::after { opacity: 0; }
  .filter-bar-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px;
    gap: 8px;
    scrollbar-width: none;
  }
  .filter-bar-inner::-webkit-scrollbar { display: none; }
  .filter-bar-inner > * { flex: 0 0 auto; }
  .search-field { flex: 0 0 33.333vw; width: 33.333vw; min-width: 33.333vw; }
  .chip-group { flex-wrap: nowrap; }
  .reset-btn { white-space: nowrap; }

  /* Interaktiver Bereich füllt den Bildschirm */
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
    height: calc(100dvh - var(--header-h) - 62px);
    min-height: 340px;
    max-height: none;
    margin: 0 0 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }
  .list-pane { grid-row: 1; border-right: none; }
  .map-pane { grid-row: 1; }

  /* Mobile: eine Ansicht zurzeit (Karte ist Standard, per JS gesetzt) */
  body:not(.show-map) .map-pane { display: none; }
  body.show-map .list-pane { display: none; }

  .mobile-view-toggle { display: block; bottom: 16px; }

  /* Sprach-Button auf Mobile anpassen */
  .lang-toggle-btn {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 14px;
  }

  /* Kontaktblock kompakter */
  .contact-inner { padding: 28px 20px; gap: 20px 32px; }
}

@media (max-width: 560px) {
  .contact-inner { grid-template-columns: 1fr; gap: 18px; text-align: center; }
}