/* SparkleTour - Follow Me Mode Feature */

/* ============================================
   CHRISTMAS EMOJI USER LOCATION MARKER
   ============================================ */

/* Hide default Leaflet location marker when follow mode is active */
.follow-mode-active .leaflet-control-locate-location {
  display: none !important;
}

/* Christmas Location Marker Container */
.christmas-location-marker {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: markerFloat 3s ease-in-out infinite;
}

@keyframes markerFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Glowing background effect */
.marker-glow {
  position: absolute;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 70%);
  border-radius: 50%;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Emoji marker */
.marker-emoji {
  font-size: 32px;
  line-height: 1;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: emojiRotate 8s linear infinite;
}

@keyframes emojiRotate {
  0% {
    transform: rotate(-5deg);
  }
  50% {
    transform: rotate(5deg);
  }
  100% {
    transform: rotate(-5deg);
  }
}

/* ============================================
   FOLLOW MODE INDICATOR (LEFT SIDE)
   Styled to match filter-indicator-control
   ============================================ */

.follow-indicator-control {
  margin-top: 8px;
  animation: slideInDown 0.3s ease-out;
  order: 11; /* Ensure it appears after filter indicator */
}

.follow-indicator-control a.follow-indicator-button {
  width: 48px;
  height: 48px;
  line-height: 48px;
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  color: white !important;
  border: none;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  animation: followPulse 2s ease-in-out infinite;
}

.follow-indicator-control a.follow-indicator-button:hover {
  background: #c82333 !important;
  transform: scale(1.05);
}

.follow-indicator-control a.follow-indicator-button:active {
  transform: scale(0.98);
}

/* Active state - following */
.follow-indicator-control a.follow-indicator-button.active {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  animation: followPulse 2s ease-in-out infinite;
}

/* Inactive state - not following but location visible */
.follow-indicator-control a.follow-indicator-button.inactive {
  background: linear-gradient(135deg, #666, #444) !important;
  animation: none;
  opacity: 0.7;
}

.follow-indicator-control a.follow-indicator-button.inactive:hover {
  opacity: 1;
}

@keyframes followPulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
  }
  50% {
    box-shadow: 0 2px 12px rgba(46, 125, 50, 0.6);
  }
}

/* Icon inside button */
.follow-indicator-icon {
  font-size: 24px;
  color: white;
  line-height: 1;
}

/* Rotating compass needle effect when active */
.follow-indicator-control a.follow-indicator-button.active .follow-indicator-icon {
  animation: compassRotate 4s linear infinite;
}

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

/* Status badge - similar to filter count badge */
.follow-status-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ffd700;
  color: #333;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.follow-indicator-control a.follow-indicator-button.inactive .follow-status-badge {
  background: #999;
  color: white;
}

/* Slide in animation */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide out animation */
.follow-indicator-control.hiding {
  animation: slideOutUp 0.3s ease-out forwards;
}

