/* styles.css - Custom styles for Hit The Road */

#map {
  min-height: 50vh;
  min-width: 400px;
}

.direction-step {
  padding: 10px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.direction-step:hover {
  background-color: #f5f5f5;
}

/* Styles from route_ui - OLD.php */
:root {
  --primary: #3887be;
  --primary-dark: #1A75B8;
  --secondary: #42A5F5;
  --accent: #FFCA28;
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #d9534f;
  --bg-light: #F5F7FA;
  --bg-dark: #263238;
  --text-dark: #37474F;
  --text-light: #ECEFF1;
  --shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stop {
  background: white;
  padding: 20px;
  margin: 20px 0;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.stop h3 {
  margin: 0 0 15px;
  padding: 10px 15px;
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  font-size: 1.4em;
}

.stop h3.card-draw { background: var(--success); }
.stop h3.point-of-interest { background: var(--accent); color: var(--text-dark); }
.stop h3.rest-stop { background: var(--primary); }
.stop h3.meet-up { background: var(--warning); }

.stop p { margin: 10px 0; }

.stop audio {
  display: block;
  margin: 15px 0;
  width: 100%;
  max-width: 400px;
  border-radius: 6px;
}

.stop img:not(.icon) {
  max-width: 100%;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stop img.card-image { width: 100px; height: 140px; object-fit: contain; aspect-ratio: 5 / 7; }

.video-container {
  position: relative;
  display: inline-block;
  margin: 15px 0;
}

.video-container video {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.video-container .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.video-container .play-button:hover { opacity: 0.9; }
.video-container .play-button::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 24px solid white;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
}
.video-container.playing .play-button { display: none; }

.marker-container {
  position: absolute;
  /* Ensure the container doesn't move */
  pointer-events: none; /* Pass events through to children */
}

.stop-marker {
  border-radius: 50%;
  border: 2px solid #2563eb;
  background: #fff;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
  /* Remove transform transition */
  position: absolute;
  top: -12px; /* Half the height */
  left: -12px; /* Half the width */
  pointer-events: auto; /* Capture events */
}

/* Search Page Styles */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Favorite Button Styles */
.favorite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.favorite-btn:hover {
  transform: scale(1.1);
}

.favorite-btn.text-yellow-500:hover {
  color: #f59e0b; /* Amber-500 */
}

.favorite-btn.text-gray-400:hover {
  color: #9ca3af; /* Gray-400 */
}

/* Map Popup Styles */
.stop-popup {
  max-width: 200px;
}

.stop-popup .maplibregl-popup-content {
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Stop Details Panel */
#stop-details {
  max-height: 50vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

#stop-details-content img {
  max-height: 300px;
  object-fit: cover;
  width: 100%;
}

/* Ensure card thumbnails in the stop details panel are not cropped */
#stop-details-content img.card-image {
  object-fit: contain;
  width: auto;
  max-width: 100%;
  max-height: 300px;
  aspect-ratio: 5 / 7;
}

/* Stop List Item Hover */
#stops-list > div:hover {
  cursor: pointer;
  border-color: #3b82f6;
}

/* User Location Marker */
.user-location-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Search Map Styles */
.map-marker {
  width: 24px;
  height: 24px;
  cursor: pointer;
  position: relative;
}

.map-marker-inner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid white;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.2s ease;
}

.map-marker:hover .map-marker-inner {
  transform: translate(-50%, -50%) scale(1.2);
}

/* Map marker colors */
.map-marker-inner.bg-green-500 {
  background: #10b981;
}

.map-marker-inner.bg-yellow-500 {
  background: #f59e0b;
}

.map-marker-inner.bg-red-500 {
  background: #ef4444;
}

/* Spinner Animation */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Search Results List */
#mapResultsList > div {
  transition: all 0.2s ease;
}

#mapResultsList > div:hover {
  background-color: #f3f4f6;
  transform: translateX(2px);
}

/* View Toggle Buttons */
#gridViewBtn svg,
#mapViewBtn svg {
  width: 18px;
  height: 18px;
}

/* Price Range Slider */
.price-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: #d1d5db;
  outline: none;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  transition: background 0.15s ease;
}

.price-slider::-webkit-slider-thumb:hover {
  background: #2563eb;
}

.price-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  transition: background 0.15s ease;
}

.price-slider::-moz-range-thumb:hover {
  background: #2563eb;
}

/* Pulsing animation for user location */
.ping {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.5);
  position: absolute;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Loading indicator styles */
#map-loading {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #4b5563;
}

/* Spinner for loading states */
.spinner {
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #3b82f6; /* Blue-500 */
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Card hover effects */
.route-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.route-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Loading spinner */
.spinner {
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top: 3px solid #3498db;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

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

/* Pagination styles */
.pagination-button {
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Filter styles */
.filter-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: #e5e7eb;
  color: #374151;
}

.filter-badge button {
  margin-left: 0.25rem;
  font-weight: bold;
  opacity: 0.7;
}

.filter-badge button:hover {
  opacity: 1;
}

.stop-marker {
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Narration Player Styles */
.generate-narration-btn,
.play-narration-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.generate-narration-btn:hover,
.play-narration-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.generate-narration-btn:disabled,
.play-narration-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.play-narration-btn svg {
  width: 1rem;
  height: 1rem;
}

.play-narration-btn.playing {
  background-color: #f59e0b;
}

.play-narration-btn.playing:hover {
  background-color: #d97706;
}

/* Spinner for loading states */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 0.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Directions panel */
#directions-panel {
  transition: transform 0.3s ease-in-out;
  z-index: 20;
}

#directions-panel.show {
  transform: translateX(0);
}

.direction-step {
  margin-bottom: 0.5rem;
  padding: 10px;
  border-left: 4px solid #2563eb;
  background: #f1f5f9;
  font-size: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.direction-step:last-child {
  border-bottom: none;
}

.direction-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  text-align: center;
  line-height: 24px;
  background-color: #3b82f6;
  color: white;
  border-radius: 50%;
}

.direction-distance {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 4px;
}

/* Sidebar scroll */
#sidebar {
  overflow-y: auto;
  max-height: 100vh;
}

/* Responsive tweaks */
@media (max-width: 900px) {
  #sidebar {
    width: 100vw;
    position: static;
    max-height: none;
  }
  #map {
    width: 100vw;
    min-width: unset;
  }
}

@media (max-width: 768px) {
  #sidebar {
    width: 100%;
    position: absolute;
    bottom: 0;
    height: 40%;
    z-index: 10;
  }
  
  #map {
    height: 60%;
  }
  
  #directions-panel {
    width: 100%;
    max-width: none;
    left: 0;
    right: 0;
    top: auto;
    bottom: 40%;
    transform: translateY(100%);
  }
  
  #directions-panel.show {
    transform: translateY(0);
  }
}
