/**
 * Vertrieblersuche — SDC styles.
 *
 * Layout/spacing/colors live in the Twig template via Tailwind utility
 * classes. This file holds:
 *   1. SVG region-state styles (path[id].is-active / .has-contacts) — Tailwind
 *      can't address dynamic SVG IDs ergonomically.
 *   2. Pin-pulse keyframes.
 *   3. Panel transform transitions tied to the [hidden] attribute.
 *   4. Plain styles for elements rendered by JS (BEM hooks: cards, sh-cards,
 *      oob items, region heading) — these can't have classes injected from
 *      Twig, so they use named selectors with theme tokens.
 */

/* ── Map SVG wrapper ──────────────────────────────────────────────── */
.vertrieblersuche__map-wrapper svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Region paths ────────────────────────────────────────────────── */
.vertrieblersuche__map-wrapper svg path[id],
.vertrieblersuche__map-wrapper svg g[id] {
  cursor: pointer;
  transition: fill 200ms ease, stroke-width 200ms ease;
  stroke: white;
  stroke-width: 1;
}

.vertrieblersuche__map-wrapper svg path[id]:hover {
  fill: rgba(78, 153, 78, 0.55);
  stroke-width: 1.5;
}

/* "Has contacts" tinting only applies when not active — otherwise the
   active selection (Primary-Yellow) would be silently overridden by a
   later, equally-specific rule. */
.vertrieblersuche__map-wrapper svg path[id].has-contacts:not(.is-active) {
  fill: rgba(78, 153, 78, 0.18);
}

.vertrieblersuche__map-wrapper svg path[id].has-contacts:not(.is-active):hover {
  fill: rgba(78, 153, 78, 0.85);
}

/* Active selection wins regardless of has-contacts state. Primary-Yellow
   is brand-accurate and contrasts strongly with the green "available"
   tint, so the user can see at a glance which region they picked. */
.vertrieblersuche__map-wrapper svg path[id].is-active,
.vertrieblersuche__map-wrapper svg path[id].is-active:hover {
  fill: var(--color-primary);
  stroke: white;
  stroke-width: 1;
}

/* ── PLZ Input invalid state (extends Twig classes) ──────────────── */
.vertrieblersuche__plz-input.is-invalid {
  --tw-ring-color: var(--color-red-500, #ef4444);
  box-shadow: 0 0 0 2px var(--color-red-500, #ef4444);
}

/* ── Person card (rendered by JS) ─────────────────────────────────── */
.vertrieblersuche-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: box-shadow 200ms ease;
}

.vertrieblersuche-card:hover {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.vertrieblersuche-card__avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--color-gray-200, #e5e7eb);
}

.vertrieblersuche-card__avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: var(--color-secondary);
  color: white;
  font-weight: 700;
  font-size: 1.0625rem;
  flex-shrink: 0;
}

.vertrieblersuche-card__name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--color-gray-950, #030712);
}

