/**
 * @file
 * Styling for destinations map page.
 */

/* Full-screen layout */
.destinations-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: #f5f5f5;
  z-index: 100;
}

/* Sidebar with filter form */
.destinations-sidebar {
  width: 320px;
  background: white;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  z-index: 101;
}

/* Map canvas takes remaining space */
.destinations-map-canvas {
  flex: 1;
  position: relative;
}

/* Filter form styling */
#destinations-filter-form {
  padding: 1rem;
}

#destinations-filter-form fieldset {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fafafa;
}

#destinations-filter-form legend {
  font-weight: bold;
  font-size: 1rem;
  padding: 0 0.5rem;
  color: #333;
}

/* Position inputs */
#destinations-filter-form .form-item-latitude,
#destinations-filter-form .form-item-longitude {
  margin-bottom: 0.75rem;
}

#destinations-filter-form .form-item-latitude input,
#destinations-filter-form .form-item-longitude input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: monospace;
}

/* Update position button */
#update-position-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  font-weight: bold;
  margin-top: 0.5rem;
}

#update-position-btn:hover {
  background: #218838;
}

/* Distance selector */
#destinations-filter-form .form-item-distance-radius {
  margin-bottom: 0;
}

#destinations-filter-form .form-item-distance-radius select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Checkbox styling */
#destinations-filter-form .form-checkbox {
  /* Reset any theme overrides */
  -webkit-appearance: checkbox;
  -moz-appearance: checkbox;
  appearance: checkbox;

  /* Ensure visibility */
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
  cursor: pointer;

  /* Optional: Add subtle border */
  border: 1px solid #999;
  border-radius: 3px;
}

#destinations-filter-form .form-checkbox:checked {
  accent-color: #007bff;
}

#destinations-filter-form .form-item {
  margin-bottom: 0.5rem;
}

#destinations-filter-form label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

/* Search button */
#search-btn {
  background: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: 1rem;
}

#search-btn:hover {
  background: #0056b3;
}

/* Info window styling */
.marker-info {
  max-width: 300px;
  padding: 0.5rem;
}

.marker-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.marker-info h3 a {
  color: #007bff;
  text-decoration: none;
}

.marker-info h3 a:hover {
  text-decoration: underline;
}

.marker-info p {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #666;
}

.marker-info a.read-more-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.marker-info a.read-more-link:hover {
  text-decoration: underline;
}

/* Image thumbnails in marker popup */
.marker-images {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.marker-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #ddd;
  cursor: pointer;
}

.marker-thumbnail:hover {
  border-color: #007bff;
  opacity: 0.9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .destinations-sidebar {
    width: 100%;
    max-width: 320px;
    position: absolute;
    left: -320px;
    transition: left 0.3s ease;
    height: 100%;
  }

  .destinations-sidebar.open {
    left: 0;
  }

  .destinations-map-canvas {
    width: 100%;
  }
}

/* Loading indicator */
.destinations-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.destinations-loading::after {
  content: "";
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Pulsing current position marker */
.pulsing-marker {
  position: relative;
  width: 20px;
  height: 20px;
}

.pulse-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: #4285F4;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid #4285F4;
  border-radius: 50%;
  opacity: 0;
  animation: pulse 2s ease-out infinite;
  z-index: 1;
}

@keyframes pulse {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}
