/* ============================================
   KEY2 Decision Experience — Premium Map Module
   ============================================ */

/* --- Map Section Layout --- */
.map-section { padding: 80px 0 60px; position: relative; }

.map-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  margin-top: 28px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  background: var(--white);
  min-height: 600px;
}

/* --- Map Canvas --- */
.map-canvas {
  position: relative;
  min-height: 600px;
}
#mapbox-map {
  width: 100%;
  height: 100%;
  min-height: 600px;
}

/* --- Map Controls Overlay --- */
.map-controls-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
body[dir="rtl"] .map-controls-overlay { flex-direction: row-reverse; }

.map-filter-tabs {
  display: flex;
  gap: 6px;
  background: rgba(10, 46, 26, 0.92);
  backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 14px;
  pointer-events: all;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.map-filter-tab {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  background: transparent;
  transition: all 0.3s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.map-filter-tab:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.map-filter-tab.active {
  background: var(--gold-500);
  color: var(--green-900);
  font-weight: 600;
}

.map-aux-btns {
  display: flex;
  gap: 6px;
  pointer-events: all;
}
.map-aux-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(10, 46, 26, 0.92);
  backdrop-filter: blur(12px);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border: none;
  font-size: 1rem;
}
.map-aux-btn:hover { background: rgba(201, 168, 76, 0.9); color: var(--green-900); }

/* --- Side Panel --- */
.map-side-panel {
  background: linear-gradient(180deg, #fafbfc 0%, #f3f4f6 100%);
  border-left: 1px solid var(--neutral-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[dir="rtl"] .map-side-panel {
  border-left: none;
  border-right: 1px solid var(--neutral-200);
}

.map-panel-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--neutral-200);
  background: var(--white);
}
.map-panel-header h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold-500);
  margin-bottom: 4px;
}
.map-panel-header p {
  font-size: 0.8rem;
  color: var(--neutral-400);
}

.map-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Default state */
.map-panel-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  height: 100%;
}
.map-panel-default-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-50);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 1.6rem;
}
.map-panel-default p {
  font-size: 0.9rem;
  color: var(--neutral-400);
  line-height: 1.7;
  max-width: 250px;
}

/* Active point */
.map-panel-point {
  display: none;
  animation: panelSlideIn 0.4s ease;
}
.map-panel-point.active { display: block; }

.map-panel-point-header {
  padding: 24px;
  background: var(--white);
  border-bottom: 1px solid var(--neutral-100);
}
.map-panel-point-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.map-panel-point-cat.demand { background: #dcfce7; color: #166534; }
.map-panel-point-cat.access { background: var(--gold-100); color: #8b6914; }
.map-panel-point-cat.surrounding { background: #dbeafe; color: #1e40af; }
.map-panel-point-cat.key2 { background: var(--gold-100); color: #8b6914; }

.map-panel-point-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--green-900);
  margin-bottom: 4px;
  line-height: 1.3;
}
.map-panel-point-subtitle {
  font-size: 0.85rem;
  color: var(--neutral-500);
}

/* --- Route Info Box (Directions API) --- */
.map-route-info-box {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0a2e1a 0%, #14532d 100%);
  border-radius: 12px;
  color: var(--white);
}
.route-info-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-300);
  margin-bottom: 10px;
}
.route-info-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}
.route-info-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.route-info-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
.route-info-unit {
  font-size: 0.7rem;
  color: var(--neutral-400);
  font-weight: 400;
}
.route-info-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.2);
}

.map-panel-point-body { padding: 20px 24px; }

.map-panel-time {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--green-50);
  border-radius: 12px;
  margin-bottom: 20px;
}
.map-panel-time-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--green-400);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.map-panel-time-text {
  font-size: 0.85rem;
  color: var(--green-700);
  font-weight: 500;
}
.map-panel-time-note {
  font-size: 0.7rem;
  color: var(--neutral-400);
  display: block;
  font-weight: 400;
}

.map-panel-desc {
  font-size: 0.9rem;
  color: var(--neutral-600);
  line-height: 1.8;
  margin-bottom: 20px;
}

