/**
 * BH Google Map Styles
 *
 * Styles for the interactive Google Map with agency listing
 */

/* ==========================================================================
   Lazy-Load Placeholder (saves ~280 KiB on initial load)
   ========================================================================== */

.bh-google-map-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bh-google-map-placeholder-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(13, 13, 13, 0.95) 0%, rgba(30, 30, 30, 0.9) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%23333" width="100" height="100"/><circle fill="%23444" cx="20" cy="30" r="3"/><circle fill="%23444" cx="50" cy="20" r="2"/><circle fill="%23444" cx="80" cy="40" r="4"/><circle fill="%23444" cx="30" cy="70" r="2"/><circle fill="%23444" cx="70" cy="80" r="3"/></svg>');
  background-size: cover, 200px 200px;
}

.bh-google-map-placeholder-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.bh-google-map-placeholder-icon {
  margin-bottom: 20px;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.bh-google-map-placeholder-icon svg {
  filter: drop-shadow(0 4px 8px rgba(226, 36, 21, 0.4));
}

.bh-google-map-placeholder-title {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: #ffffff;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bh-google-map-placeholder-text {
  font-size: 16px;
  color: #999999;
  margin: 0 0 24px 0;
}

.bh-google-map-placeholder-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #e22415;
  color: #ffffff;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(226, 36, 21, 0.4);
}

.bh-google-map-placeholder-btn:hover {
  background: #c91f12;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(226, 36, 21, 0.5);
}

.bh-google-map-placeholder-btn svg {
  flex-shrink: 0;
}

/* Loading state */
.bh-google-map-placeholder.--loading .bh-google-map-placeholder-content {
  display: none;
}

.bh-google-map-placeholder-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: none;
  z-index: 3;
}

.bh-google-map-placeholder.--loading .bh-google-map-placeholder-loader {
  display: block;
}

.bh-google-map-placeholder-loader p {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  margin: 15px 0 0 0;
}

/* ==========================================================================
   Container & Layout
   ========================================================================== */

.bh-google-map-wrapper {
  position: relative;
  width: 100%;
  /* max-width: 1864px; */
  margin: 0 auto;
  /* padding: 0 20px; */
}

.bh-google-map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.bh-google-map-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 15px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #e22415;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.bh-google-map-loading p {
  margin: 0;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

.bh-google-map-container {
  position: relative;
  width: 100%;
  /* height: 800px!important; */
}

.bh-google-map-error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  margin: 20px 0;
}

/* ==========================================================================
   Map Canvas
   ========================================================================== */

.bh-google-map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  /* z-index removed to allow info windows to escape stacking context */
  /* overflow: hidden removed to allow map controls to be visible */
}

/* Apply border-radius to the inner Google Map div (first child only, not controls) */
.bh-google-map-canvas > div:first-child {
  border-radius: 24px;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.bh-google-map-sidebar {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - 40px);
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #3c3c3c;
  border-radius: 24px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.bh-google-map-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.bh-google-map-title {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.12;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0;
}

.bh-google-map-title span {
  display: block;
  color: #e22415;
  font-weight: 800;
}

.bh-google-map-geolocate {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: #1a1a1a;
  border: 1px solid #3c3c3c;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
}

.bh-google-map-geolocate:hover {
  background: #e22415;
  border-color: #e22415;
  transform: translateY(-2px);
}

.bh-google-map-geolocate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.bh-google-map-geolocate.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ==========================================================================
   Search
   ========================================================================== */

.bh-google-map-search-wrapper {
  position: relative;
}

.bh-google-map-search {
  width: 100%;
  height: 40px;
  /* height: 56px; */
  background: #1a1a1a;
  border: 1px solid #3c3c3c;
  border-radius: 12px;
  padding: 8px 48px 8px 20px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  color: #ffffff;
  outline: none;
  transition: all 0.3s ease;
}

.bh-google-map-search::placeholder {
  color: #666666;
  padding: 0;
}

.bh-google-map-search:focus {
  border-color: #e22415;
  background: #242424;
  box-shadow: none !important;
}

.bh-google-map-search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #666666;
  pointer-events: none;
}