.vertrieblersuche-card__role {
  font-size: 0.875rem;
  color: var(--color-gray-600, #4b5563);
  margin-bottom: 0.25rem;
}

.vertrieblersuche-card__contact {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.vertrieblersuche-card__contact a {
  color: var(--color-secondary);
  text-decoration: none;
}

.vertrieblersuche-card__contact a:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .vertrieblersuche-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── No-contacts / region heading (rendered by JS) ───────────────── */
.vertrieblersuche__no-contacts {
  color: var(--color-gray-600, #4b5563);
  font-size: 0.875rem;
  padding: 1rem 0;
}

.vertrieblersuche__region-heading {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 1rem;
  color: var(--color-gray-950, #030712);
}

/* ── Side-Panel / Drawer ─────────────────────────────────────────── */
.vertrieblersuche__panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 100%;
  max-width: 420px;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 250ms ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vertrieblersuche__panel:not([hidden]) {
  transform: translateX(0);
}

@media (max-width: 1023px) {
  .vertrieblersuche__panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 75vh;
    border-radius: 1rem 1rem 0 0;
    transform: translateY(100%);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  }

  .vertrieblersuche__panel::before {
    content: "";
    position: absolute;
    top: 0.625rem;
    left: 50%;
    width: 2.25rem;
    height: 0.25rem;
    border-radius: 9999px;
    background: var(--color-gray-300, #d1d5db);
    transform: translateX(-50%);
  }

  .vertrieblersuche__panel:not([hidden]) {
    transform: translateY(0);
  }
}

.vertrieblersuche__panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-gray-500, #6b7280);
  border-radius: 9999px;
  transition: background 150ms ease, color 150ms ease;
  flex-shrink: 0;
}

.vertrieblersuche__panel-close:hover {
  background: var(--color-gray-100, #f3f4f6);
  color: var(--color-gray-900, #111827);
}

.vertrieblersuche__panel-close:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Panel overlay (backdrop) */
.vertrieblersuche__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 899;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.vertrieblersuche__overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── SVG Pins ─────────────────────────────────────────────────────── */
.vertrieblersuche__pin-group {
  cursor: pointer;
}

.vertrieblersuche__pin-group:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.pin--venneker circle.pin-bg {
  fill: var(--color-primary);
  stroke: var(--color-black, #080b0c);
  stroke-width: 2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.pin--venneker circle.pin-pulse {
  fill: rgba(187, 182, 41, 0.4);
  animation: pin-pulse 2.4s ease-out infinite;
}

.pin--schlachthof circle.pin-bg {
  fill: var(--color-black, #080b0c);
  stroke: white;
  stroke-width: 1.5;
  opacity: 0.7;
  transition: opacity 150ms ease, r 150ms ease;
}

.pin--schlachthof:hover circle.pin-bg {
  opacity: 1;
  r: 7;
}

@keyframes pin-pulse {
  0%   { r: 12; opacity: 0.7; }
  100% { r: 26; opacity: 0; }
}

.vertrieblersuche__pin-hitarea {
  fill: transparent;
  stroke: none;
}

/* ── Tooltip (region hover card) ─────────────────────────────────── */
.vertrieblersuche__tooltip {
  position: fixed;
  z-index: 950;
  background: white;
  color: var(--color-gray-950, #030712);
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
  outline: 1px solid rgba(0, 0, 0, 0.05);
}

.vertrieblersuche__tooltip-name {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
  color: var(--color-gray-950, #030712);
}

.vertrieblersuche__tooltip-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-gray-500, #6b7280);
}

.vertrieblersuche__tooltip-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.5rem;
  border-radius: 9999px;
  background: rgba(78, 153, 78, 0.12);
  color: var(--color-secondary);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
}

.vertrieblersuche__tooltip-badge--empty {
  background: var(--color-gray-100, #f3f4f6);
  color: var(--color-gray-500, #6b7280);
}

/* ── Schlachthof side-panel info card (rendered by JS) ───────────── */
.vertrieblersuche__sh-card {
  padding: 1rem 1.125rem;
  border-radius: 0.75rem;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.vertrieblersuche__sh-card__name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-gray-950, #030712);
}

.vertrieblersuche__sh-card__address {
  font-size: 0.875rem;
  color: var(--color-gray-600, #4b5563);
  margin-top: 0.25rem;
}

.vertrieblersuche__sh-card__contact {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.vertrieblersuche__sh-card__contact a {
  color: var(--color-secondary);
  text-decoration: none;
}

.vertrieblersuche__sh-card__contact a:hover {
  text-decoration: underline;
}

/* ── Out-of-bounds list (rendered by JS) ─────────────────────────── */
.vertrieblersuche__oob-group {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.vertrieblersuche__oob-country {
  flex-shrink: 0;
  min-width: 2rem;
  padding-top: 0.25rem;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-gray-500, #6b7280);
}

.vertrieblersuche__oob-group::after {
  display: none;
}

.vertrieblersuche__oob-group .vertrieblersuche__oob-items-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.vertrieblersuche__oob-item {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: var(--color-gray-100, #f3f4f6);
  color: var(--color-gray-700, #374151);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.vertrieblersuche__oob-item:hover,
.vertrieblersuche__oob-item:focus-visible {
  background: rgba(78, 153, 78, 0.12);
  color: var(--color-secondary);
  outline: none;
}

/* ── Reduced motion ───────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .vertrieblersuche__panel,
  .vertrieblersuche__overlay,
  .vertrieblersuche__map-wrapper svg path[id],
  .vertrieblersuche-card {
    transition: none;
  }

  .pin--venneker circle.pin-pulse {
    animation: none;
  }
}
