/* ==========================================================================
   ESTUDIANTINA.ONLINE — GUERRA DE COLEGIOS: CONQUISTA POSADAS
   Mapa Virtual Interactivo de 500 Secciones en Tiempo Real
   Estética Dark Minimal / Neon Posadeño
   ========================================================================== */

:root {
  --map-bg: #07080c;
  --map-surface: #0f1118;
  --map-surface-card: #151824;
  --map-surface-hover: #1c2030;
  --map-border: #23283b;
  --map-border-active: #3b4363;

  --map-accent: #f59e0b;
  --map-accent-rgb: 245, 158, 11;
  --map-cyan: #06b6d4;
  --map-cyan-rgb: 6, 182, 212;
  --map-red: #ef4444;
  --map-green: #10b981;
  --map-gold: #fbbf24;

  --map-text-primary: #f8fafc;
  --map-text-secondary: #cbd5e1;
  --map-text-muted: #64748b;

  --river-water: #0b1f3a;
  --river-bank: #1a365d;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.page-mapa {
  background-color: var(--map-bg);
  color: var(--map-text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  inset: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   HEADER Y NAVEGACIÓN
   -------------------------------------------------------------------------- */
.map-header {
  height: 56px;
  background-color: rgba(15, 17, 24, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--map-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
}

.map-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.map-brand-domain {
  color: var(--map-accent);
}

.map-badge-game {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fef08a;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.map-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ef4444;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.map-header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-nav-link {
  color: var(--map-text-secondary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map-nav-link:hover {
  background-color: var(--map-surface-hover);
  color: #fff;
}

/* Estado de Usuario / Auth en Header */
.map-user-widget {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--map-surface-card);
  border: 1px solid var(--map-border);
  padding: 3px 10px 3px 4px;
  border-radius: var(--radius-full);
}

.map-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--map-accent);
}

.map-user-info {
  display: flex;
  flex-direction: column;
}

.map-user-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-user-school {
  font-size: 0.68rem;
  color: var(--map-accent);
  font-weight: 600;
}

.map-btn-edit-profile {
  background: transparent;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--map-text-secondary);
  border-radius: 4px;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.map-btn-edit-profile:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.15);
}

.map-btn-login {
  background: #ffffff;
  color: #0f172a;
  border: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   TICKER SUPERIOR (FEED EN VIVO DE BATALLAS)
   -------------------------------------------------------------------------- */
.map-ticker-wrap {
  height: 32px;
  background: linear-gradient(90deg, #090b12 0%, #111420 50%, #090b12 100%);
  border-bottom: 1px solid var(--map-border);
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 16px;
  font-size: 0.76rem;
  z-index: 40;
  flex-shrink: 0;
}

.map-ticker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--map-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  padding-right: 14px;
  border-right: 1px solid var(--map-border);
}

.map-ticker-content {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  padding-left: 14px;
}

.map-ticker-items {
  display: inline-flex;
  gap: 28px;
  animation: tickerScroll 38s linear infinite;
}

.map-ticker-items:hover {
  animation-play-state: paused;
}

.map-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--map-text-secondary);
}

.map-ticker-item strong {
  color: #fff;
}

.map-ticker-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.map-ticker-tag.conquista { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.map-ticker-tag.robo { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.map-ticker-tag.renovacion { background: rgba(6, 182, 212, 0.2); color: #38bdf8; }

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* --------------------------------------------------------------------------
   LAYOUT PRINCIPAL
   -------------------------------------------------------------------------- */
.map-main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  position: relative;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   CONTENEDOR DEL MAPA Y CONTROLES
   -------------------------------------------------------------------------- */
.map-viewport-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--map-bg);
  cursor: grab;
}

.map-viewport-wrapper:active {
  cursor: grabbing;
}

/* --------------------------------------------------------------------------
   MAPA REAL DE GOOGLE CON LEAFLET
   -------------------------------------------------------------------------- */
#google-map-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #0b0f19;
  z-index: 10;
}

