/**
 * Companies Map Layout
 * Overlay card list on Leaflet map
 */

/* Wrapper - apply this class via Views or template */
.companies-map-layout {
  position: relative;
  display: flex;
  > .companies-cards-layout {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    background: #d4e6ec;
    border-radius: var(--radius-lg);
    > .view-content {
      position: relative;
      width: 60%;
      height: 100%;

      @media screen and (width <= 768px) {
        width: 100%;
        border: none;
      }
    }
  }

  .leaflet-container {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }
}


.companies-cards-layout > .companies-cards-layout > .view-content {
  @media screen and (width <= 768px) {
    display: none;
  }
}

.companies-cards-layout {
  position: relative;
  min-height: 70vh;
  overflow: hidden;

  > .attachment-after {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;

    .leaflet-container {
      width: 100%;
      height: 100%;
    }
  }

  > .view-content {
    border-radius: var(--radius-lg);
    position: absolute;
    top: 0;
    left: 0;
    width: 450px;
    max-width: 90vw;
    max-height: 100%;
    z-index: 10;
    overflow-y: auto;
    padding: 3rem;
    padding-right: 2.5rem;

    > * {
      pointer-events: auto;
    }
  }

  .views-row {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.3rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    border-bottom: 3px solid var(--primary);

    .views-field-title a {
      font-weight: var(--h2-weight);
      font-size: var(--body-m-size);
      color: var(--primary);
      text-decoration: none;
    }
    .views-field-field-address {
      font-size: var(--body-xs-size);
      color: var(--neutral-500);
    }
  }

  .views-row:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
  }

}

/* Leaflet popup styling */
.companies-cards-layout .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.companies-cards-layout .leaflet-popup-content {

  margin: 0;
  font-size: 0.9rem;
  max-height: 500px;
  overflow-y: auto;
  @media screen and (width <= 468px) {
    max-width: 300px;
  }
  p {
    margin: 0;
  }
}

.companies-cards-layout .leaflet-popup {
  max-width: 500px;
}

/* =============================================
   Custom Scrollbar - Companies Cards
   ============================================= */

/* Firefox */
/* .companies-cards-layout > .view-content {
  scrollbar-width: auto;
  scrollbar-color: var(--primary) rgba(0, 0, 0, 0.1);
} */

/* Webkit (Chrome, Safari, Edge) */
.companies-cards-layout > .view-content::-webkit-scrollbar {
  width: 12px;
}

.companies-cards-layout > .view-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
}

.companies-cards-layout > .view-content::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 6px;
}

.companies-cards-layout > .view-content::-webkit-scrollbar-thumb:hover {
  background: #1a5a7a;
}

/* =============================================
   Scroll Arrows
   ============================================= */

.companies-scroll-arrow {
  position: absolute;
  left: 0;
  width: 450px;
  max-width: 90vw;
  height: 3rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.companies-scroll-arrow.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.companies-scroll-arrow--up {
  top: 0;
  background: linear-gradient(to bottom, #d4e6ec 50%, transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.companies-scroll-arrow--down {
  bottom: 0;
  background: linear-gradient(to top, #d4e6ec 50%, transparent);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.companies-scroll-arrow svg {
  width: 24px;
  height: 24px;
  fill: var(--primary);
  transition: transform 0.2s ease;
}

.companies-scroll-arrow:hover svg {
  transform: scale(1.2);
}
