/* Uniburger Location Map Styles */

.uniburger-location-map-wrapper {
  position: relative;
  width: 100%;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.uniburger-map-container {
  display: flex;
  height: 100%;
  min-height: 600px;
}

.uniburger-sidebar {
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  width: 384px; /* Desktop width */
  min-width: 320px;
}

.uniburger-search-section {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafafa;
}

.uniburger-locations-list {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

.uniburger-location-item {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.uniburger-location-item:hover {
  background-color: #f9fafb;
}

.uniburger-location-item:last-child {
  border-bottom: none;
}

.uniburger-location-title {
  color: #111827;
  font-weight: bold;
  font-size: 18px;
  text-transform: uppercase;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.uniburger-primary-btn {
  background-color: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.uniburger-primary-btn:hover {
  background-color: #b91c1c;
}

.uniburger-primary-text {
  color: #dc2626;
}

.uniburger-primary-border {
  border-color: #dc2626;
}

.uniburger-secondary-color {
  background-color: #22c55e;
}

.uniburger-map-area {
  flex: 1;
  position: relative;
}

.uniburger-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #f9fafb;
  color: #6b7280;
}

.uniburger-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #dc2626;
  border-top: 4px solid transparent;
  border-radius: 50%;
  animation: uniburger-spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes uniburger-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Leaflet map customizations */
.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 12px 16px;
  font-size: 14px;
  line-height: 1.4;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .uniburger-map-container {
    flex-direction: column;
    min-height: 70vh; /* Increased for better mobile experience */
  }

  .uniburger-sidebar {
    width: 100% !important;
    max-height: 35vh; /* Reduced to give more space to map */
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    order: 2; /* Move sidebar below map on mobile */
  }

  .uniburger-map-area {
    order: 1; /* Map appears first on mobile */
    min-height: 35vh; /* Ensure map has substantial height */
    flex: 1;
  }

  .uniburger-locations-list {
    max-height: calc(35vh - 120px); /* Adjusted for smaller sidebar */
  }

  .uniburger-location-item {
    padding: 14px 16px; /* Slightly more compact */
  }

  .uniburger-search-section {
    padding: 12px 16px; /* More compact padding */
  }

  .uniburger-location-title {
    font-size: 15px; /* Slightly smaller but still readable */
    margin-bottom: 6px;
  }

  /* Improve mobile map interaction */
  .leaflet-container {
    touch-action: pan-x pan-y;
  }

  /* Better mobile button sizing */
  .uniburger-primary-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .uniburger-map-container {
    min-height: 65vh; /* Ensure adequate height on small phones */
  }

  .uniburger-sidebar {
    max-height: 30vh; /* Even less space for sidebar on small screens */
  }

  .uniburger-map-area {
    min-height: 35vh; /* Maintain map prominence */
  }

  .uniburger-locations-list {
    max-height: calc(30vh - 100px);
  }

  .uniburger-location-item {
    padding: 10px 12px; /* More compact for small screens */
  }

  .uniburger-search-section {
    padding: 10px 12px;
  }

  .uniburger-location-title {
    font-size: 14px;
    line-height: 1.3;
  }

  /* Improve mobile touch targets */
  .uniburger-primary-btn {
    padding: 12px 16px;
    font-size: 13px;
    min-height: 44px; /* Better touch target */
  }
}

/* Elementor editor compatibility */
.elementor-editor-active .uniburger-location-map {
  pointer-events: none;
}

.elementor-editor-active .uniburger-location-map::after {
  content: "Uniburger Location Map - Preview in frontend";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 8px;
  font-size: 16px;
  text-align: center;
  z-index: 1000;
}

/* Custom scrollbar for sidebar */
.uniburger-locations-list::-webkit-scrollbar {
  width: 6px;
}

.uniburger-locations-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.uniburger-locations-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.uniburger-locations-list::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Mobile-specific enhancements */
@media (max-width: 768px) {
  /* Hide scrollbar on mobile for cleaner look */
  .uniburger-locations-list {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .uniburger-locations-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  /* Improve search input on mobile */
  .uniburger-search-section input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
  }

  /* Better mobile tap highlighting */
  .uniburger-location-item {
    -webkit-tap-highlight-color: rgba(220, 38, 38, 0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }

  /* Ensure map controls are touch-friendly */
  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 20px !important;
  }
}

/* Language switcher mobile optimization */
@media (max-width: 768px) {
  .uniburger-language-switcher {
    padding: 8px 12px;
    font-size: 14px;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}
