:root {
  --bg: #050709;
  --bg-elevated: #101318;
  --accent: #ff4b5c;
  --accent-soft: rgba(255, 75, 92, 0.14);
  --accent-ok: #33c27f;
  --text: #f3f6f7;
  --text-muted: #9ca9b5;
  --border-subtle: #1c232b;
  --radius-lg: 18px;
  --shadow-soft: 0 12px 26px rgba(0,0,0,0.55);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

/* App bar */

.app-bar {
  position: absolute;
  top: env(safe-area-inset-top, 0);
  left: 0;
  right: 0;
  padding: 10px 16px 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.app-bar__title {
  font-weight: 700;
  font-size: 17px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
}

.app-bar__subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Map full-screen */

#map {
  flex: 1;
  height: 100%;
}

/* Floating buttons */

.fab {
  position: fixed;
  z-index: 20;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* FAB localizar */

.fab-locate {
  left: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0) + 80px);
  width: 48px;
  height: 48px;
}

.loc-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #555;
  position: relative;
}
.loc-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  border: 2px solid #000;
}
.loc-icon::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 5px; height: 5px;
  background: #000;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* FAB principal (hazard / reportar) */

/* .fab-hazard {
  bottom: calc(env(safe-area-inset-bottom, 0) + 78px);
  right: 50%;
  transform: translateX(50%);
  width: 66px;
  height: 66px;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  font-weight: 800;
} */

/* Snackbar */

#snackbar {
  visibility: hidden;
  min-width: 200px;
  background-color: #000;
  color: #fff;
  text-align: center;
  border-radius: 999px;
  padding: 10px 16px;
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0) + 150px);
  transform: translateX(-50%);
  z-index: 25;
  font-size: 13px;
}
#snackbar.show {
  visibility: visible;
  animation: fadein 0.2s, fadeout 0.2s 3s;
}
@keyframes fadein {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes fadeout {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 20px); }
}

/* Modal principal (reporte) */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 500px;
  background: var(--bg-elevated);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 30px rgba(0,0,0,0.5);
  padding: 14px 16px 18px;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal__header h2 {
  font-size: 17px;
  margin: 0;
}

.modal__close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
}

.modal__body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 2px;
}