.bh-google-map-clear {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #666666;
  cursor: pointer;
  padding: 8px;
  display: none;
  transition: color 0.3s ease;
}

.bh-google-map-clear:hover {
  color: #e22415;
}

/* ==========================================================================
   Autocomplete
   ========================================================================== */

.bh-google-map-autocomplete {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 1px solid #3c3c3c;
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.bh-google-map-autocomplete::-webkit-scrollbar {
  width: 6px;
}

.bh-google-map-autocomplete::-webkit-scrollbar-track {
  background: #0d0d0d;
}

.bh-google-map-autocomplete::-webkit-scrollbar-thumb {
  background: #3c3c3c;
  border-radius: 3px;
}

.bh-google-map-autocomplete-item {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2a2a;
  cursor: pointer;
  transition: background 0.2s ease;
}

.bh-google-map-autocomplete-item:last-child {
  border-bottom: none;
}

.bh-google-map-autocomplete-item:hover {
  background: #242424;
}

.bh-google-map-autocomplete-name {
  font-weight: 600;
  font-size: 15px;
  color: #ffffff;
  margin-bottom: 4px;
}

.bh-google-map-autocomplete-name strong {
  color: #e22415;
}

.bh-google-map-autocomplete-address {
  font-size: 13px;
  color: #999999;
}

.bh-google-map-autocomplete-address strong {
  color: #cccccc;
}

.bh-google-map-autocomplete-empty {
  padding: 20px;
  text-align: center;
  color: #666666;
  font-size: 14px;
}

/* ==========================================================================
   Agency Count
   ========================================================================== */

.bh-google-map-count {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid #2a2a2a;
}

.bh-google-map-count-number {
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: #e22415;
}

.bh-google-map-count-label {
  font-size: 14px;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Agency List
   ========================================================================== */

.bh-google-map-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -12px 0 0;
  padding-right: 12px;
  min-height: 0;
}

.bh-google-map-list::-webkit-scrollbar {
  width: 4px;
}

.bh-google-map-list::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.bh-google-map-list::-webkit-scrollbar-thumb {
  background: #e22415;
  border-radius: 2px;
}

.bh-google-map-no-results {
  text-align: center;
  padding: 60px 20px;
  color: #666666;
}

.bh-google-map-no-results svg {
  margin-bottom: 20px;
  opacity: 0.5;
}

.bh-google-map-no-results p {
  margin: 0;
  font-size: 16px;
}

/* ==========================================================================
   Agency Item
   ========================================================================== */

.bh-google-map-agency-item {
  background: transparent;
  padding: 30px 20px 20px;
  margin-bottom: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 0;
}
.bh-google-map-agency-item-flag {
  position: absolute;
  right: 10px;
  top: 10px;
}

.bh-google-map-agency-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.bh-google-map-agency-item.active {
  background: rgba(226, 36, 21, 0.1);
  border-color: #e22415;
}

.bh-google-map-agency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.bh-google-map-agency-name {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.3;
  color: #ffffff;
  margin: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 33px;
}

.bh-google-map-agency-distance {
  flex-shrink: 0;
  background: #e22415;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.bh-google-map-agency-address {
  font-weight: 400;
  font-size: 16px;
  line-height: 150%;
  letter-spacing: -0.01em;
  text-decoration: underline;
  text-decoration-skip-ink: none;
  color: #fff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.bh-google-map-agency-address > svg {
  flex-shrink: 0;
}

.bh-google-map-agency-phone {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.bh-google-map-agency-phone svg {
  flex-shrink: 0;
  color: #fff;
}

.bh-google-map-agency-phone svg path {
  transition: fill 0.2s ease;
}

.bh-google-map-agency-phone:hover svg path {
  fill: #ff3425;
}

.bh-google-map-agency-phone a {
  font-weight: 400;
  font-size: 16px;
  line-height: 150%;
  letter-spacing: -0.01em;
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.bh-google-map-agency-phone a:hover {
  color: #ff3425;
  text-decoration: underline;
}

.bh-google-map-agency-types {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
}

.bh-google-map-agency-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  border-radius: 8px;
  padding: 10px 12px 10px 24px;
  width: 171px;
  height: 38px;
  background: #050505;
  font-size: 14px;
  font-weight: 600;
  font-weight: 600;
  font-size: 16px;
  line-height: 150%;
  letter-spacing: -0.01em;
  text-align: center;
  color: #fff;
  transition: all 0.3s ease;
  border: 1px solid #e22415;
  margin: 0 auto;
}

.bh-google-map-agency-link {
  position: relative;
  overflow: hidden;
  z-index: 1;
  background: #050505;
  transition: color 0.3s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.bh-google-map-agency-link::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 0;
  background-color: #e2231542;
  z-index: -1;
  transition: width 0.4s ease;
}

.bh-google-map-agency-link:hover::after {
  width: 100%;
}

.bh-google-map-agency-link svg {
  flex-shrink: 0;
}

/* ==========================================================================
   Info Window (Map Popup)
   ========================================================================== */

.bh-google-map-infowindow {
  padding: 12px;
  min-width: 200px;
  max-width: 300px;
}

.gm-style .gm-style-iw-c,
.gm-style .gm-style-iw-tc::after {
  background: rgba(0, 0, 0, 0.7) !important;
  border: 1px solid #e22415;
}

.bh-google-map-infowindow-title {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.bh-google-map-infowindow-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bh-google-map-legend {
  position: absolute;
  top: 50px;
  left: 50px;
  z-index: 2;
  pointer-events: none;
}
.bh-google-map-infowindow-address {
  font-size: 13px;
  color: #fff;
  margin: 0;
  line-height: 1.4;
}

.bh-google-map-infowindow-distance {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.bh-google-map-infowindow-distance > svg path {
  fill: #fff;
}

.bh-google-map-infowindow-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: #e22415;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.3s ease;
  margin-top: 4px;
}

.bh-google-map-infowindow-link {
  position: relative;
  overflow: hidden;
  z-index: 1;
  background: rgba(0, 0, 0, 0.5) !important;
  transition: color 0.3s ease;
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid #e22415;
}

.bh-google-map-infowindow-link::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 0;
  background-color: #e2231542;
  z-index: -1;
  transition: width 0.4s ease;
}

.bh-google-map-infowindow-link:hover::after {
  width: 100%;
}

.gm-ui-hover-effect > span {
  background: #fff;
}

/* Override Google Maps InfoWindow styles */
.gm-style .gm-style-iw-c {
  padding: 0 !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.gm-style .gm-style-iw-d {
  overflow: auto !important;
}

.gm-style .gm-style-iw-t::after {
  background: linear-gradient(
    45deg,
    #ffffff 50%,
    transparent 51%,
    transparent
  ) !important;
}

.bh-google-map-agency-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.bh-google-map-agency-item.open .bh-google-map-agency-body {
  max-height: 500px; /* Достаточно, чтобы влез весь контент */
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1920px) {
  .bh-google-map-title{
    font-size: 13px;
    text-transform: none;
  }
  .bh-google-map-agency-item{
    padding: 24px 16px;
  }
  .bh-google-map-agency-name{
    font-size: 16px;
  }
  .bh-google-map-sidebar{
    padding: 20px;
  }
  .bh-google-map-legend-control img{
    width: 200px;
  }
  .bh-google-map-geolocate{
    width: 28px;
    height: 28px;
  }
  .bh-google-map-geolocate svg{
    width: 15px;
    height: 15px;
  }
} 
@media (max-width: 1400px) {
  .bh-google-map-sidebar {
    max-width: 420px;
    padding: 28px;
  }

  .bh-google-map-title {
    font-size: 24px;
  }
}

@media (max-width: 1200px) {
  .bh-google-map-container {
    height: 700px;
  }

  .bh-google-map-sidebar {
    max-width: 380px;
  }
}
@media (max-width: 980px) {
  .bh-google-map-sidebar {
    top: 0;
    right: 0;
    left: 0;
    max-width: 100%;
    max-height: 600px;
  }
  .bh-google-map-canvas {
    top: 630px;
    height: calc(100% - 630px);
  }
  .bh-google-map-container {
    height: 1200px !important;
  }
  .bh-google-map-legend {
    top: 620px;
    width: 180px;
    left: auto;
    right: 0px;
  }
}

@media (max-width: 768px) {
  .bh-google-map-wrapper {
    padding: 0;
  }

  .bh-google-map-container {
    height: 100vh;
    border-radius: 0;
  }

  .bh-google-map-sidebar {
    max-width: none;
    /* max-height: calc(100% - 20px); */
    padding: 20px;
    border-radius: 16px;
  }

  .bh-google-map-title {
    font-size: 20px;
  }

  .bh-google-map-geolocate {
    width: 40px;
    height: 40px;
  }

  .bh-google-map-canvas {
    border-radius: 16px;
  }
  .bh-google-map-agency-item-flag {
    display: none;
  }
  .bh-google-map-agency-address {
    font-size: 14px;
  }
  .bh-google-map-search {
    padding: 12px 36px 12px 16px;
    font-size: 14px;
    height: auto;
  }
  .bh-google-map-count {
    padding: 0;
  }
}

@media (max-width: 480px) {
  .bh-google-map-sidebar {
    padding: 16px;
  }

  .bh-google-map-title {
    font-size: 18px;
  }

  .bh-google-map-agency-name {
    font-size: 16px;
    margin-left: 0;
  }

  /* Placeholder responsive */
  .bh-google-map-placeholder-content {
    padding: 20px;
  }

  .bh-google-map-placeholder-title {
    font-size: 18px;
  }

  .bh-google-map-placeholder-text {
    font-size: 14px;
  }

  .bh-google-map-placeholder-btn {
    padding: 12px 20px;
    font-size: 14px;
  }

  .bh-google-map-placeholder-icon svg {
    width: 48px;
    height: 48px;
  }
}

/* ==========================================================================
   Google Maps Controls Styling
   ========================================================================== */

/* FORCE visibility of all Google Maps controls */
.bh-google-map-canvas .gm-bundled-control,
.bh-google-map-canvas .gm-fullscreen-control,
.bh-google-map-canvas .gmnoprint {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Style zoom control container with shadow and rounded corners */
.bh-google-map-canvas .gm-bundled-control {
  margin: 20px !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  background: white !important;
}

/* Style fullscreen control container with shadow and rounded corners */
.bh-google-map-canvas .gm-fullscreen-control {
  margin: 20px !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
  background: white !important;
}

/* SOLUTION SIMPLE : Force border-radius on ALL Google Maps control divs (found by client!) */
.bh-google-map-canvas .gmnoprint > div {
  border-radius: 12px !important;
}

/* Style ALL zoom buttons (+ and -) with base styling */
.bh-google-map-canvas .gm-bundled-control button {
  transition: background-color 0.2s ease !important;
  border: none !important;
  background: white !important;
  cursor: pointer !important;
}

/* First button (zoom +) rounded top corners */
.bh-google-map-canvas .gm-bundled-control button:first-of-type {
  border-radius: 12px 12px 0 0 !important;
}

/* Last button (zoom -) rounded bottom corners */
.bh-google-map-canvas .gm-bundled-control button:last-of-type {
  border-radius: 0 0 12px 12px !important;
}

/* Hover effect on zoom buttons */
.bh-google-map-canvas .gm-bundled-control button:hover {
  background-color: #f5f5f5 !important;
}

/* Style the fullscreen button with rounded corners */
.bh-google-map-canvas .gm-fullscreen-control button {
  border-radius: 12px !important;
  transition: background-color 0.2s ease !important;
  border: none !important;
  background: white !important;
  cursor: pointer !important;
}

/* Hover effect on fullscreen button */
.bh-google-map-canvas .gm-fullscreen-control button:hover {
  background-color: #f5f5f5 !important;
}

/*BH Google Map*/

.gm-style-iw-ch {
  display: none !important;
}

button.gm-ui-hover-effect {
  position: absolute !important;
  right: 0 !important;
}

.gm-style-iw-chr {
  position: absolute !important;
  z-index: 1000 !important;
  width: 100% !important;
}

h3.bh-google-map-infowindow-title {
  width: calc(100% - 48px) !important;
}