/* Selector Flotante de Capas de Google Maps */
.map-layer-selector {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 17, 24, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-full);
  padding: 4px;
  z-index: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.map-layer-btn {
  background: transparent;
  border: none;
  color: var(--map-text-secondary);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.map-layer-btn:hover {
  color: #fff;
  background: var(--map-surface-hover);
}

.map-layer-btn.active {
  background: var(--map-accent);
  color: #000;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* Tooltip personalizado de Leaflet */
.map-leaflet-tooltip {
  background: rgba(15, 17, 24, 0.94) !important;
  border: 1px solid var(--map-border) !important;
  color: #fff !important;
  font-family: var(--font-body) !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7) !important;
  padding: 4px 8px !important;
}

.map-leaflet-tooltip::before {
  border-top-color: var(--map-border) !important;
}

/* --------------------------------------------------------------------------
   ICONOS Y BADGES DE SECCIONES RECLAMADAS POR COLEGIOS
   -------------------------------------------------------------------------- */
.leaflet-div-icon.map-claimed-icon-wrap {
  background: transparent !important;
  border: none !important;
}

.map-claimed-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--badge-bg, #1d4ed8);
  border: 2px solid var(--badge-border, #ffffff);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 12px var(--badge-bg, #1d4ed8);
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  user-select: none;
}

.map-claimed-badge:hover {
  transform: scale(1.35);
  z-index: 1000 !important;
}

.map-claimed-badge.shielded {
  border-color: #06b6d4 !important;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.9), 0 3px 10px rgba(0, 0, 0, 0.9);
}

.badge-shield-mini {
  position: absolute;
  bottom: -4px;
  right: -5px;
  font-size: 0.65rem;
  line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.9));
  pointer-events: none;
}

.map-claimed-badge.vulnerable {
  /* Sin animación de parpadeo continua para garantizar 60 FPS y rendimiento fluido */
  border-color: rgba(245, 158, 11, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

/* Marcadores de Sedes Escolares en Google Maps (33 Colegios) */
.leaflet-school-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #0f1118;
  border: 2px solid var(--map-accent);
  border-radius: 50%;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.9), 0 0 10px rgba(245, 158, 11, 0.6);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.leaflet-school-pin:hover {
  transform: scale(1.3);
  z-index: 1000 !important;
}

/* Marcadores de Zonas Emblemáticas */
.leaflet-emblematic-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: #151824;
  border: 2px solid #fbbf24;
  border-radius: 50%;
  font-size: 1.15rem;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.75);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   BARRA DE ESTADO FLOTANTE Y CONTROLES DE ZOOM
   -------------------------------------------------------------------------- */
.map-floating-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 45;
}

.map-zoom-group {
  display: flex;
  flex-direction: column;
  background: rgba(15, 17, 24, 0.9);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}

.map-control-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.map-control-btn:hover {
  background: var(--map-surface-hover);
  color: var(--map-accent);
}

.map-control-btn + .map-control-btn {
  border-top: 1px solid var(--map-border);
}

/* Barra de Estado del Jugador */
.map-status-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(15, 17, 24, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.map-cooldown-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.map-cooldown-badge.ready {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.map-cooldown-badge.waiting {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Fondo de overlay para mobile */
.map-sheet-backdrop {
  display: none;
}

/* Tirador táctil e indicador para Mobile Bottom Sheet */
.map-sheet-handle-wrap {
  display: none;
}

.map-sidebar {
  background-color: var(--map-surface);
  border-left: 1px solid var(--map-border);
  display: flex;
  flex-direction: column;
  z-index: 48;
  overflow: hidden;
}

.map-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--map-border);
  background: rgba(11, 13, 19, 0.8);
}

.map-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--map-text-muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 12px 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.map-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--map-accent);
  background: rgba(245, 158, 11, 0.05);
}

