/* C036 / v038 map detail panel.
   Reuses the company detail renderer in compact modes. The panel is visible as
   a bottom sheet on compact screens and as a right rail only on true extra-wide
   screens, preserving the desktop filters + list + map layout on laptops. */
:root {
  --detail-panel-width: 388px;
}

.map-detail-panel {
  display: none;
  background: #ffffff;
  color: #0f172a;
}

.map-detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(216, 229, 232, 0.92);
}

.map-detail-panel-kicker,
.company-panel-kicker {
  margin: 0;
  color: var(--map-accent-dark, #006f76);
  font-size: 0.6875rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.map-detail-panel-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.map-detail-panel-close {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(216, 229, 232, 0.95);
  border-radius: 1rem;
  background: #ffffff;
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 950;
}

.map-detail-panel-body {
  overflow-y: auto;
  min-height: 0;
}

.company-panel-card {
  padding: 1rem;
}

.company-panel-cover {
  margin: -1rem -1rem 1rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e2e8f0;
}

.company-panel-cover-picture,
.company-panel-cover-img {
  display: block;
  width: 100%;
  height: 100%;
}

.company-panel-cover-img {
  object-fit: cover;
}

.company-panel-summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.company-panel-logo {
  display: flex;
  width: 4rem;
  height: 4rem;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(5, 8, 22, 0.16);
}

.company-panel-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.company-panel-title-block {
  min-width: 0;
}

.company-panel-title-block h3 {
  margin: 0.12rem 0;
  font-size: 1.1rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.company-panel-rating {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 850;
}

.company-panel-rating span:first-child {
  color: #f59e0b;
  letter-spacing: -0.08em;
}

.company-panel-description {
  margin: 0.85rem 0 0;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.55;
}

.company-panel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.company-panel-action {
  display: inline-flex;
  min-height: 2.4rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(216, 229, 232, 0.95);
  border-radius: 0.9rem;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 950;
  text-decoration: none;
}

.company-panel-action.is-primary {
  border-color: rgba(0, 118, 129, 0.38);
  background: var(--map-accent-dark, #006f76);
  color: #ffffff;
}

.company-panel-action.is-disabled {
  opacity: 0.42;
  pointer-events: none;
}

.company-panel-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 1rem;
}

.company-panel-gallery-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0.75rem;
  object-fit: cover;
  background: #e2e8f0;
}

.company-panel-offerings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.company-panel-offerings .company-panel-kicker {
  flex-basis: 100%;
}

.company-panel-offerings span:not(.company-panel-kicker) {
  border: 1px solid rgba(216, 229, 232, 0.95);
  border-radius: 999px;
  background: #f6fbfc;
  color: #334155;
  padding: 0.35rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 900;
}

@media (min-width: 1920px) {
  body.page-mapa.map-detail-panel-open .map-detail-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    z-index: 760;
    display: flex;
    width: var(--detail-panel-width);
    flex-direction: column;
    border-left: 1px solid rgba(216, 229, 232, 0.95);
    box-shadow: -16px 0 48px rgba(5, 8, 22, 0.09);
  }
}

@media (max-width: 1023px) {
  body.page-mapa.map-detail-panel-open .map-detail-panel {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 5.4rem;
    z-index: 1210;
    display: flex;
    max-height: min(58vh, 480px);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(216, 229, 232, 0.95);
    border-radius: 1.5rem;
    box-shadow: 0 24px 70px rgba(5, 8, 22, 0.24);
  }

  .company-panel-card.is-mobileSheet .company-panel-cover,
  .company-panel-card.is-mobileSheet .company-panel-gallery,
  .company-panel-card.is-mobileSheet .company-panel-offerings {
    display: none;
  }

  .company-panel-card.is-mobileSheet {
    padding: 0.9rem;
  }
}


/* v038.1: keep laptops/desktops focused on filters + results + map.
   The right detail rail is intentionally disabled below 1920px. Users still get
   the full profile through the card/detail links, and compact screens keep the
   bottom sheet behavior. */
@media (min-width: 1024px) and (max-width: 1919px) {
  body.page-mapa.map-detail-panel-open .map-detail-panel {
    display: none !important;
  }
}

/* v038.2: do not block the mobile result list with an automatic quick-detail
   sheet. The sheet remains available in compact map mode after marker/map
   selection, while list reading stays focused on the cards. */
@media (max-width: 1023px) {
  body.page-mapa.responsive-list-view .map-detail-panel {
    display: none !important;
  }

  body.page-mapa.responsive-map-view.map-detail-panel-open .map-detail-panel {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 5.25rem);
    max-height: min(46vh, 380px);
  }
}

/* v038.3: optional summary tab for large laptops.
   Below true extra-wide width the quick detail is available on demand as an
   overlay rail. It does not reserve layout width, so filters/results/map remain
   the primary exploration workspace until the user explicitly asks for summary. */