.map-panel-details { margin-bottom: 20px; }
.map-panel-detail {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral-100);
  font-size: 0.85rem;
  color: var(--neutral-600);
  line-height: 1.5;
}
.map-panel-detail:last-child { border-bottom: none; }
.map-panel-detail-dot {
  width: 6px;
  height: 6px;
  min-width: 6px;
  border-radius: 50%;
  background: var(--green-400);
  margin-top: 7px;
}

.map-panel-back {
  margin: 0 24px 24px;
  padding: 12px;
  background: var(--green-900);
  color: var(--white);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  width: calc(100% - 48px);
  font-family: inherit;
}
.map-panel-back:hover { background: var(--green-800); }

/* --- Insight Bar --- */
.map-insight-bar {
  margin-top: 20px;
  padding: 16px 24px;
  background: var(--white);
  border-radius: 14px;
  border: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: all 0.5s;
}
.map-insight-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: var(--green-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.map-insight-text {
  font-size: 0.9rem;
  color: var(--neutral-600);
  line-height: 1.6;
}

/* --- 3D Custom Markers --- */
.map-marker-el {
  cursor: pointer;
  perspective: 400px;
  transform-style: preserve-3d;
  transition: transform 0.3s;
}
.map-marker-el:hover { transform: scale(1.12) translateZ(8px); }

/* 3D Pin base — all markers stand up from the ground */
.marker-3d-pin {
  position: relative;
  transform-style: preserve-3d;
}
.marker-3d-pin::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%) rotateX(75deg);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,0.35) 0%, transparent 70%);
  pointer-events: none;
}

.marker-key2 {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4444 0%, #dc2626 40%, #991b1b 100%);
  border: 4px solid rgba(255,255,255,0.95);
  box-shadow:
    0 0 30px rgba(220, 38, 38, 0.6),
    0 0 60px rgba(220, 38, 38, 0.3),
    0 0 0 8px rgba(220, 38, 38, 0.15),
    0 0 0 16px rgba(220, 38, 38, 0.06),
    inset 0 3px 6px rgba(255,255,255,0.3),
    inset 0 -3px 6px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  transform: translateZ(16px);
  animation: key2HeartBeat 2s ease-in-out infinite;
  position: relative;
}
.marker-key2 span {
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  position: relative;
  z-index: 2;
}
/* Outer pulsing rings */
.marker-key2::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(220, 38, 38, 0.5);
  transform: translate(-50%, -50%);
  animation: key2Ring1 2.5s ease-out infinite;
  pointer-events: none;
}
.marker-key2::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(220, 38, 38, 0.3);
  transform: translate(-50%, -50%);
  animation: key2Ring2 2.5s ease-out infinite 0.8s;
  pointer-events: none;
}

@keyframes key2HeartBeat {
  0%, 100% {
    transform: translateZ(16px) scale(1);
    box-shadow: 0 0 30px rgba(220,38,38,0.6), 0 0 60px rgba(220,38,38,0.3), 0 0 0 8px rgba(220,38,38,0.15), 0 0 0 16px rgba(220,38,38,0.06), inset 0 3px 6px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.2);
  }
  30% {
    transform: translateZ(20px) scale(1.12);
    box-shadow: 0 0 40px rgba(220,38,38,0.8), 0 0 80px rgba(220,38,38,0.4), 0 0 0 10px rgba(220,38,38,0.2), 0 0 0 20px rgba(220,38,38,0.08), inset 0 3px 6px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.2);
  }
  50% {
    transform: translateZ(16px) scale(1);
  }
  65% {
    transform: translateZ(18px) scale(1.06);
    box-shadow: 0 0 35px rgba(220,38,38,0.7), 0 0 70px rgba(220,38,38,0.35), 0 0 0 9px rgba(220,38,38,0.18), 0 0 0 18px rgba(220,38,38,0.07), inset 0 3px 6px rgba(255,255,255,0.3), inset 0 -3px 6px rgba(0,0,0,0.2);
  }
}
@keyframes key2Ring1 {
  0% { width: 64px; height: 64px; opacity: 0.7; }
  100% { width: 140px; height: 140px; opacity: 0; }
}
@keyframes key2Ring2 {
  0% { width: 64px; height: 64px; opacity: 0.5; }
  100% { width: 120px; height: 120px; opacity: 0; }
}

