.pl-20 {
  padding-left: 5rem;
}

.pr-20 {
  padding-right: 5rem;
}

.overlay-header {
  display: flex;
  min-height: 4rem;
  margin-top: 0.5rem;
  align-items: center;
}

.suggestions-list {
  border: 1px solid #e2e8f0;
  overflow-y: auto;
  margin-top: 12px;
  position: absolute;
  z-index: 1000;
  background-color: white;
  width: 100%;
  border-radius: 12px;
  max-height: 200px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Mobile improvements */
  @media (max-width: 768px) {
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  
  @media (max-width: 768px) {
    padding: 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 15px;
  }

  &:last-child {
    border-bottom: none;
  }

  &:hover {
    background-color: #f8fafc;
    color: #667eea;
  }

  &:focus {
    outline: none;
    background-color: #f1f5f9;
    color: #667eea;
  }
}

.listing.active {
  background: darkgray;
  color: white;

  h4, .listing-item-text p, .listing-item-text a {
    color: white;
  }
}

.listing-overlay {
  position: absolute;
  background: white;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  padding: 0;
  display: none;
  pointer-events: auto;
  cursor: default;
  font-size: 14px;
  overflow-y: auto;
  flex-direction: column;
  align-items: flex-start;
  z-index: 1001;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;

  /* Add backdrop blur effect */
  backdrop-filter: blur(1px);

  /* Content container inside overlay */
  .overlay-content {
    padding: 1.5rem;
    height: 100%;
    width: 100%;
    overflow-y: auto;
  }

  /* Mobile adjustments */
  @media (max-width: 768px) {
    .overlay-content {
      padding: 1rem;
    }
    
    font-size: 13px;
    
    h3 {
      font-size: 1.875rem !important;
      line-height: 1.2 !important;
      margin-bottom: 1rem !important;
    }
  }
}

/* Position overlays relative to the entire sidebar, not just listings */
.sidebar {
  position: relative;
  z-index: 1000;
}

/* Remove relative positioning from simple-listings since overlay now covers full sidebar */
.simple-listings {
  position: static;
}

/* Style the close button in overlay */
.listing-overlay .close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1002;
  
  /* Better touch target on mobile */
  @media (max-width: 768px) {
    width: 48px;
    height: 48px;
    top: 0.75rem;
    right: 0.75rem;
  }

  &:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    transform: scale(1.05);
  }

  /* Prevent touch callouts on mobile */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;

  svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
    pointer-events: none;
  }
}

.listing {
  display: flex;
  align-items: center;
  padding: 1.5rem 2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 8px;
  margin-bottom: 8px;
  background: white;

  &:hover {
    background-color: #f8fafc;
  }

  /* Improve touch targets for mobile */
  @media (max-width: 768px) {
    padding: 20px 16px;
    
    /* Better touch feedback */
    &:active {
      background-color: #f1f5f9;
    }
  }

  .listing-item-text {
    flex: 1;
  }

  .listing-item-title {
    margin-bottom: 0.5rem;
    margin-top: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    
    @media (max-width: 768px) {
      font-size: 16px;
      line-height: 1.3;
    }
  }

  .listing-item-text p {
    display: flex;
    align-items: center;
    color: #6b7280;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 6px;
    font-weight: 400;
    
    @media (max-width: 768px) {
      font-size: 13px;
      line-height: 1.4;
      margin: 0 0 8px;
    }
  }

  .listing-item-text a {
    display: flex;
    align-items: center;
    color: #6b7280;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    margin: 0 0 6px;
    font-weight: 400;
    
    @media (max-width: 768px) {
      font-size: 13px;
      line-height: 1.4;
      margin: 0 0 8px;
    }
  }

  .listing-item-text svg {
    height: 16px;
    width: 16px;
    margin-right: 8px;
    color: #9ca3af;
    
    @media (max-width: 768px) {
      height: 18px;
      width: 18px;
      margin-right: 8px;
    }
  }
}

.listing:not(:first-child) {
  border-top: none;
}

