/*
 * ORIGINAL IZI MOROCCO INTERACTIVE MAP
 * Restored from the user's first implementation.
 * The markup is centralized in includes/map.php, but the visual design and
 * Leaflet behaviour intentionally match the original map.
 */

#interactive-map-section {
  position: relative;
  width: 100%;
  padding: clamp(40px, 6vh, 80px) 0;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color var(--trans-smooth);
}

#interactive-map-section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(212, 137, 26, 0.06) 0%, transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(212, 137, 26, 0.04) 0%, transparent 60%);
}

#map-stage {
  position: relative;
  width: clamp(280px, 95vw, 1300px);
  height: clamp(400px, 75vh, 700px);
  z-index: 1;
}

#map-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
  background: rgba(10, 10, 10, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow:
    0 20px 40px -12px rgba(212, 137, 26, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 10;
  background: #000;
}

/* Original in-map header */
.map-glass-header {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.map-compass {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--gold);
  color: #fff;
  box-shadow: 0 0 15px rgba(212, 137, 26, 0.4);
  font-size: 20px;
}

.map-glass-header h2 {
  margin: 0;
  color: #fff;
  font-family: var(--fb);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.map-glass-header p {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.map-top-actions {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-zoom-controls {
  position: absolute;
  top: 50%;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateY(-50%);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--trans-smooth);
  cursor: pointer;
}

.glass-btn:hover {
  background: rgba(212, 137, 26, 0.15);
  border-color: rgba(212, 137, 26, 0.3);
  transform: scale(1.05);
}

.map-tour-btn {
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #0a0a0a;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, .28);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-tour-btn .map-tour-icon { color: var(--gold); }
.map-tour-btn.is-touring { background: var(--gold); color: #0a0a0a; }
.map-tour-btn.is-touring .map-tour-icon { color: #0a0a0a; }

.map-icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, .28);
  font-size: 16px;
}

/* Original animated radar markers */
.radar-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation:
    marker-appear var(--trans-bounce) both,
    float-marker 3s ease-in-out infinite alternate;
  animation-delay: calc(var(--marker-index, 0) * 0.1s), 0s;
  pointer-events: auto;
  cursor: pointer;
  z-index: 100;
  will-change: transform;
}

.radar-marker * { pointer-events: none; }
.radar-marker:hover { animation-play-state: paused; }

.radar-marker::before {
  content: "";
  position: absolute;
  bottom: -4px;
  width: 20px;
  height: 8px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  filter: blur(2px);
  z-index: 0;
  transition: transform var(--trans-smooth), opacity var(--trans-smooth);
}

.radar-core {
  width: clamp(12px, 2vw, 16px);
  height: clamp(12px, 2vw, 16px);
  background: radial-gradient(circle at 35% 30%, #ffb066 0%, var(--gold) 55%, var(--gold-d) 100%);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow:
    0 0 15px rgba(212, 137, 26, 0.8),
    0 6px 10px rgba(0, 0, 0, 0.55),
    inset -2px -2px 4px rgba(0, 0, 0, 0.35);
  z-index: 3;
  transition: transform var(--trans-bounce), background-color var(--trans-smooth);
}

.radar-pulse {
  position: absolute;
  width: clamp(34px, 5vw, 44px);
  height: clamp(34px, 5vw, 44px);
  border-radius: 50%;
  background: rgba(212, 137, 26, 0.4);
  animation: pulse-wave 2s infinite ease-out;
  z-index: 1;
}

.radar-pulse-outer {
  position: absolute;
  width: clamp(48px, 8vw, 64px);
  height: clamp(48px, 8vw, 64px);
  border-radius: 50%;
  background: rgba(212, 137, 26, 0.15);
  animation: pulse-wave 2s infinite ease-out 0.6s;
  z-index: 0;
}

.city-tag {
  position: absolute;
  top: clamp(-22px, -3vw, -26px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 3px 10px;
  border-radius: 9999px;
  font-family: var(--fb);
  font-size: clamp(9px, 1vw, 11px);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(212, 137, 26, 0.4);
  transition: all var(--trans-smooth);
}

.radar-marker:hover .radar-core {
  transform: scale(1.35);
  background: radial-gradient(circle at 35% 30%, #fff 0%, #fff 55%, var(--gold) 100%);
  border-color: var(--gold);
}
.radar-marker:hover::before { transform: scale(1.3); opacity: .8; }
.radar-marker:hover .city-tag {
  top: clamp(-26px, -3.5vw, -30px);
  background: var(--gold);
  border-color: #fff;
  color: #0a0a0a;
}

.radar-marker.tour-active .radar-core {
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--gold) 55%, var(--gold-d) 100%);
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(212, 137, 26, 1);
  transform: scale(1.2);
}
.radar-marker.tour-active .city-tag {
  background: var(--gold);
  color: #0a0a0a;
  border-color: #fff;
  top: clamp(-28px, -4vw, -32px);
  box-shadow: 0 0 20px rgba(212, 137, 26, .6);
}

@keyframes pulse-wave {
  0% { transform: scale(.2); opacity: .9; }
  80% { transform: scale(1.1); opacity: 0; }
  100% { transform: scale(1.2); opacity: 0; }
}
@keyframes marker-appear {
  0% { opacity: 0; transform: scale(.4) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes float-marker {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.animated-route {
  stroke-dasharray: 10 20;
  animation: dash 20s linear infinite;
  filter: drop-shadow(0 0 6px rgba(212, 137, 26, 0.6));
}
@keyframes dash { to { stroke-dashoffset: -2000; } }

/* Original Leaflet popup design */
.leaflet-popup { animation: popup-rise var(--trans-bounce); }
@keyframes popup-rise {
  0% { opacity: 0; transform: translateY(15px) scale(.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.leaflet-popup-content-wrapper {
  background: rgba(10, 10, 10, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  color: #fff !important;
  border-radius: clamp(1rem, 2vw, 1.5rem) !important;
  padding: 0 !important;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(212, 137, 26, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.leaflet-popup-content { margin: 0 !important; width: clamp(260px, 75vw, 360px) !important; }
.leaflet-popup-tip {
  background: rgba(10, 10, 10, 0.85) !important;
  border: 1px solid rgba(212, 137, 26, 0.2);
  border-top: none;
  border-left: none;
}
.leaflet-popup-close-button {
  color: #fff !important;
  padding: 8px !important;
  z-index: 10;
  background: rgba(0,0,0,.5) !important;
  backdrop-filter: blur(4px);
  border-radius: 50% !important;
  margin: 10px !important;
  border: 1px solid rgba(255,255,255,.1);
  transition: all .3s ease;
}
.leaflet-popup-close-button:hover { background: var(--gold) !important; color: #0a0a0a !important; }
.leaflet-control-container .leaflet-top.leaflet-left,
.leaflet-control-zoom,
.leaflet-control-attribution { display: none !important; }

/* Original city bar */
.map-city-nav {
  position: absolute;
  bottom: 32px;
  left: 50%;
  z-index: 20;
  width: 95%;
  max-width: 896px;
  padding: 8px;
  transform: translateX(-50%);
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 137, 26, 0.15);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  scrollbar-width: none;
}
.map-city-nav::-webkit-scrollbar { display: none; }
.map-city-nav-inner {
  width: 100%;
  min-width: 500px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}
.city-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all var(--trans-smooth);
}
.city-btn:hover { background: rgba(212, 137, 26, 0.12); }
.city-btn .dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #fff;
  transition: all var(--trans-bounce);
}
.city-btn .city-label {
  color: rgba(255,255,255,.7);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.city-btn:hover .dot {
  background: var(--gold);
  transform: scale(1.5);
  box-shadow: 0 0 12px rgba(212, 137, 26, .6);
}
.city-btn:hover .city-label { color: #fff; }
.city-btn.tour-active .dot {
  background: var(--gold);
  transform: scale(1.8);
  box-shadow: 0 0 20px rgba(212, 137, 26, .8);
}
.city-btn.tour-active .city-label { color: var(--gold); font-weight: 900; }
.city-btn.tour-active { background: rgba(212, 137, 26, .15); }

.tour-progress {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 137, 26, 0.2);
  border-radius: 9999px;
  padding: 4px 14px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tour-progress.hidden { display: none !important; }
.tour-progress .progress-bar {
  width: clamp(40px, 6vw, 60px);
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  overflow: hidden;
}
.tour-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-l));
  border-radius: 9999px;
  transition: width var(--trans-smooth);
}
.tour-progress > i { color: rgba(212, 137, 26, .7); }

/* Original popup adventure cards, translated away from Tailwind utilities only. */
.map-popup-content {
  position: relative;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: none;
}
.map-popup-content::-webkit-scrollbar { display: none; }
.map-popup-heading {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -1px 0 12px;
  padding: 1px 0 8px;
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(212,137,26,.3);
}
.map-popup-heading h3 {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.map-popup-adventure {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.map-popup-adventure:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.map-popup-adventure h4 {
  margin: 8px 0 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
}
.map-popup-adventure p {
  margin: 0 0 9px;
  color: rgba(255,255,255,.8);
  font-size: 11px;
  line-height: 1.55;
}
.map-popup-link {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #fff;
  color: #0a0a0a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background-color .25s ease;
}
.map-popup-link:hover { background: var(--gold); color: #0a0a0a; }

.adventure-images {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}
.adventure-images::-webkit-scrollbar { height: 3px; }
.adventure-images::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 9999px; }
.adventure-img-item {
  flex: 0 0 auto;
  width: clamp(100px, 30vw, 140px);
  height: clamp(65px, 20vw, 85px);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  scroll-snap-align: start;
  transition: border-color .3s, transform var(--trans-bounce);
  background: #1a1a1a;
}
.adventure-img-item:hover { border-color: var(--gold); transform: scale(1.03); }
.adventure-img-item img { width: 100%; height: 100%; object-fit: cover; object-position: center; }

/* The original map already used clamped sizes. These two adjustments only keep
   the same composition usable on tablets and phones without redesigning it. */
@media (max-width: 700px) {
  #interactive-map-section { padding: 30px 0; }
  #map-stage { width: 96vw; height: clamp(460px, 72vh, 620px); }
  #map-wrapper { border-radius: 18px; }
  .map-glass-header { top: 16px; left: 16px; gap: 12px; padding: 8px 14px; border-radius: 12px; }
  .map-compass { width: 40px; height: 40px; flex-basis: 40px; border-radius: 9px; font-size: 17px; }
  .map-glass-header h2 { font-size: 14px; }
  .map-glass-header p { font-size: 9px; }
  .map-top-actions { top: 16px; right: 16px; gap: 8px; }
  .map-tour-btn { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; }
  .map-tour-label { display: none; }
  .map-icon-btn { width: 40px; height: 40px; font-size: 14px; }
  .map-zoom-controls { right: 16px; }
  .map-city-nav { bottom: 16px; padding: 6px; border-radius: 12px; }
  .map-city-nav-inner { min-width: max-content; justify-content: flex-start; gap: 6px; padding-inline: 4px; }
  .city-btn { flex: 0 0 auto; min-height: 38px; padding: 8px 12px; gap: 8px; border-radius: 9px; }
  .city-btn .dot { width: 6px; height: 6px; flex-basis: 6px; }
  .city-btn .city-label { font-size: 10px; }
  .tour-progress { position: absolute; top: 64px; right: 0; }
}

@media (max-width: 430px) {
  #map-stage { width: 100%; height: 560px; }
  #map-wrapper { border-radius: 0; }
  .map-glass-header { left: 12px; top: 12px; }
  .map-top-actions { right: 12px; top: 12px; }
  .map-zoom-controls { right: 12px; }
  .map-city-nav { width: calc(100% - 24px); bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .radar-marker,
  .radar-pulse,
  .radar-pulse-outer,
  .animated-route,
  .leaflet-popup { animation: none !important; }
}