.marker-demand {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #4ade80 0%, #22c55e 50%, #16a34a 100%);
  border: 3px solid rgba(255,255,255,0.95);
  box-shadow:
    0 6px 18px rgba(34,197,94,0.4),
    inset 0 2px 4px rgba(255,255,255,0.25),
    inset 0 -2px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--white);
  transform: translateZ(8px);
}

.marker-access {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #e0ca7e 0%, #c9a84c 50%, #b09530 100%);
  border: 3px solid rgba(255,255,255,0.95);
  box-shadow:
    0 6px 16px rgba(201,168,76,0.4),
    inset 0 2px 3px rgba(255,255,255,0.25),
    inset 0 -2px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--green-900);
  transform: translateZ(8px);
}

.marker-surrounding {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(145deg, #bbf7d0 0%, #86efac 50%, #4ade80 100%);
  border: 3px solid rgba(255,255,255,0.95);
  box-shadow:
    0 5px 14px rgba(134,239,172,0.35),
    inset 0 2px 3px rgba(255,255,255,0.3),
    inset 0 -2px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #0a2e1a;
  transform: translateZ(6px);
}

/* 3D Label — floating above marker */
.marker-label {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%) translateZ(4px);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--white);
  background: rgba(10, 46, 26, 0.9);
  padding: 3px 10px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  letter-spacing: 0.2px;
}
.map-marker-el:hover .marker-label { opacity: 1; }
.map-marker-el.show-label .marker-label { opacity: 1; }

.marker-selected {
  box-shadow: 0 0 0 6px rgba(201,168,76,0.4), 0 8px 28px rgba(0,0,0,0.3) !important;
  transform: scale(1.15) translateZ(16px) !important;
}

/* --- 3D Car Marker (drone camera follows it) --- */
.car-marker {
  pointer-events: none;
  font-size: 36px;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.6));
  transform: translateZ(10px);
  transition: transform 0.05s linear;
}

/* --- Arrival Stats Overlay --- */
.arrival-stats-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding: 24px;
}
.arrival-stats-overlay.active {
  display: flex !important;
  animation: arrivalFadeIn 0.6s ease;
}
.arrival-stats-card {
  background: linear-gradient(160deg, #0a2e1a 0%, #0f3d23 40%, #14532d 100%);
  border-radius: 24px;
  padding: 40px 48px;
  max-width: 560px;
  width: 100%;
  color: var(--white);
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  animation: arrivalSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.arrival-stats-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.3s;
}
body[dir="rtl"] .arrival-stats-close { right: auto; left: 20px; }
.arrival-stats-close:hover { background: rgba(255,255,255,0.2); }

.arrival-stats-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.arrival-stats-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  line-height: 1.3;
}
.arrival-stats-sub {
  font-size: 0.9rem;
  color: var(--gold-300);
  font-weight: 500;
}

.arrival-stats-route {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}
.arrival-stat-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 20px;
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--gold-300);
}
.arrival-stat-pill span {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-400);
}

.arrival-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.arrival-stat-item {
  padding: 16px 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.arrival-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold-400);
  line-height: 1.2;
  margin-bottom: 4px;
}
.arrival-stat-label {
  font-size: 0.78rem;
  color: var(--neutral-300);
  line-height: 1.4;
}

.arrival-stats-importance {
  padding: 16px 20px;
  background: rgba(34, 197, 94, 0.08);
  border-radius: 12px;
  border-left: 3px solid var(--green-400);
  font-size: 0.88rem;
  color: var(--neutral-300);
  line-height: 1.7;
}
body[dir="rtl"] .arrival-stats-importance {
  border-left: none;
  border-right: 3px solid var(--green-400);
}

@keyframes arrivalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes arrivalSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
  .arrival-stats-card { padding: 28px 24px; }
  .arrival-stats-name { font-size: 1.3rem; }
  .arrival-stats-grid { grid-template-columns: 1fr; }
  .arrival-stat-val { font-size: 1.3rem; }
  .route-picker-card { padding: 28px 20px; }
}

