/**
 * Location Finder Component Styles
 *
 * Redesign: Fullscreen map with floating controls (Tesla-style).
 */

/* ── Map wrapper ─────────────────────────────────────────────────────────── */

.location-finder__map-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 480px;
  overflow: hidden;
}

@media (max-width: 767px) {
  .location-finder__map-wrapper {
    height: 100vh;
    min-height: 400px;
  }
}

/* ── Leaflet map ─────────────────────────────────────────────────────────── */

.location-finder__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-neutral-100);
}

.location-finder__map .leaflet-container {
  font-family: inherit;
  height: 100%;
  width: 100%;
}

.location-finder__map .leaflet-interactive {
  cursor: pointer;
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */

.location-finder__map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-neutral-100);
  z-index: 10;
}

/* ── Floating controls ───────────────────────────────────────────────────── */

.location-finder__controls {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 36rem;
  pointer-events: none;
}

.location-finder__controls > * {
  pointer-events: auto;
}

@media (max-width: 767px) {
  .location-finder__controls {
    max-width: calc(100% - 2rem);
  }
}

/* ── Search field ────────────────────────────────────────────────────────── */

.location-finder__search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.location-finder__search-field {
  display: flex;
  align-items: center;
  background-color: white;
  /* ds-exception: Drop shadow for floating element above map */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-neutral-100);
  overflow: hidden;
}

.location-finder__search-icon {
  padding-left: 0.875rem;
  padding-right: 0.5rem;
  color: var(--color-neutral-400);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.location-finder__search-input {
  flex: 1;
  padding: 0.75rem 0.875rem 0.75rem 0;
  font-size: 0.875rem;
  color: var(--color-neutral-900);
  background: transparent;
  border: none;
  outline: none;
  min-width: 0;
}

.location-finder__search-input::placeholder {
  color: var(--color-neutral-400);
}

/* ── Autocomplete suggestions ────────────────────────────────────────────── */

.location-finder__suggestions {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  right: 0;
  background-color: white;
  /* ds-exception: Drop shadow for floating dropdown */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-neutral-100);
  overflow: hidden;
  z-index: 10;
}

.location-finder__suggestion {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-neutral-100);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.1s;
}

.location-finder__suggestion:last-child {
  border-bottom: none;
}

.location-finder__suggestion:hover,
.location-finder__suggestion:focus {
  background-color: var(--color-neutral-50);
  outline: none;
}

/* ── Control buttons (filter + geolocation) ──────────────────────────────── */

.location-finder__ctrl-btn {
  width: 3rem;
  height: 3rem;
  background-color: white;
  /* ds-exception: Drop shadow for floating element above map */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-500);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
  flex-shrink: 0;
}

.location-finder__ctrl-btn:hover {
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-50);
}

.location-finder__ctrl-btn.is-active {
  color: var(--color-primary);
  background-color: color-mix(in srgb, var(--color-primary) 8%, white);
}

.location-finder__ctrl-btn.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ── Legend ──────────────────────────────────────────────────────────────── */

.location-finder__legend {
  position: absolute;
  bottom: 2.5rem;
  right: 1rem;
  z-index: 1000;
  background-color: white;
  /* ds-exception: Drop shadow for floating legend */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-neutral-100);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.location-finder__legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-neutral-700);
  white-space: nowrap;
}

.location-finder__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  border: 2px solid white;
  /* ds-exception: Drop shadow for legend dot */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

/* ── Detail-Overlay Card ─────────────────────────────────────────────────── */

.location-finder__detail-card {
  position: absolute;
  top: 4.75rem; /* just below the floating controls */
  left: 1rem;
  z-index: 900;
  width: 20rem;
  background-color: white;
  /* ds-exception: Drop shadow for floating detail card */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  border-radius: 1rem;
  animation: lf-fade-in 0.2s ease-out;
  overflow: hidden;
}

@keyframes lf-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Drag Handle (mobile bottom-sheet only) ──────────────────────────────── */

.location-finder__drag-handle {
  width: 2.5rem;
  height: 0.25rem;
  border-radius: 9999px;
  background-color: var(--color-neutral-300);
  margin: 0.75rem auto 0;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .location-finder__drag-handle {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Mobile: bottom-sheet (#287) */
  .location-finder__detail-card {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 1.5rem 1.5rem 0 0;
    /* ds-exception: Prominent shadow for bottom-sheet */
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    animation: lf-slide-up 0.3s ease-out;
    max-height: 70%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .location-finder__detail-card.hidden {
    display: none;
  }

  .location-finder__detail-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }

  @keyframes lf-slide-up {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

.location-finder__detail-card.hidden {
  display: none;
}

.location-finder__detail-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-neutral-100);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  color: var(--color-neutral-600);
  transition: background-color 0.15s, color 0.15s;
  z-index: 1;
}

.location-finder__detail-close:hover {
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-900);
}

.location-finder__detail-body {
  padding: 1.25rem 1.25rem 1.25rem 1.25rem;
}

/* Type label */
.location-finder__detail-type {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

/* Location name */
.location-finder__detail-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--color-neutral-900);
  margin: 0 0 0.375rem;
  padding-right: 1.75rem; /* space for close button */
  line-height: 1.3;
}