.map-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Inspector de Sección */
.map-inspector-card {
  background: var(--map-surface-card);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.map-inspector-title-wrap {
  display: flex;
  flex-direction: column;
}

.map-inspector-zone {
  font-size: 0.72rem;
  color: var(--map-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-inspector-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.map-inspector-mult {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Ficha del Propietario */
.map-owner-box {
  background: rgba(11, 13, 19, 0.6);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.map-owner-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #1e2230;
  flex-shrink: 0;
}

.map-owner-details {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.map-owner-school {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}

.map-owner-player {
  font-size: 0.76rem;
  color: var(--map-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Estado de Defensa */
.map-defense-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-defense-status.blindado {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #38bdf8;
}

.map-defense-status.vulnerable {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.map-defense-status.neutral {
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #94a3b8;
}

/* Botón de Acción Principal de Conquista */
.map-btn-action {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-btn-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.map-btn-action.conquistar {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}

.map-btn-action.robar {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.map-btn-action.renovar {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #fff;
}

.map-btn-action.login-needed {
  background: #ffffff;
  color: #0f172a;
}

.map-btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Tabla de Clasificación de Colegios */
.map-leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--map-surface-card);
  border: 1px solid var(--map-border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.map-leaderboard-row:hover {
  border-color: var(--map-border-active);
}

.map-leaderboard-rank {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  width: 22px;
  color: var(--map-text-muted);
}

.map-leaderboard-row:nth-child(1) .map-leaderboard-rank { color: #fbbf24; }
.map-leaderboard-row:nth-child(2) .map-leaderboard-rank { color: #94a3b8; }
.map-leaderboard-row:nth-child(3) .map-leaderboard-rank { color: #d97706; }

.map-leaderboard-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.map-leaderboard-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.map-leaderboard-stats {
  text-align: right;
}

.map-leaderboard-pct {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--map-accent);
}

.map-leaderboard-sub {
  font-size: 0.68rem;
  color: var(--map-text-muted);
}

/* --------------------------------------------------------------------------
   MODAL DE GOOGLE AUTH / ONBOARDING
   -------------------------------------------------------------------------- */
.map-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.map-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.map-modal-card {
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

.map-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.map-modal-close {
  background: transparent;
  border: none;
  color: var(--map-text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.map-modal-desc {
  font-size: 0.86rem;
  color: var(--map-text-secondary);
}

.map-gis-button-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

/* Toast Notifications */
.map-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111420;
  border: 1px solid var(--map-accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  z-index: 110;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.map-toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   SISTEMA DE INTERFAZ RESPONSIVE MOBILE (SMARTPHONES & TABLETS)
   ========================================================================== */

@media (max-width: 960px) {
  /* Layout: Mapa en pantalla completa con Bottom Sheet deslizable */
  .map-main-layout {
    display: block;
    position: relative;
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .map-viewport-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
  }

  /* Backdrop oscuro para cuando el bottom sheet está expandido */
  .map-sheet-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .map-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Bottom Sheet: Panel lateral adaptado a bandeja inferior */
  .map-sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    max-height: calc(100% - 60px);
    background: rgba(14, 17, 26, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(245, 158, 11, 0.4);
    border-left: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 36px rgba(0, 0, 0, 0.9);
    z-index: 100;
    transform: translateY(calc(100% - 68px));
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
  }

  .map-sidebar.expanded,
  .map-sidebar.sheet-expanded {
    transform: translateY(0);
  }

  /* Tirador y resumen rápido */
  .map-sheet-handle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 14px 8px 14px;
    cursor: pointer;
    user-select: none;
    background: rgba(21, 24, 36, 0.98);
    border-bottom: 1px solid var(--map-border);
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
    touch-action: pan-y;
  }

  .map-sheet-handle-bar {
    width: 38px;
    height: 4px;
    background: var(--map-text-muted);
    border-radius: var(--radius-full);
    margin-bottom: 6px;
    opacity: 0.7;
    transition: all 0.2s ease;
  }

  .map-sheet-handle-wrap:hover .map-sheet-handle-bar,
  .map-sidebar.expanded .map-sheet-handle-bar,
  .map-sidebar.sheet-expanded .map-sheet-handle-bar {
    opacity: 1;
    width: 44px;
    background: var(--map-accent);
  }

  .map-sheet-quick-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .sheet-quick-left {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
  }

  .sheet-quick-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sheet-quick-sub {
    font-size: 0.7rem;
    color: var(--map-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-sheet-toggle-btn {
    background: var(--map-surface-hover);
    border: 1px solid var(--map-border-active);
    color: var(--map-text-primary);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .sheet-chevron-icon {
    transition: transform 0.25s ease;
  }

  .map-sidebar.expanded .sheet-chevron-icon,
  .map-sidebar.sheet-expanded .sheet-chevron-icon {
    transform: rotate(180deg);
  }

  /* Pestañas táctiles en mobile */
  .map-sidebar-tabs {
    flex-shrink: 0;
    background: rgba(11, 13, 19, 0.95);
  }

  .map-tab-btn {
    padding: 10px 4px;
    font-size: 0.78rem;
    min-height: 44px;
  }

  .map-sidebar-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  /* Reorganización de Controles Flotantes para Pantallas Táctiles */
  .map-floating-controls {
    bottom: 78px;
    right: 12px;
    left: auto;
    z-index: 50;
  }

  .map-control-btn {
    width: 40px;
    height: 40px;
  }

  .map-status-pill {
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    gap: 6px;
    max-width: calc(100% - 125px);
    z-index: 50;
  }

  .map-status-pill > span:first-child {
    display: none;
  }

  .map-cooldown-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-layer-selector {
    top: 8px;
    right: 8px;
    z-index: 50;
    padding: 3px;
    gap: 3px;
  }

  .map-layer-btn {
    font-size: 0.72rem;
    padding: 4px 8px;
  }

  /* Botón de acción táctil amplio para el pulgar */
  .map-btn-action {
    min-height: 48px;
    font-size: 0.96rem;
  }
}

/* Teléfonos y Pantallas Reducidas */
@media (max-width: 640px) {
  .map-header {
    height: 46px;
    padding: 0 8px;
  }

  .map-brand-wrap {
    gap: 4px;
  }

  .map-brand {
    font-size: 0.9rem;
  }

  .map-badge-game {
    display: none;
  }

  .map-header-nav {
    gap: 2px;
  }

  .map-nav-link {
    padding: 5px 6px;
    min-width: 32px;
    min-height: 32px;
    justify-content: center;
  }

  .map-nav-link span {
    display: none;
  }

  .map-user-pill {
    padding: 2px 6px;
  }

  .map-user-name,
  .map-user-school {
    max-width: 65px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-btn-login {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  .map-btn-login span {
    display: none;
  }

  .map-ticker-wrap {
    height: 28px;
    font-size: 0.72rem;
    padding: 0 10px;
  }

  .map-ticker-label {
    font-size: 0.68rem;
    padding-right: 8px;
  }

  .map-ticker-content {
    padding-left: 8px;
  }

  .map-layer-btn .layer-name {
    display: none;
  }

  .map-layer-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    font-size: 0.95rem;
  }
}

/* Teléfonos muy pequeños (ej: iPhone SE 375px) */
@media (max-width: 400px) {
  .map-layer-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .map-status-pill {
    max-width: calc(100% - 110px);
  }

  .map-cooldown-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
  }
}

/* --------------------------------------------------------------------------
   CAJA DE COLEGIO BENEFICIARIO EN INSPECTOR
   -------------------------------------------------------------------------- */
.map-target-school-box {
  background: rgba(18, 22, 34, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.map-target-school-box:hover {
  border-color: rgba(56, 189, 248, 0.5);
}

.map-target-school-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-target-school-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--map-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-btn-change-school {
  background: transparent;
  border: none;
  color: var(--map-accent);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.map-btn-change-school:hover {
  background: rgba(6, 182, 212, 0.15);
  color: #fff;
}

.map-target-school-selected {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-target-school-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: #1c2233;
  border: 2px solid var(--school-border-color, #38bdf8);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.map-target-school-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.map-target-school-info strong {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-target-school-info span {
  font-size: 0.72rem;
  color: var(--map-text-muted);
}

/* --------------------------------------------------------------------------
   MODAL DE SELECCIÓN DE COLEGIO BENEFICIARIO
   -------------------------------------------------------------------------- */
.map-modal-colegio-card {
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-modal-subtitle {
  font-size: 0.78rem;
  color: var(--map-text-secondary);
}

.map-colegio-search-wrap {
  position: relative;
  width: 100%;
}

.map-colegio-search {
  width: 100%;
  background: rgba(11, 13, 19, 0.9);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.86rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.map-colegio-search:focus {
  border-color: var(--map-accent);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.map-colegios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--map-border) transparent;
}

.map-colegio-item {
  background: rgba(22, 27, 41, 0.6);
  border: 1px solid var(--map-border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  min-height: 80px;
  justify-content: center;
  user-select: none;
}

.map-colegio-item:hover {
  transform: translateY(-2px);
  background: rgba(30, 38, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.3);
}

.map-colegio-item.selected {
  border-color: var(--item-school-color, var(--map-accent));
  background: rgba(var(--item-school-rgb, 6, 182, 212), 0.16);
  box-shadow: 0 0 12px var(--item-school-color, rgba(6, 182, 212, 0.4));
}

.map-colegio-item-badge {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.map-colegio-item-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.map-colegio-item-tag {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  background: var(--map-accent);
  color: #0b0d13;
  padding: 1px 4px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.map-modal-colegio-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.map-btn-secondary {
  background: transparent;
  border: 1px solid var(--map-border);
  color: var(--map-text-secondary);
  font-size: 0.84rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-btn-secondary:hover {
  border-color: var(--map-text-primary);
  color: #fff;
}

@media (max-width: 480px) {
  .map-colegios-grid {
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    max-height: 280px;
  }
}

