/* POTA Spots Panel */
.spots-panel {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spots-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
  user-select: none;
  box-sizing: border-box;
}

.spots-header.expanded {
  border-radius: 8px 8px 0 0;
  width: 350px;
}

.spots-header:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.spots-toggle-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.spots-count {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.spots-count-header {
  font-weight: 600;
  font-size: 14px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.spots-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
}

.spots-header-controls {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.spots-countdown {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
}

#spotsCountdownValue {
  display: inline-block;
  min-width: 28px;
  text-align: right;
  margin-left: 2px;
}

.spots-header-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding-left: 15px;
  flex-shrink: 0;
}

.spots-content {
  background: white;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  width: 350px;
  max-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent content overflow */
  box-sizing: border-box;
}

.spots-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex: 0 0 auto;
}

.spots-filter-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  margin-right: 5px;
}

.spots-filter-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.filter-toggle-arrow {
  transition: transform 0.3s ease;
}

.spots-popout {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  margin-right: 5px;
}

.spots-popout:hover {
  background: rgba(255, 255, 255, 0.3);
}

.spots-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.spots-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.spots-refresh {
  font-size: 18px;
  display: none;
  transition: opacity 0.3s;
}

.spots-refresh.spinning {
  display: inline-block;
  opacity: 1;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Filters Section */
.spots-filters {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  background: #f9fafb;
  transition: all 0.3s ease;
  position: relative;
  z-index: 100;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-dropdown {
  position: relative;
}

.filter-button {
  width: 100%;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  overflow: hidden;
}

.filter-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.filter-button:hover {
  border-color: #667eea;
  background: #f9fafb;
}

.filter-arrow {
  font-size: 10px;
  color: #9ca3af;
}

.filter-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 10000;
  max-height: 200px;
  overflow-y: auto;
}

.filter-toggle-all {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.toggle-all-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.toggle-all-btn:hover {
  opacity: 0.9;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 13px;
}

.filter-option:hover {
  background: #f3f4f6;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  cursor: pointer;
}

/* Spots List */
.spots-list {
  overflow-y: auto;
  max-height: 360px; /* Reduced to account for status filter when visible */
  padding: 10px 10px 20px 10px; /* Extra bottom padding for spacing */
  overflow-x: hidden; /* Prevent horizontal overflow */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-content: start;
  position: relative;
  z-index: 1;
}

.spots-list::-webkit-scrollbar {
  width: 6px;
}

.spots-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.spots-list::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.spots-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.no-spots {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* Spot Cards */
.spot-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spot-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-color: #667eea;
}

.spot-card.spot-hunted {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-color: #28a745;
}

.spot-card.spot-new {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border-color: #ffc107;
}

.spot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.spot-header strong {
  font-size: 14px;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.spot-freq {
  font-size: 12px;
  color: #1f2937;
  font-weight: 700;
  white-space: nowrap;
}

.spot-reference {
  font-size: 13px;
  font-weight: 600;
  color: #667eea;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spot-name {
  font-size: 12px;
  color: #4b5563;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
}

.spot-activator-comments {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  padding: 4px 6px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 3px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.3;
}

.spot-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  font-size: 13px;
  color: #4b5563;
  align-items: center;
}

.spot-footer span {
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.spot-footer .spot-location {
  text-align: left;
  justify-self: start;
}

.spot-footer .spot-spotter {
  text-align: center;
  justify-self: center;
  white-space: nowrap;
}

.spot-footer .spot-time {
  text-align: right;
  justify-self: end;
  white-space: nowrap;
}

/* Hunted button */
.spot-hunted-btn {
  width: 100%;
  margin-top: auto;
  padding: 6px 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.spot-hunted-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.spot-hunted-btn.active {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

/* Session hunted card styling */
.spot-card.spot-session-hunted {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  border-color: #9ca3af;
  opacity: 0.8;
}

/* Toggle switch for hide hunted filter */
.filter-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
}

.filter-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.filter-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.filter-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  transition: 0.3s;
  border-radius: 24px;
}

.filter-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.filter-toggle-switch input:checked + .filter-toggle-slider {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.filter-toggle-switch input:checked + .filter-toggle-slider:before {
  transform: translateX(24px);
}

/* Grid responsive breakpoints */
@media (max-width: 600px) {
  .spots-list {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SPOT MARKERS ON MAP
   ============================================ */

/* Spot marker container - always purple/blue like header */
.spot-marker-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.spot-marker-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

/* Yellow pulsing ring for new spots */
.spot-marker-icon.spot-marker-new::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  opacity: 0.8;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  z-index: -1;
}

/* Green pulsing ring for hunted spots */
.spot-marker-icon.spot-marker-hunted::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  opacity: 0.8;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  z-index: -1;
}

@keyframes pulse-ring {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Spot marker popup styling */
.spot-marker-popup .leaflet-popup-content-wrapper {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0;
}

.spot-marker-popup .leaflet-popup-content {
  margin: 0;
  min-width: 250px;
}

.spot-popup-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 15px;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 14px;
}

.spot-popup-body {
  padding: 15px;
}

.spot-popup-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.spot-popup-label {
  font-weight: 600;
  color: #4b5563;
}

.spot-popup-value {
  color: #1f2937;
}

.spot-popup-comments {
  margin-top: 10px;
  padding: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  font-size: 12px;
  font-style: italic;
  color: #6b7280;
}

.spot-popup-button {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.spot-popup-button:hover {
  opacity: 0.9;
}

.spot-popup-button.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  cursor: default;
}

@media (min-width: 601px) and (max-width: 900px) {
  .spots-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1400px) {
  .spots-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (min-width: 1401px) {
  .spots-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .spots-panel {
    top: 5px;
    right: 5px;
  }

  .spots-content {
    width: calc(100vw - 20px);
    max-width: 350px;
  }

  .spots-filters {
    grid-template-columns: 1fr;
  }

  .spots-list {
    max-height: 300px;
  }
}