.map-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 80vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  border-radius: 10px;

  .sidebar {
    flex-basis: auto;
    flex-grow: 0;
    flex-shrink: 0;
    position: relative;
    height: 100%;
    margin: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;

    .sidebar-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 20px;
      border-top: 1px solid #e2e8f0;
    }
  }

  .sidebar-content {
    flex-shrink: 0;
  }

  .sidebar-header {
    padding: 2rem 2rem 1rem;
  }

  .search-section {
    padding: 1.5rem 2rem;
  }

  .search-container {
    position: relative;
    border-radius: 12px;
    margin-bottom: 0;

    .search-input {
      display: block;
      width: 100%;
      border-radius: 12px;
      padding: 16px 16px 16px 48px;
      border: 2px solid #e2e8f0;
      font-size: 16px;
      box-sizing: border-box;
      background: white;
      transition: all 0.2s ease;
      font-weight: 500;
    }

    .search-input:focus {
      outline: none;
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
      transform: translateY(-1px);
    }

    .search-input::placeholder {
      color: #94a3b8;
      font-weight: 400;
    }
  }

  .search-icon {
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    color: #64748b;
    z-index: 1;

    svg {
      height: 20px;
      width: 20px;
    }
  }

  .map-title {
    margin-bottom: 0.75rem;
    margin-top: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
  }

  .map-description {
    margin-bottom: 0;
    margin-top: 0;
    font-size: 1rem;
    font-weight: 400;
  }

  .map-section {
    flex-basis: 0;
    flex-grow: 1;
    min-height: 400px;

    /* Hide map by default on mobile */
    @media (max-width: 1023px) {
      display: none;
      
      /* When map is shown on mobile, give it good height */
      &[style*="block"] {
        display: block !important;
        height: 50vh;
        min-height: 300px;
        margin-top: 1rem;
      }
    }
  }

  .map-toggle-button {
    border: 1px solid black;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    width: 10rem;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
    text-align: center;
    justify-content: center;
    position: absolute;
    z-index: 10000;
    bottom: 0;
    left: 0;
    right: 0;

    .map-toggle-icon {
      height: 16px;
      width: 16px;
    }

    &:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    /* Only show on mobile */
    @media (max-width: 1023px) {
      display: flex;
    }
  }

  .map {
    width: 100%;
    height: 100%;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }

  .filters-section {
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
  }

  .filters-content {
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;

    .directory-link {
      background: white;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      padding: 0.75rem 1.25rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.875rem;
      font-weight: 500;
      text-decoration: none;
      color: #475569;
      transition: all 0.2s ease;
      box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);

      .directory-icon {
        height: 16px;
        width: 16px;
      }

      &:hover {
        background-color: #f1f5f9;
        border-color: #cbd5e1;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
      }
    }

    .results-info {
      .result-count {
        font-size: 0.875rem;
        font-weight: 500;
        margin: 0;
        color: #64748b;
        background: white;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        border: 1px solid #e2e8f0;
      }
    }

    /* Mobile layout adjustments */
    @media (max-width: 640px) {
      flex-direction: column;
      align-items: stretch;
      gap: 0.75rem;

      .directory-link,
      .map-toggle-button {
        justify-content: center;
      }

      .results-info .result-count {
        text-align: center;
      }
    }
  }

  .listings-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .simple-listings {
    flex: 1;
    overflow-y: auto;
  }

  .listings-loading-content {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid #f1f5f9;
    padding: 1.5rem 0;

    .listing-loading-text {
      flex: 1;
    }

    .listing-loading-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 0.75rem;

      .listing-loading-title {
        margin: 0;
        flex: 1;
      }

      .skeleton-status {
        margin-left: 1rem;
      }
    }

    .listing-loading-details {
      .skeleton-address, .skeleton-distance {
        margin: 0.5rem 0;
      }
    }

    .skeleton-box {
      display: inline-block;
      height: 1em;
      position: relative;
      overflow: hidden;
      background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
      border-radius: 6px;
      animation: shimmer 1.6s infinite linear;
    }
  }

  .empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;

    .empty-state-icon {
      margin: 0 auto 1.5rem;
      width: 64px;
      height: 64px;
      background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;

      svg {
        width: 32px;
        height: 32px;
        color: #94a3b8;
      }
    }

    .empty-state-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: #374151;
      margin: 0 0 0.5rem;
    }

    .empty-state-description {
      font-size: 0.875rem;
      color: #64748b;
      margin: 0;
      line-height: 1.5;
    }
  }

  /* Desktop layout */
  @media (min-width: 1024px) {
    flex-direction: row;
    gap: 2rem;

    .sidebar {
      flex-basis: 420px;
      flex-grow: 0;
      height: 80vh;
      width: 420px;
    }

    .map-section {
      flex-basis: 0;
      flex-grow: 999;
      min-inline-size: 50%;
      min-height: auto;
    }

    .map {
      min-height: auto;
    }
  }

  /* Large desktop layout */
  @media (min-width: 1280px) {
    gap: 2.5rem;
    
    .sidebar {
      flex-basis: 450px;
      width: 450px;
    }
  }
}

