/* ============================================================
   GeoVoto — tema do APP do operador (v2 clean)
   ============================================================ */

:root {
  --tap: 44px;             /* altura mínima de toque */
  --pad: 16px;
}

body.app {
  font-family: var(--font-display);
  background: var(--bg-1);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- LOGIN ---------- */

.login-tela {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--pad);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 32px 32px;
  box-shadow: var(--shadow-md);
}

.login-marca {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.login-marca::before {
  content: 'G';
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.login-marca h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink-strong);
}
.login-marca p {
  font-size: 12px;
  color: var(--ink-2);
  margin: 0;
  font-weight: 500;
}
.login-marca .meta { display: flex; flex-direction: column; }

.login-titulo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--ink-strong);
}
.login-sub {
  font-size: 14px;
  color: var(--ink-2);
  margin: 0 0 24px;
}

.login-form { display: grid; gap: 14px; }

.campo label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.campo input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.campo input::placeholder { color: var(--ink-faint); }

.botao-principal {
  height: 42px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.botao-principal:hover:not(:disabled) { background: var(--accent-hover); }
.botao-principal:disabled { opacity: 0.5; cursor: not-allowed; }

.alerta {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  display: none;
}
.alerta.visivel { display: block; }
.alerta.erro {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.alerta.info {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent);
}

.login-rodape {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- MAPA + painel (canto inferior esquerdo, compacto) ---------- */

.mapa-tela {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.painel {
  position: absolute;
  bottom: 16px;
  left: 16px;
  max-width: 260px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-pop);
  z-index: 1000;
  font-size: 13px;
  transition: max-width .25s ease, padding .25s ease, max-height .25s ease, border-radius .25s ease;
  overflow: hidden;
  max-height: 600px;
}
@media (max-width: 480px) {
  .painel { right: 16px; max-width: none; }
}

/* Painel encolhido (bolinha verde com indicador) */
.painel.minimizado {
  max-width: 52px;
  min-width: 52px;
  max-height: 52px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
}
.painel.minimizado > * { display: none; }
.painel.minimizado::before {
  content: '';
  display: block;
  width: 52px; height: 52px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%230d9488" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg>') center / 24px no-repeat;
  border-radius: 50%;
}
/* Quando tracking ativo, bolinha pulsa em verde */
.painel.minimizado.tracking-on {
  border-color: var(--success);
  animation: pulso-minimizado 1.6s infinite;
}
@keyframes pulso-minimizado {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  70% { box-shadow: 0 0 0 14px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.painel-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.painel-nome {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.painel-sair {
  font-size: 11px;
  color: var(--ink-2);
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
}
.painel-sair:hover { color: var(--danger); }

.tracking-botao {
  display: block;
  width: 100%;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .15s;
}
.tracking-botao.off {
  background: var(--success);
  color: #fff;
}
.tracking-botao.off:hover { background: #daa520; }
.tracking-botao.on {
  background: var(--danger);
  color: #fff;
}
.tracking-botao.on:hover { background: #b91c1c; }

.status {
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.4;
  font-family: var(--font-mono);
}
.status strong { color: var(--ink); font-weight: 500; }
.status .indicador {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  margin-right: 5px;
  vertical-align: middle;
}
.status .indicador.ativo {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
  animation: pulso 2s infinite;
}
@keyframes pulso {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.dica-foto {
  margin: 8px 0 0;
  padding: 6px 8px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--accent-text);
  line-height: 1.4;
}
.dica-foto strong { color: var(--accent-text); font-weight: 600; }

.foto-local-botao {
  margin-top: 6px;
  width: 100%;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, color .15s;
}
.foto-local-botao:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
}
.foto-local-botao:disabled { opacity: 0.5; cursor: not-allowed; }
.foto-local-botao svg { width: 14px; height: 14px; }

.btn-flutuante {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: var(--shadow-md);
  color: var(--accent);
}
.btn-flutuante:hover { background: var(--bg-2); }
.btn-flutuante svg { width: 20px; height: 20px; }
/* Posicionado no canto INFERIOR direito pra não tampar o controle de camadas */
.btn-centralizar { bottom: 16px; right: 16px; }

/* Badge de status do Wake Lock (dentro do painel) */
.wake-badge {
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--ink-2);
  line-height: 1.4;
  min-height: 0;
}
.wake-badge.ativo { color: var(--success); }
.wake-badge.inativo { color: var(--warning); }
.wake-badge:empty { display: none; }

/* Banner "Instalar como app" */
.pwa-banner {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 70px;
  max-width: 480px;
  background: var(--ink-strong);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-pop);
  z-index: 1001;
}
/* Atributo hidden tem que vencer o display:flex acima */
.pwa-banner[hidden] { display: none !important; }
.pwa-banner-texto { flex: 1; }
.pwa-banner-texto strong { color: #fff; font-weight: 600; }
.pwa-banner-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.pwa-banner-btn:hover { background: var(--accent-hover); }
.pwa-banner-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.pwa-banner-close:hover { color: #fff; }