@keyframes slideOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .follow-indicator-control {
    margin-top: 8px;
  }
  
  /* Hide follow indicator when popup is open on mobile */
  .leaflet-popup-pane:not(:empty) ~ .leaflet-top .follow-indicator-control {
    display: none;
  }
  
  .santas-sled-marker {
    width: 50px;
    height: 50px;
  }
  
  .sled-body {
    width: 35px;
    height: 18px;
  }
  
  .santa-head {
    width: 12px;
    height: 12px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.follow-indicator-control a.follow-indicator-button:focus {
  outline: 3px solid #ffd700;
  outline-offset: 2px;
}

.follow-indicator-control a.follow-indicator-button:focus:not(:focus-visible) {
  outline: none;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   IMMERSIVE MODE (Mobile Only)
   Auto-hide controls for distraction-free navigation
   ============================================ */

/* Mobile devices - use touch capability instead of just screen size */
@media (hover: none) and (pointer: coarse) {
  /* Immersive mode - hide all controls including follow indicator */
  body.follow-mode-immersive .fab-container,
  body.follow-mode-immersive .overlay-logo,
  body.follow-mode-immersive .help-button-wrapper,
  body.follow-mode-immersive .support-chip-container,
  body.follow-mode-immersive .routing-tab-trigger,
  body.follow-mode-immersive .leaflet-control-zoom,
  body.follow-mode-immersive .leaflet-control-layers,
  body.follow-mode-immersive .filter-indicator-control,
  body.follow-mode-immersive .route-toggle-control,
  body.follow-mode-immersive .follow-indicator-control,
  body.follow-mode-immersive .leaflet-bar {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease-out, width 0.3s ease, box-shadow 0.3s ease;
  }
  
  /* Smooth fade-in when controls are revealed */
  body:not(.follow-mode-immersive) .fab-container,
  body:not(.follow-mode-immersive) .overlay-logo,
  body:not(.follow-mode-immersive) .help-button-wrapper,
  body:not(.follow-mode-immersive) .support-chip-container,
  body:not(.follow-mode-immersive) .routing-tab-trigger,
  body:not(.follow-mode-immersive) .leaflet-control-zoom,
  body:not(.follow-mode-immersive) .leaflet-control-layers,
  body:not(.follow-mode-immersive) .filter-indicator-control,
  body:not(.follow-mode-immersive) .route-toggle-control,
  body:not(.follow-mode-immersive) .follow-indicator-control,
  body:not(.follow-mode-immersive) .leaflet-bar {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease-in, width 0.3s ease, box-shadow 0.3s ease;
  }
}

/* Fallback for older browsers that don't support hover/pointer media queries */
@media (max-width: 1024px) and (max-height: 1024px) {
  body.follow-mode-immersive .fab-container,
  body.follow-mode-immersive .overlay-logo,
  body.follow-mode-immersive .help-button-wrapper,
  body.follow-mode-immersive .support-chip-container,
  body.follow-mode-immersive .routing-tab-trigger,
  body.follow-mode-immersive .leaflet-control-zoom,
  body.follow-mode-immersive .leaflet-control-layers,
  body.follow-mode-immersive .filter-indicator-control,
  body.follow-mode-immersive .route-toggle-control,
  body.follow-mode-immersive .follow-indicator-control,
  body.follow-mode-immersive .leaflet-bar {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease-out, width 0.3s ease, box-shadow 0.3s ease;
  }
  
  body:not(.follow-mode-immersive) .fab-container,
  body:not(.follow-mode-immersive) .overlay-logo,
  body:not(.follow-mode-immersive) .help-button-wrapper,
  body:not(.follow-mode-immersive) .support-chip-container,
  body:not(.follow-mode-immersive) .routing-tab-trigger,
  body:not(.follow-mode-immersive) .leaflet-control-zoom,
  body:not(.follow-mode-immersive) .leaflet-control-layers,
  body:not(.follow-mode-immersive) .filter-indicator-control,
  body:not(.follow-mode-immersive) .route-toggle-control,
  body:not(.follow-mode-immersive) .follow-indicator-control,
  body:not(.follow-mode-immersive) .leaflet-bar {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease-in, width 0.3s ease, box-shadow 0.3s ease;
  }
}

/* Desktop - never hide controls */
@media (min-width: 769px) {
  body.follow-mode-immersive .fab-container,
  body.follow-mode-immersive .overlay-logo,
  body.follow-mode-immersive .help-button-wrapper,
  body.follow-mode-immersive .support-chip-container,
  body.follow-mode-immersive .routing-tab-trigger,
  body.follow-mode-immersive .leaflet-control-zoom,
  body.follow-mode-immersive .leaflet-control-layers,
  body.follow-mode-immersive .filter-indicator-control,
  body.follow-mode-immersive .route-toggle-control,
  body.follow-mode-immersive .follow-indicator-control,
  body.follow-mode-immersive .leaflet-bar {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}