.locations-common {
  .page-wrapper {
    position: relative;
    max-width: 1200px;
    padding: 1rem;
    margin: auto;
  }

  /* Tablet padding */
  @media (min-width: 768px) {
    .page-wrapper {
      padding: 1.5rem 2rem;
    }
  }

  /* Desktop padding */
  @media (min-width: 1024px) {
    .page-wrapper {
      padding: 1.75rem 3rem;
    }
  }

  /* Large desktop padding */
  @media (min-width: 1280px) {
    .page-wrapper {
      padding: 1.75rem 5rem;
    }
  }

  .page-title-wrapper {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto auto 60px;
  }

  .small {
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
  }

  a {
    text-decoration: none;
    color: currentColor;
  }

  h1 {
    font-size: 2.25rem; /* 36px */
    line-height: 2.5rem; /* 40px */
    color: #000;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0;
    font-weight: 600;
  }

  h2 {
    font-size: 1.602em;
    color: #000;
    margin: 0;
    margin-top: 0px;
    margin-bottom: 0px;
    padding: 0;
    line-height: 1.3;
  }

  .area-title {
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    background-color: #fff;
    padding: 10px 0;
    margin-bottom: 10px;
  }

  .locations-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-gap: 20px 20px;
    margin-bottom: 60px;

    .list-gallery {
      grid-template-columns: 1fr 1fr 1fr 1fr;

      .locations-gallery-item {
        text-decoration: none;
        margin: 0;

        .locations-gallery-item-image {
          margin-bottom: 20px;
        }
      }
    }
  }

  .rounded-image {
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    background-position: center;
    background-size: cover;
    padding-bottom: 66%;
    display: block;
  }

  .location-page {
    .location-image {
      width: 100%;
      border-radius: 8px;
      aspect-ratio: 16 / 8;
      object-fit: cover;
    }

    .location-header {
      display: flex;
      justify-content: space-between;
      margin-bottom: 20px;
      align-items: center;

      .location-actions {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;

        .button-styled {
          border: #ccc 1px solid;
          border-radius: 0.5rem; padding: 1rem 2rem; background: #fff; cursor: pointer; text-align: center; color: #000; font-size: 12px;
          margin-left: 8px;
        }
      }
    }

    .button-styled {
      padding: 7px 20px;
      background: #fff;
      border: 1px solid #999;
      border-radius: 2px;
      cursor: pointer;
      text-align: center;
      color: #000;
      font-size: 14px;
    }
  }
}

.listing-actions {
  display: flex; 
  justify-content: space-between; 
  margin-top: 1rem; 
  width: 100%;
  gap: 0.5rem;

  a {
    border: 1px solid #e2e8f0;
    border-radius: 8px; 
    padding: 0.75rem 1.5rem; 
    background: white; 
    cursor: pointer; 
    text-align: center; 
    color: #374151; 
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    flex: 1;

    &:hover {
      background-color: #f8fafc;
      border-color: #cbd5e1;
      transform: translateY(-1px);
      box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    }
  }
}

/* Enhanced shimmer animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton-box {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200px 100%;
  animation: shimmer 1.6s infinite linear;
}

/* Mobile-specific tap highlights and touch improvements */
@media (max-width: 768px) {
  .suggestion-item:active,
  .listing:active,
  button:active,
  a:active {
    background-color: #f1f5f9;
  }
  
  /* Remove default tap highlights */
  * {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Ensure proper touch scrolling */
  .simple-listings,
  .suggestions-list,
  .listing-overlay {
    -webkit-overflow-scrolling: touch;
  }

  /* Improve form input on mobile */
  .search-input {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
}