.map-detail-rail-toggle {
  display: none;
}

@media (min-width: 1440px) and (max-width: 1919px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    position: fixed;
    top: calc(var(--header-height) + 50% - 72px);
    right: 0.5rem;
    z-index: 940;
    display: inline-flex;
    width: 2.4rem;
    min-height: 7rem;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid rgba(216, 229, 232, 0.98);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.98);
    color: var(--map-accent-dark, #006f76);
    box-shadow: 0 12px 34px rgba(5, 8, 22, 0.14);
    writing-mode: vertical-rl;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle span {
    font-size: 1.05rem;
    font-weight: 950;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle strong {
    font-size: 0.7rem;
    font-weight: 950;
    letter-spacing: 0.02em;
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-detail-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    z-index: 920;
    display: flex !important;
    width: min(var(--detail-panel-width), 360px);
    flex-direction: column;
    border-left: 1px solid rgba(216, 229, 232, 0.95);
    box-shadow: -16px 0 48px rgba(5, 8, 22, 0.12);
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-detail-rail-toggle {
    right: min(var(--detail-panel-width), 360px);
  }
}

/* v038.4: large-laptop quick view is deliberately opt-in and only appears when
   there is enough horizontal room. It is called “Vista rápida” to avoid
   suggesting it replaces the full company profile. */
@media (min-width: 1440px) and (max-width: 1679px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    display: none !important;
  }
}

@media (min-width: 1680px) and (max-width: 1919px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle strong {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    width: 2rem !important;
    min-height: 4.8rem !important;
    border-color: rgba(4, 212, 203, 0.46) !important;
    background: var(--map-accent-dark, #007681) !important;
    color: #ffffff !important;
  }
}

/* v038.5: when the optional right quick-view rail is expanded, reserve layout
   width exactly like the left filter/list rails. This keeps the rail from
   covering useful map content and makes left/right behavior coherent. */
@media (min-width: 1680px) and (max-width: 1919px) {
  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-shell {
    right: min(var(--detail-panel-width), 360px) !important;
    transition: left 0.18s ease, right 0.18s ease;
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-credit {
    right: 1rem !important;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    overflow: visible;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle strong {
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip: auto !important;
    overflow: visible !important;
    white-space: normal !important;
    font-size: 0.68rem !important;
    line-height: 1 !important;
    text-transform: uppercase;
  }

  .map-detail-rail-badge {
    display: inline-flex;
    min-width: 1.3rem;
    height: 1.3rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--map-accent-dark, #006f76);
    font-size: 0.65rem;
    font-style: normal;
    font-weight: 950;
    line-height: 1;
    writing-mode: horizontal-tb;
  }

  .map-detail-rail-badge[hidden] {
    display: none !important;
  }
}


/* v038.7: quick-view rail availability.
   The right rail is useful only when the map still has enough room after
   filters and results. At 1680–1799px it technically fits, but it creates a
   cramped visual hierarchy; keep the full quick rail for 1800px+ or true
   extra-wide screens. */
@media (min-width: 1680px) and (max-width: 1799px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle,
  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-detail-panel {
    display: none !important;
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-shell {
    right: 0 !important;
  }
}


/* v038.8 quick-view breakpoint consolidation.
   Laptop/desktop widths get an on-demand overlay quick view from 1280px up.
   It does not reserve map width, avoiding the previous gap where selected
   providers had no dedicated quick view. True extra-wide keeps the right rail. */
@media (min-width: 1280px) and (max-width: 1919px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    position: fixed;
    top: calc(var(--header-height) + 50% - 68px);
    right: 0.55rem;
    z-index: 940;
    display: inline-flex !important;
    width: 2.15rem;
    min-height: 5.6rem;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid rgba(4, 212, 203, 0.46);
    border-radius: 1rem;
    background: var(--map-accent-dark, #007681);
    color: #ffffff;
    box-shadow: 0 12px 34px rgba(0, 118, 129, 0.24);
    writing-mode: vertical-rl;
  }

  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle strong {
    font-size: 0.68rem !important;
    font-weight: 950;
    line-height: 1;
    text-transform: uppercase;
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-detail-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    z-index: 920;
    display: flex !important;
    width: min(var(--detail-panel-width), 360px);
    flex-direction: column;
    border-left: 1px solid rgba(216, 229, 232, 0.95);
    box-shadow: -18px 0 54px rgba(5, 8, 22, 0.16);
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-shell {
    right: 0 !important;
  }

  body.page-mapa.map-detail-panel-open.map-detail-panel-forced-open .map-detail-rail-toggle {
    right: min(var(--detail-panel-width), 360px);
  }
}

@media (min-width: 1920px) {
  body.page-mapa.map-detail-panel-open .map-detail-rail-toggle {
    display: none !important;
  }
}
