/* Venezuela Rescue Map - Stylesheet */

:root {
  --bg: #0a0e1a;
  --panel: #111827;
  --panel-light: #1a2234;
  --border: #1f2937;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --yellow: #ffcc00;
  --blue: #00247d;
  --red: #cf142b;
  --green: #16a34a;
  --orange: #f97316;
  --darkred: #7f1d1d;
  --lightblue: #3b82f6;
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

/* Header */
.header h1 { font-size: 16px; }
.stats-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.stat-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}
.stat-chip .count { font-weight: 700; }

/* Filter toggle */
.panel-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  margin-top: 4px;
  font-family: var(--font);
}
.panel-toggle:hover { color: var(--text); }

/* Filters */
.filters-wrapper {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.filters-wrapper.open { display: flex; }

.filter-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.filter-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.15s;
}
.filter-btn.active { opacity: 1; }
.filter-btn.inactive { opacity: 0.35; }
.filter-btn .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.filter-all {
  font-size: 10px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font);
}

/* Leaflet overrides for dark theme */
.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.leaflet-popup-content {
  margin: 12px 14px;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  min-width: 200px;
}
.leaflet-popup-tip {
  background: var(--panel);
  border: 1px solid var(--border);
}
.leaflet-popup-content .popup-category {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}
.leaflet-popup-content .popup-time {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}
.leaflet-popup-content .popup-name {
  font-weight: 600;
  margin-bottom: 2px;
}
.leaflet-popup-content .popup-notes {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.leaflet-popup-content .popup-confirm-count {
  font-size: 11px;
  color: var(--yellow);
  margin-bottom: 6px;
}
.leaflet-popup-content .popup-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.popup-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-light);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
}
.popup-btn:hover { background: var(--border); }
.popup-btn.confirm { border-color: var(--orange); }
.popup-btn.resolve { border-color: var(--green); }
.popup-btn.share { border-color: var(--lightblue); }

/* Marker pulse animation for urgent */
@keyframes marker-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.marker-urgent-icon {
  animation: marker-pulse 1.5s ease-in-out infinite;
}

/* Fade-in for new markers */
@keyframes fade-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}
.leaflet-marker-pane .leaflet-marker-icon {
  animation: fade-in 0.3s ease-out;
}

/* Resolved marker */
.marker-resolved {
  opacity: 0.35;
  filter: grayscale(0.7);
}

/* Earthquake panel */
.quake-panel {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 1001;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.quake-panel.open { right: 0; }
.quake-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.quake-panel-header h2 {
  font-size: 14px;
  font-weight: 600;
}
.quake-panel-header button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.quake-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.quake-item {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.quake-item:hover { background: var(--panel-light); }
.quake-item .mag {
  font-weight: 700;
  font-size: 16px;
}
.quake-item .mag.high { color: var(--red); }
.quake-item .mag.med { color: var(--orange); }
.quake-item .mag.low { color: var(--yellow); }
.quake-item .place { font-size: 12px; color: var(--muted); }
.quake-item .time { font-size: 11px; color: var(--muted); }
.quake-toggle {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 1000;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: none;
}
.quake-toggle.visible { display: block; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 {
  font-size: 18px;
  margin-bottom: 10px;
}
.modal p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.modal ul {
  list-style: none;
  margin-bottom: 14px;
}
.modal ul li {
  font-size: 13px;
  color: var(--muted);
  padding: 3px 0;
}

/* Category grid in form */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.cat-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--panel-light);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
}
.cat-option:hover { background: var(--border); }
.cat-option.selected { border-color: var(--yellow); }
.cat-option .icon { font-size: 18px; }

/* Form inputs */
#formName, #formNotes {
  width: 100%;
  background: var(--panel-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  margin-bottom: 8px;
}
#formName:focus, #formNotes:focus {
  outline: none;
  border-color: var(--yellow);
}
#formNotes { resize: vertical; }

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn-primary {
  background: var(--yellow);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font);
}
.btn-primary:active { transform: scale(0.96); }
.btn-cancel {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font);
}

/* SOS confirmation toast */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--green);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 3000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Leaflet map dark tiles fix */
.leaflet-container { background: #0a0e1a; }
.leaflet-control-attribution {
  background: rgba(10,14,26,0.7) !important;
  color: var(--muted) !important;
  font-size: 9px !important;
}
.leaflet-control-attribution a { color: var(--yellow) !important; }

/* Click hint */
.click-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10,14,26,0.9);
  border: 1px solid var(--yellow);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 500;
  pointer-events: none;
  animation: fade-in 0.3s;
}

