/* ============================================================
   bymob-live — estilos ultraleves
   Layout: mapa 100dvh, sem scroll; overlays flutuantes.
   ============================================================ */

:root {
  --bg: #0b1220;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --brand: #0066ff;
  --brand-dark: #0052cc;
  --danger: #ef4444;
  --live: #10b981;
  --warn: #f59e0b;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Mapa ---------- */

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.7) !important;
}

.maplibregl-ctrl-bottom-right {
  margin-bottom: calc(8px + var(--safe-bottom));
  margin-right: calc(8px + var(--safe-right));
}

/* ---------- Overlay de loading ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(11, 18, 32, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.overlay[hidden] {
  display: none !important;
}

.overlay-text {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Status chip ---------- */

.status-chip {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
  user-select: none;
}

.status-chip[hidden] {
  display: none !important;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-chip.is-live .status-dot {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: pulse 1.8s ease-out infinite;
}

.status-chip.is-connecting .status-dot,
.status-chip.is-reconnecting .status-dot {
  background: var(--warn);
}

.status-chip.is-error .status-dot {
  background: var(--danger);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ---------- FAB recentrar ---------- */

.fab {
  position: absolute;
  right: calc(14px + var(--safe-right));
  bottom: calc(24px + var(--safe-bottom));
  z-index: 15;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.fab:active {
  transform: scale(0.94);
}

.fab[hidden] {
  display: none !important;
}

/* ---------- Modal de erro ---------- */

.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
  background: rgba(11, 18, 32, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px 24px;
  text-align: center;
  animation: card-in 0.28s ease-out;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #fee2e2;
  color: var(--danger);
  font-size: 28px;
  font-weight: 700;
  line-height: 56px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.modal-message {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-primary[hidden] {
  display: none !important;
}

/* ---------- Info window (membro selecionado) ---------- */

.info-window {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(80px + var(--safe-bottom));
  z-index: 16;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.info-window[hidden] {
  display: none !important;
}

.info-window-card {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
  border-left: 4px solid var(--brand);
  animation: card-in 0.22s ease-out;
}

.info-window-body {
  flex: 1;
  min-width: 0;
}

.info-window-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-window-meta {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.54);
  line-height: 1.35;
}

.info-window-meta + .info-window-meta {
  margin-top: 4px;
}

.info-window-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: -4px -6px 0 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-window-close:hover {
  background: rgba(15, 23, 42, 0.06);
}

/* ---------- Marcadores HTML (navegação) ---------- */

.nav-marker {
  width: 40px;
  height: 40px;
  transform-origin: center center;
  will-change: transform;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.nav-marker svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* MapLibre Marker wrapper */
.maplibregl-marker {
  z-index: 2;
}