/* Address */
.location-finder__detail-addr {
  font-size: 0.8125rem;
  color: var(--color-neutral-500);
  margin: 0 0 0.875rem;
  line-height: 1.5;
}

/* Divider */
.location-finder__detail-divider {
  border: none;
  border-top: 1px solid var(--color-neutral-100);
  margin: 0.75rem 0;
}

/* Distance / travel meta row */
.location-finder__detail-meta {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
}

.location-finder__detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-neutral-700);
  background-color: var(--color-neutral-100);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.625rem;
}

.location-finder__detail-badge svg {
  flex-shrink: 0;
}

/* Route button */
.location-finder__detail-route {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-100);
  border-radius: var(--radius-full);
  padding: 0.5rem 1rem;
  text-decoration: none;
  transition: background-color 0.15s;
  width: 100%;
  justify-content: center;
}

.location-finder__detail-route:hover {
  background-color: var(--color-neutral-200);
}

.location-finder__detail-route svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* ── Ansprechpartner contact section ─────────────────────────────────────── */

.location-finder__contact-section {
  /* wrapper injected below the route button */
}

.location-finder__contact-heading {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-neutral-400);
  margin: 0 0 0.75rem;
}

.location-finder__contact-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

/* Photo */
.location-finder__contact-photo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  background-color: var(--color-neutral-100);
  border: 2px solid var(--color-neutral-200);
}

.location-finder__contact-photo-fallback {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 9999px;
  background-color: var(--color-neutral-100);
  border: 2px solid var(--color-neutral-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-neutral-400);
}

.location-finder__contact-photo-fallback svg {
  width: 1.375rem;
  height: 1.375rem;
}

/* Info block */
.location-finder__contact-info {
  flex: 1;
  min-width: 0;
}

.location-finder__contact-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-neutral-900);
  margin: 0 0 0.125rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-finder__contact-role {
  font-size: 0.75rem;
  color: var(--color-neutral-500);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

/* Contact links (phone + email) */
.location-finder__contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.location-finder__contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.location-finder__contact-link:hover {
  opacity: 0.75;
}

.location-finder__contact-link svg {
  width: 0.8125rem;
  height: 0.8125rem;
  flex-shrink: 0;
}

.location-finder__contact-link--email {
  color: var(--color-neutral-600);
}

.location-finder__contact-link--email:hover {
  color: var(--color-primary);
  opacity: 1;
}

.location-finder__contact-link--whatsapp {
  color: var(--color-whatsapp, #25D366); /* ds-exception: WhatsApp brand color */
}

.location-finder__contact-link--whatsapp:hover {
  color: var(--color-whatsapp-hover, #1EB954); /* ds-exception: WhatsApp brand hover */
  opacity: 1;
}

/* CTA: Jetzt Kunde werden */
.location-finder__contact-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: white;
  background-color: var(--color-primary);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: background-color 0.15s;
  width: 100%;
  justify-content: center;
}

.location-finder__contact-cta:hover {
  background-color: var(--color-primary-700, #15803d);
}

.location-finder__contact-cta svg {
  flex-shrink: 0;
}

/* Loading skeleton */
.location-finder__contact-loading {
  /* loading state container */
}

.location-finder__contact-shimmer-wrap {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.location-finder__contact-shimmer-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.location-finder__contact-shimmer {
  height: 0.875rem;
  background: linear-gradient(
    90deg,
    var(--color-neutral-100) 25%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-100) 75%
  );
  background-size: 200% 100%;
  animation: lf-shimmer 1.5s ease-in-out infinite;
  border-radius: 0.25rem;
  width: 100%;
}

.location-finder__contact-shimmer--avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.location-finder__contact-shimmer--short {
  width: 55%;
}

@keyframes lf-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Filter Backdrop ─────────────────────────────────────────────────────── */

.location-finder__filter-backdrop {
  position: absolute;
  inset: 0;
  z-index: 940;
  background-color: rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}

.location-finder__filter-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 767px) {
  /* Mobile: backdrop covers the full viewport */
  .location-finder__filter-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

/* ── Filter Drawer ───────────────────────────────────────────────────────── */

.location-finder__filter-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 950;
  width: 20rem;
  background-color: white;
  /* ds-exception: Drop shadow for drawer overlay */
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.18);
  border-radius: 0 1.25rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease-out, visibility 0.3s;
  visibility: hidden;
  overflow: hidden;
}

.location-finder__filter-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

@media (max-width: 767px) {
  /* Mobile: fullscreen overlay, slides up from bottom (#287) */
  .location-finder__filter-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.3s ease-out, visibility 0.3s;
    z-index: 9999;
  }

  .location-finder__filter-drawer.is-open {
    transform: translateY(0);
  }

  /* Larger touch targets in fullscreen mobile drawer */
  .location-finder__filter-label {
    min-height: 3.5rem;
    padding: 1rem 0;
  }

  .location-finder__filter-reset {
    min-height: 3.5rem;
  }
}

