/* ==========================================================================
   Medical Location Map Stylesheet
   ========================================================================== */

.medloc-wrapper {
  width: 100%;
  box-sizing: border-box;
}

.medloc-wrapper * {
  box-sizing: border-box;
}

/* 2-Column Grid Layout */
.medloc-grid {
  display: grid;
  align-items: start;
  width: 100%;
}

/* Column Ratios */
.medloc-ratio-50-50 { grid-template-columns: 1fr 1fr; }
.medloc-ratio-40-60 { grid-template-columns: 4fr 6fr; }
.medloc-ratio-35-65 { grid-template-columns: 3.5fr 6.5fr; }
.medloc-ratio-30-70 { grid-template-columns: 3fr 7fr; }
.medloc-ratio-60-40 { grid-template-columns: 6fr 4fr; }

/* Left/Right Map Ordering */
.medloc-map-left .medloc-cards-column {
  order: 2;
}
.medloc-map-left .medloc-map-column {
  order: 1;
}

/* Equal Height Option */
.medloc-equal-height {
  align-items: stretch;
}
.medloc-equal-height .medloc-map-column {
  height: 100%;
}
.medloc-equal-height .medloc-map-container {
  height: 100% !important;
  min-height: 300px;
}

/* Sticky Map Configuration */
.medloc-map-column.medloc-sticky {
  position: -webkit-sticky;
  position: sticky;
  align-self: start;
  z-index: 10;
}
.medloc-equal-height .medloc-map-column.medloc-sticky .medloc-map-container {
  position: -webkit-sticky;
  position: sticky;
  /* Top offset is set dynamically via Elementor selectors */
}

/* Cards List Container */
.medloc-cards-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Location Card Styles (Normal) */
.medloc-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  border: 1px solid transparent; /* default placeholder for border groups */
}

/* Card Active / Hover state */
.medloc-card:hover,
.medloc-card.medloc-active {
  transform: translateY(-2px);
}

/* Typography elements */
.medloc-card-title {
  margin-top: 0;
  font-family: inherit;
  font-weight: 700;
  transition: color 0.3s ease;
}

.medloc-description {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 0;
  font-family: inherit;
}

/* Icon text wrappers */
.medloc-address,
.medloc-meta-item {
  display: flex !important;
  align-items: flex-start !important;
  font-size: 0.9rem;
  line-height: 1.4;
  font-family: inherit;
}

.medloc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 3px;
}

.medloc-icon svg,
.medloc-icon i {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.medloc-text {
  word-break: break-word;
}

/* Simple Widget: Metadata layout (Horizontal row) */
.medloc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: auto;
}

/* Detailed Widget: Metadata layout (Vertical stack) */
.medloc-meta-column-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Badges styling */
.medloc-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.medloc-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

/* Action link (Detailed Widget) */
.medloc-action-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
}

.medloc-link-icon,
.medloc-link-icon-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.medloc-link-icon svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
}

/* Link Hover animations */
.medloc-hover-slide:hover .medloc-link-icon,
.medloc-card:hover .medloc-hover-slide .medloc-link-icon,
.medloc-hover-slide:hover .medloc-link-icon-arrow,
.medloc-card:hover .medloc-hover-slide .medloc-link-icon-arrow {
  transform: translateX(4px);
}

/* Map Elements styling */
.medloc-map-column {
  width: 100%;
}

.medloc-map-container {
  width: 100%;
  min-height: 250px;
  z-index: 1;
}

/* Leaflet Custom Pin styling */
.medloc-custom-pin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px !important;
  height: 50px !important;
  margin-left: -25px !important;
  margin-top: -25px !important;
}

.medloc-custom-pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.medloc-custom-pin-aura {
  position: absolute;
  width: 70%;
  height: 70%;
  left: 15%;
  top: 15%;
  border-radius: 50%;
  background-color: rgb(226, 92, 56);
  opacity: 0.25;
  transform: scale(1);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

.medloc-custom-pin-core {
  position: absolute;
  width: 30%;
  height: 30%;
  left: 35%;
  top: 35%;
  border-radius: 50%;
  background-color: rgb(226, 92, 56);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transform: scale(1);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Leaflet Custom Pin - Pulsing Animation on Active */
@keyframes medloc-pulse {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.6);
    opacity: 0.1;
  }
  100% {
    transform: scale(1);
    opacity: 0.3;
  }
}

.medloc-custom-pin-container.medloc-pin-active .medloc-custom-pin-aura {
  transform: scale(1.6);
  opacity: 0.35;
  animation: medloc-pulse 2s infinite ease-in-out;
}

.medloc-custom-pin-container.medloc-pin-active .medloc-custom-pin-core {
  transform: scale(1.25);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

/* Hovering card triggers same styling on corresponding pin */
.medloc-custom-pin-container:hover .medloc-custom-pin-aura,
.medloc-custom-pin-container.medloc-pin-hover .medloc-custom-pin-aura {
  transform: scale(1.6);
  opacity: 0.4;
}

.medloc-custom-pin-container:hover .medloc-custom-pin-core,
.medloc-custom-pin-container.medloc-pin-hover .medloc-custom-pin-core {
  transform: scale(1.25);
}

/* Leaflet Overrides for premium popup styling */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background-color: #ffffff;
}
.leaflet-popup-content-wrapper {
  font-family: inherit;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}
.leaflet-popup-content {
  margin: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.4;
}
.leaflet-popup-content h4 {
  margin: 0 0 4px 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: #333;
}
.leaflet-popup-content p {
  margin: 4px 0 0 0;
  color: #666;
}
.medloc-popup-title-link {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}
.medloc-popup-title-link:hover {
  color: #e25c38;
}
.medloc-popup-action-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: #e25c38;
  transition: opacity 0.3s ease;
}
.medloc-popup-action-link:hover {
  opacity: 0.8;
}
.leaflet-container a.leaflet-popup-close-button {
  top: 6px;
  right: 6px;
}

/* ==========================================================================
   Responsive Grid Behavior
   ========================================================================== */

/* Stack on Tablet */
@media (max-width: 1024px) {
  .medloc-stack-tablet {
    grid-template-columns: 1fr !important;
  }
  .medloc-stack-tablet .medloc-cards-column,
  .medloc-stack-tablet .medloc-map-column {
    order: unset !important;
  }
  .medloc-stack-tablet .medloc-map-column.medloc-sticky {
    position: static;
  }
}

/* Stack on Mobile */
@media (max-width: 767px) {
  .medloc-stack-mobile,
  .medloc-stack-tablet {
    grid-template-columns: 1fr !important;
  }
  .medloc-stack-mobile .medloc-cards-column,
  .medloc-stack-mobile .medloc-map-column,
  .medloc-stack-tablet .medloc-cards-column,
  .medloc-stack-tablet .medloc-map-column {
    order: unset !important;
  }
  .medloc-stack-mobile .medloc-map-column.medloc-sticky,
  .medloc-stack-tablet .medloc-map-column.medloc-sticky {
    position: static;
  }
}