.modal__hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.field {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field__label {
  font-size: 13px;
  color: var(--text-muted);
}

input[type="text"],
input[type="file"],
select,
textarea {
  border-radius: 13px;
  border: 1px solid var(--border-subtle);
  background: #070a0f;
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.btn-primary {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  background: linear-gradient(135deg, #ff4b5c, #ff9966);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.modal__disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
}

/* Popup de markers */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge.ICE { background:#ff4b5c; color:#2b0006;}
.badge.Checkpoint { background:#ffd166; color:#3a2500;}
.badge.Patrol { background:#6ecbff; color:#002638;}
.badge.Unmarked { background:#d7b3ff; color:#2d014a;}
.badge.Other { background:#b1f28d; color:#07230a;}

.popup-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.popup-footer-btns {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.popup-footer-btns button {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 6px 8px;
  font-size: 12px;
}
.popup-footer-btns .btn-confirm { background: var(--accent-ok); color:#021b0c; }
.popup-footer-btns .btn-flag { background:#333; color:#fff; }

/* Popup InfoWindow */

.gm-popup {
  background: #101418;
  color: #f5f5f5;
  padding: 8px 10px;
  border-radius: 12px;
  max-width: 240px;
  font-size: 13px;
}

.gm-popup-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.gm-popup-text {
  margin-top: 4px;
  line-height: 1.3;
}

.gm-popup img {
  width: 100%;
  border-radius: 10px;
  margin-top: 6px;
  display: block;
}

.gm-popup-meta {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.8;
}

/* badges por tipo */

.badge-tipo {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-ICE        { background:#ff5a5a; color:#2c0000; }
.badge-Checkpoint { background:#ffd166; color:#3a2500; }
.badge-Patrol     { background:#6ecbff; color:#002638; }
.badge-Unmarked   { background:#d7b3ff; color:#2d014a; }
.badge-Other      { background:#b1f28d; color:#052309; }

/* Leyenda del mapa */

/* Compact Legend */
.map-legend {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 60px);
  left: 10px;
  width: 210px;
  padding: 6px 8px 10px;

  background: rgba(5, 7, 9, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);

  z-index: 30;
  font-size: 11px;

  transform-origin: left top;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

/* Estado colapsado: se esconde hacia la izquierda y se cierra el body */
.map-legend--collapsed {
  transform: translateX(-72%);
  opacity: 0.9;
}

.map-legend__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #f5f5f5;
  padding: 4px 4px 2px;
  cursor: pointer;
  font-size: 11px;
}

.map-legend__toggle-icon {
  font-size: 12px;
  opacity: 0.9;
}

.map-legend__toggle-text {
  font-size: 11px;
  color: var(--text-muted);
}

.map-legend__body {
  margin-top: 4px;
  max-height: 500px;
  overflow: hidden;
  opacity: 1;
  transition:
    max-height 0.25s ease,
    opacity 0.25s ease,
    margin-top 0.25s ease;
}

.map-legend--collapsed .map-legend__body {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

/* Header */
.map-legend__header {
  margin-bottom: 4px;
}
.map-legend__title {
  font-size: 12px;
  font-weight: 600;
}
.map-legend__subtitle {
  font-size: 10px;
  opacity: 0.7;
}

/* Lista de tipos */
.map-legend__types {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.map-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Micro-pins */
.map-legend__dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.map-legend__dot::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 4px;
  height: 4px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 1px;
  background: inherit;
}

/* Colores */
.map-legend__dot--ice        { background: #ff4b5c; }
.map-legend__dot--checkpoint { background: #ffd166; }
.map-legend__dot--patrol     { background: #6ecbff; }
.map-legend__dot--unmarked   { background: #d7b3ff; }
.map-legend__dot--other      { background: #b1f28d; }

/* Filtros de tiempo */
.map-legend__filters {
  margin-bottom: 6px;
}
.map-legend__filters-label {
  font-size: 10px;
  opacity: 0.75;
  margin-bottom: 3px;
}
.map-legend__filters-buttons {
  display: flex;
  gap: 4px;
}

.legend-filter {
  flex: 1;
  padding: 3px 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  color: #f5f5f5;
  font-size: 10px;
  cursor: pointer;
}
.legend-filter--active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.map-legend__hint {
  font-size: 10px;
  opacity: 0.8;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .map-legend {
    left: 20px;
  }
}


/* Dot colors (match pins kindColor) */

.dot-ICE        { background:#ff4b5c; }
.dot-Checkpoint { background:#ffd166; }
.dot-Patrol     { background:#6ecbff; }
.dot-Unmarked   { background:#d7b3ff; }
.dot-Other      { background:#b1f28d; }

.map-legend__filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.map-legend__filters-label {
  font-size: 11px;
  color: var(--text-muted);
}

.map-legend__filters-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.legend-filter {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
}

.legend-filter--active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.legend-filter:active {
  transform: scale(0.96);
}

.map-legend__hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Bottom nav */

/* === iOS-style bottom bar === */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0) + 6px);
  width: calc(100% - 24px);
  max-width: 480px;
  padding: 6px 8px;
  background: rgba(5, 7, 9, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 18px 18px 26px 26px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  z-index: 40;
}

.bottom-nav__item {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 0;
  font-size: 11px;
  cursor: pointer;
  border-radius: 999px;
}

.bottom-nav__icon {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav__label {
  font-size: 11px;
}

/* Estado táctil */
.bottom-nav__item:active {
  transform: scale(0.96);
}

/* Botón central estilo “primary” (Reportar) */
.bottom-nav__item--primary {
  background: radial-gradient(circle at 50% 0, rgba(255,255,255,0.20), transparent 55%),
              linear-gradient(135deg, #ff4b5c, #ff9966);
  color: #fff;
  font-weight: 600;
  padding: 6px 0;
  box-shadow: 0 10px 26px rgba(0,0,0,0.65);
}

.bottom-nav__item--primary .bottom-nav__icon {
  font-size: 20px;
}

/* En pantallas grandes la barra queda centrada tipo dock */
@media (min-width: 768px) {
  .bottom-nav {
    bottom: 16px;
  }
}

/* Modal genérico card (help) */

.modal-card {
  background: #0f1419;
  color: #f5f5f5;
  padding: 16px;
  border-radius: 16px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 10px 35px rgba(0,0,0,0.6);
}

/* Versión especial para el help: estilo glass */

.modal-card.modal-help {
  background: rgba(5, 7, 9, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75);
  padding: 18px 18px 16px;
}

.modal-card.modal-help h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
}

.modal-card.modal-help ol {
  padding-left: 20px;
  margin: 8px 0 8px;
  font-size: 14px;
}

.modal-card.modal-help ul {
  padding-left: 18px;
  margin: 4px 0 4px;
  font-size: 13px;
}

.modal-card.modal-help li {
  margin-bottom: 4px;
}

.help-note {
  font-size: 12px;
  opacity: 0.8;
  margin: 8px 0 12px;
}

.modal-card.modal-help strong {
  color: #ffd166;
}

/* Responsivo escritorio */

@media (min-width: 768px) {
  .map-legend {
    max-width: 340px;
    left: 20px;
    top: calc(env(safe-area-inset-top, 0) + 70px);
  }

  .fab-locate {
    left: 24px;
  }

  .fab-hazard {
    right: 50%;
  }

  .bottom-nav {
    max-width: 480px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}


/* Botones para compartir reporte */
.popup-share {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-share button {
  flex: 1 1 45%;
  border-radius: 999px;
  border: none;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
}

.popup-share .btn-share-wa {
  background: #25d366;
  color: #02160b;
}

.popup-share .btn-share-sms {
  background: #444;
  color: #fff;
}

.popup-share .btn-share-fb {
  background: #1877f2;
  color: #fff;
}

.popup-share .btn-share-copy {
  background: #222;
  color: #f5f5f5;
}