/* Drawer header */
.location-finder__drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--color-neutral-100);
  flex-shrink: 0;
}

.location-finder__drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-neutral-900);
  margin: 0;
}

.location-finder__drawer-close {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-neutral-100);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  color: var(--color-neutral-600);
  transition: background-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.location-finder__drawer-close:hover {
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-900);
}

/* Drawer body */
.location-finder__drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

/* Drawer footer */
.location-finder__drawer-footer {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--color-neutral-100);
  flex-shrink: 0;
}

/* ── Filter checkboxes ───────────────────────────────────────────────────── */

.location-finder__filter-group {
  border: none;
  padding: 0;
  margin: 0;
}

.location-finder__filter-legend {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-neutral-400);
  padding: 0 0 0.625rem;
  width: 100%;
}

.location-finder__filter-label {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--color-neutral-100);
  cursor: pointer;
  min-height: 3rem; /* 48px touch target */
}

.location-finder__filter-label:last-child {
  border-bottom: none;
}

.location-finder__filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-neutral-300);
  border-radius: 0.25rem;
  background-color: white;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s, background-color 0.15s;
}

.location-finder__filter-checkbox:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.location-finder__filter-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 0.175rem;
  left: 0.3rem;
  width: 0.35rem;
  height: 0.6rem;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.location-finder__filter-checkbox:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.location-finder__filter-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-neutral-800);
}

/* ── Vertriebskategorie dropdown ─────────────────────────────────────────── */

.location-finder__kategorie-wrap {
  padding: 0.875rem 0 0.25rem;
}

.location-finder__kategorie-wrap.hidden {
  display: none;
}

.location-finder__kategorie-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-neutral-600);
  margin-bottom: 0.5rem;
}

.location-finder__kategorie-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
  background-color: white;
  font-size: 0.875rem;
  color: var(--color-neutral-900);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
  transition: border-color 0.15s;
}

.location-finder__kategorie-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ── Filter reset button ─────────────────────────────────────────────────── */

.location-finder__filter-reset {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-neutral-200);
  border-radius: var(--radius-full);
  background-color: transparent;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-neutral-600);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  min-height: 3rem;
}

.location-finder__filter-reset:hover {
  border-color: var(--color-neutral-400);
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-50);
}

/* ── Filter-btn active state ─────────────────────────────────────────────── */

.location-finder__ctrl-btn[data-filter-btn].is-active {
  color: var(--color-primary);
  background-color: color-mix(in srgb, var(--color-primary) 10%, white);
  border-color: color-mix(in srgb, var(--color-primary) 30%, white);
}

/* ── Leaflet overrides ───────────────────────────────────────────────────── */

.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-control-zoom {
  border: none !important;
  /* ds-exception: Drop shadow for zoom controls */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

.leaflet-control-zoom a {
  border: 1px solid var(--color-neutral-100) !important;
  color: var(--color-neutral-600) !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--color-neutral-50) !important;
  color: var(--color-neutral-900) !important;
}

/* ── Nearest Schlachthöfe panel ── */

.location-finder__nearest-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.75rem;
}

.location-finder__nearest-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background-color: var(--color-neutral-50);
  border: 1px solid var(--color-neutral-200);
}

.location-finder__nearest-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-700);
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.location-finder__nearest-info {
  flex: 1;
  min-width: 0;
}

.location-finder__nearest-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-neutral-900);
  margin: 0;
}

.location-finder__nearest-addr {
  font-size: 0.8125rem;
  color: var(--color-neutral-500);
  margin: 0.125rem 0 0.5rem;
}

.location-finder__nearest-route {
  display: inline-block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary-600);
  text-decoration: none;
}

.location-finder__nearest-route:hover {
  color: var(--color-primary-800);
  text-decoration: underline;
}