/* Geolocation prompt */
.geo-prompt {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slide-up 0.3s ease;
  font-size: 13px;
  color: var(--text);
}
.geo-prompt-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Precise location row in form */
.precise-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.precise-label {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 180px;
}

/* Small buttons */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 999;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(12px);
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  padding: 4px 8px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.footer-quote {
  font-style: italic;
  color: var(--yellow);
  font-size: 10px;
  opacity: 0.85;
  line-height: 1.3;
}
.footer-info {
  font-size: 9px;
  opacity: 0.7;
}
.footer a { color: var(--yellow); pointer-events: auto; }

/* Slide up animation */
@keyframes slide-up {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Mobile responsive */
@media (max-width: 600px) {
  .header { padding: 6px 8px; }
  .header h1 { font-size: 14px; }
  .header .subtitle { font-size: 10px; }
  .stat-chip { font-size: 9px; }
  .fab { width: 48px; height: 48px; font-size: 20px; }
  .fab-add { bottom: 14px; left: 14px; }
  .fab-sos { bottom: 14px; right: 14px; }
  .quake-panel { width: 100vw; right: -100vw; }
  .quake-panel.open { right: 0; }
  .modal { padding: 16px; }
  .cat-grid { grid-template-columns: 1fr; }
  .leaflet-popup-content { min-width: 160px; font-size: 12px; }
}

/* Missing persons panel */
.missing-panel {
  position: fixed;
  top: 0;
  left: -400px;
  width: 380px;
  height: 100vh;
  background: var(--panel);
  z-index: 2000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}
.missing-panel.open { left: 0; }
.missing-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-light);
}
.missing-panel-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.missing-stats {
  display: flex;
  gap: 12px;
  padding: 8px 16px;
  background: var(--panel-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.missing-stat-missing { color: var(--orange); font-weight: 600; }
.missing-stat-found { color: var(--green); font-weight: 600; }
.missing-search {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.missing-search input {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.missing-search input:focus {
  border-color: var(--orange);
}
.missing-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.missing-card {
  background: var(--panel-light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.missing-card:hover { border-color: var(--orange); }
.missing-card.found { opacity: 0.6; }
.missing-card.found .missing-name { text-decoration: line-through; }
.missing-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.missing-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.missing-age {
  font-size: 12px;
  color: var(--muted);
}
.missing-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.missing-status.missing {
  background: rgba(249, 115, 22, 0.2);
  color: var(--orange);
}
.missing-status.found {
  background: rgba(22, 163, 74, 0.2);
  color: var(--green);
}
.missing-info {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0;
}
.missing-note {
  font-size: 12px;
  color: var(--text);
  opacity: 0.8;
  margin: 4px 0;
}
.missing-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.btn-found {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}
.btn-found:hover { filter: brightness(1.1); }
.btn-locate {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font);
}
.btn-locate:hover { border-color: var(--orange); }
.missing-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 13px;
}
.missing-toggle {
  position: fixed;
  left: 20px;
  top: 80px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--panel);
  color: var(--orange);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.missing-toggle:active { transform: scale(0.92); }
.missing-toggle-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}
/* Missing form inside modal */
.missing-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 8px;
  background: var(--panel-light);
  border-radius: 6px;
  cursor: pointer;
}
.missing-checkbox input { accent-color: var(--orange); }
.missing-checkbox label {
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.missing-form-fields {
  display: none;
  padding: 8px;
  background: var(--panel-light);
  border-radius: 6px;
  margin-top: 6px;
}
.missing-form-fields.show { display: block; }
.missing-form-fields input,
.missing-form-fields textarea {
  width: 100%;
  margin-bottom: 6px;
}
/* Toast for missing */
.toast.toast-missing { border-left: 3px solid var(--orange); }
/* Missing person marker on map */
.missing-marker {
  font-size: 22px;
  line-height: 28px;
  text-align: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
@media (max-width: 600px) {
  .missing-panel { width: 100vw; left: -100vw; }
  .missing-panel.open { left: 0; }
  .missing-toggle { top: 72px; left: 14px; }
}