/**
 * Sub Hero Map styles
 */

.sub-hero-map {
  position: relative;
  padding-bottom: var(--spacing-xxl);
  
  .map-section-header {
    text-align: center;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    
    h2 {
      margin-bottom: var(--spacing-sm);
    }
    
    p {
      font-size: 1.2rem;
    }
  }
  
  /* Error message styling */
  .location-error-message {
    display: none;
    color: #e53935;
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
    padding: var(--spacing-xs);
    background-color: rgba(229, 57, 53, 0.1);
    border-radius: 4px;
    text-align: center;
  }
  
  .map-columns {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: var(--spacing-md);
    align-items: stretch;
    
    @media (max-width: 992px) {
      grid-template-columns: 1fr;
      gap: var(--spacing-lg);
    }
  }
  
  .map-header{
    max-width:30%;
    margin-left: var(--spacing-xs);
    @media(max-width:992px){
      margin-left:0px;
      max-width:80%;
    }
  }
  
  .map-column-left {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  
  .location-search {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-xs);
    padding-right: var(--spacing-xs);
    
    label {
      display: block;
      font-weight: normal;
      color: #777;
    }
    
    .search-input-wrapper {
      display: flex;
      align-items: center;
      margin-bottom: var(--spacing-xs);
      position: relative;
    }
    
    .search-input-wrapper {
      display: flex;
      align-items: center;
      margin-bottom: var(--spacing-xs);
    }
    
    .input-with-icon {
      position: relative;
      flex: 1;
      margin-right: var(--spacing-md);
    }
    
    input {
      width: 100%;
      border: none;
      border-bottom: 2px solid #000;
      padding: var(--spacing-xs) 0;
      padding-right: 24px; /* Space for the icon */
      font-size: 1rem;
      background: transparent;
      font-family: var(--font-body);
      
      &:focus {
        outline: none;
        border-bottom-color: var(--color-blue-light);
      }
      
      &::placeholder {
        color: #000000;
        font-weight: 550;
      }
    }
    
    .search-icon {
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 14px;
      height: 14px;
      background-image: url('/wp-content/themes/embrace-recovery/assets/svg/mag-glass.svg');
      background-size: contain;
      background-repeat: no-repeat;
      pointer-events: none;
    }
    
    .use-my-location {
      display: inline-block;
      color: #000; /* Changed to black */
      font-weight: 700;
      font-size: 0.9rem;
      text-decoration: underline; /* Added underline */
      margin-top: var(--spacing-xs);
      position: relative;
      padding-left: 20px;
      
      &:before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 14px;
        height: 14px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000000'%3E%3Cpath d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z'/%3E%3C/svg%3E");
        background-size: contain;
        background-repeat: no-repeat;
      }
      
      &:hover {
        text-decoration: none; /* Remove underline on hover */
      }
    }
  }
  
  .map-column-left {
    position: relative; /* Add positioning context for the fade overlay */
  }

  .location-list-container {
    max-height: 600px;
    overflow-y: auto;
    scrollbar-width: auto;
    scrollbar-color: var(--color-gold) #f1f1f1;
    padding-left: var(--spacing-xs);
    padding-right: var(--spacing-xs);
    padding-bottom: 20px; /* Add some padding at the bottom to prevent content from being hidden by the fade */
    
    @media (max-width: 992px) {
      max-height: 350px;
    }
    
    @media (max-width: 576px) {
      max-height: 300px;
    }
  }
  
  /* Fade overlays that stay fixed at the top and bottom */
  .map-column-left {
    /* Bottom fade effect */
    &::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 100px;
      background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
      pointer-events: none; /* Allows clicking through the gradient */
      z-index: 1; /* Ensure it appears above the list content */
    }

    
    
  }
  
  .location-list-container {
    &::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }
    
    &::-webkit-scrollbar-thumb {
      background: var(--color-gold);
      border-radius: 4px;
      border: 2px solid #f1f1f1; 
    }
    
    &::-webkit-scrollbar-thumb:hover {
      background: var(--color-gold);
      opacity: 0.9;
    }
  }
  
  .location-card {
    background-color: #fff;
    border-radius: 8px;
    padding: var(--spacing-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin: 0 0 var(--spacing-sm) 0;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    justify-content: space-between; /* Ensure proper spacing between content and buttons */
    border: 4px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    
    &:hover {
      transform: translateY(-3px);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    }
    
    &.active {
      border-color: var(--color-blue-dark);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    }
    
    .location-card-content {
      flex: 1;
      padding-right: var(--spacing-md);
      max-width: calc(100% - 150px); /* Ensure content doesn't get squished by buttons */
    }
    
    .location-title {
      font-size: 1.3rem;
      margin-bottom: var(--spacing-xs);
      color: var(--color-blue-dark);
    }
    
    .location-county {
      margin-bottom: var(--spacing-xs);
      color: var(--color-blue-dark);
    }
    
    .location-address {
      margin-bottom: 0;
      font-weight: 550;
      color: var(--color-blue-dark);
    }
    .location-card-actions {
      display: flex;
      flex-direction: column;
      gap: var(--spacing-xs);
      align-items: flex-end; /* Align buttons to the right */
      justify-content: center;
      height: 100%;
      min-width: 133px; /* Match button width */
      
      .btn-sm {
        padding: calc(var(--spacing-xs) / 2) var(--spacing-xs);
        font-size: 0.9rem;
        white-space: nowrap;
        width: 133px; /* Fixed width of 133px */
        text-align: center; /* Center the text */
      }
      
      @media (max-width: 768px) {
        flex-direction: column;
        gap: var(--spacing-xs);
      }
    }
  }
  
  .map-column-right {
    display: flex;
    flex-direction: column;
  }
  
  .google-map {
    height: 100%;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    
    @media (max-width: 992px) {
      height: 350px;
    }
    
    @media (max-width: 576px) {
      height: 300px;
    }
  }
  
  /* Google Maps Info Window styling */
  .map-info-window {
    padding: var(--spacing-xs);
    
    h3 {
      font-size: 1.1rem;
      margin-bottom: var(--spacing-xs);
      color: var(--color-blue-dark);
    }
    
    p {
      margin-bottom: var(--spacing-xs);
      font-size: 0.9rem;
    }
    
    .info-window-actions {
      margin-top: var(--spacing-xs);
      
      a {
        color: var(--color-blue-light);
        font-weight: bold;
        text-decoration: none;
        font-size: 0.9rem;
        
        &:hover {
          text-decoration: underline;
        }
      }
    }
  }
  
}

/* Add a small button style for the location cards */
.btn-sm {
  padding: calc(var(--spacing-xs) / 2) var(--spacing-xs);
  font-size: 0.9rem;
}



/* Top fade effect - fixed at the top of the container */
#locationList::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 10%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  z-index: 3;
  display: block;
  width: calc(100% - 8px); /* Don't cover the scrollbar */
}