/* --- Route Picker Card --- */
.route-picker-card {
  background: linear-gradient(160deg, #0a2e1a 0%, #0f3d23 40%, #14532d 100%);
  border-radius: 24px;
  padding: 36px 40px;
  max-width: 480px;
  width: 100%;
  color: var(--white);
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  animation: arrivalSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.route-picker-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.route-picker-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4444 0%, #dc2626 50%, #991b1b 100%);
  border: 3px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 0 20px rgba(220,38,38,0.4);
}
.route-picker-header h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
}
.route-picker-header p {
  font-size: 0.85rem;
  color: var(--neutral-400);
  line-height: 1.6;
}
.route-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.route-picker-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: start;
  width: 100%;
  font-family: inherit;
  color: inherit;
}
.route-picker-item:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(201, 168, 76, 0.3);
  transform: translateX(-4px);
}
body[dir="rtl"] .route-picker-item:hover { transform: translateX(4px); }
.route-picker-item-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.route-picker-item-text { flex: 1; }
.route-picker-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}
.route-picker-item-sub {
  font-size: 0.75rem;
  color: var(--neutral-400);
}
.route-picker-item-arrow {
  font-size: 1.2rem;
  color: var(--gold-400);
  opacity: 0.5;
  transition: all 0.3s;
}
.route-picker-item:hover .route-picker-item-arrow {
  opacity: 1;
  transform: translateX(-4px);
}
body[dir="rtl"] .route-picker-item:hover .route-picker-item-arrow { transform: translateX(4px); }

.marker-selected {
  box-shadow: 0 0 0 6px rgba(201,168,76,0.4), 0 4px 20px rgba(0,0,0,0.2) !important;
  transform: scale(1.2);
}

.marker-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--white);
  background: rgba(10,46,26,0.85);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.map-marker-el:hover .marker-label { opacity: 1; }
.map-marker-el.show-label .marker-label { opacity: 1; }

/* --- Demand Pulse Lines --- */
.pulse-ring {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 76, 0.3);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRing 3s ease-out infinite;
  pointer-events: none;
}

/* --- Mapbox Overrides --- */
.mapboxgl-ctrl-group { border-radius: 10px !important; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important; }
.mapboxgl-ctrl-group button { width: 36px !important; height: 36px !important; }
.mapboxgl-ctrl-attrib { font-size: 10px !important; }
.mapboxgl-popup { max-width: none !important; }
.mapboxgl-popup-content {
  padding: 0 !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2) !important;
  overflow: hidden;
  min-width: 200px;
}
.mapboxgl-popup-close-button { font-size: 18px; padding: 6px 10px; color: #6b7280; }
.mapboxgl-popup-tip { border-top-color: white !important; }

/* --- Map Fallback --- */
.map-fallback-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 600px;
  background: linear-gradient(160deg, #0f3d23 0%, #14532d 100%);
  border-radius: 20px;
  text-align: center;
  padding: 60px 40px;
}
.map-fallback-box-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 24px;
}
.map-fallback-box p {
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  max-width: 400px;
  line-height: 1.7;
}

/* --- Animations --- */
@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .map-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .map-canvas { min-height: 450px; }
  #mapbox-map { min-height: 450px; }
  .map-side-panel {
    border-left: none;
    border-top: 1px solid var(--neutral-200);
    max-height: 400px;
  }
  body[dir="rtl"] .map-side-panel { border-right: none; }
}

@media (max-width: 768px) {
  .map-section { padding: 60px 0 40px; }
  .map-canvas { min-height: 380px; }
  #mapbox-map { min-height: 380px; }
  .map-filter-tabs { flex-wrap: wrap; }
  .map-filter-tab { padding: 6px 14px; font-size: 0.78rem; }
  .map-controls-overlay { flex-direction: column; gap: 8px; align-items: flex-start; }
  body[dir="rtl"] .map-controls-overlay { align-items: flex-end; flex-direction: column; }
  .map-aux-btns { align-self: flex-end; }
  body[dir="rtl"] .map-aux-btns { align-self: flex-start; }
  .map-side-panel { max-height: 350px; }
}

@media (max-width: 480px) {
  .map-canvas { min-height: 320px; }
  #mapbox-map { min-height: 320px; }
  .map-filter-tab { padding: 6px 10px; font-size: 0.72rem; }
}
