/* ============================================================
   JANELA — a caixinha de diálogo própria do site.
   Substitui o alert / confirm / prompt do navegador.
   Serve tanto para a home (tema claro ou escuro) quanto para o
   painel (que é sempre claro, e por isso usa .painel).
   ============================================================ */

.janela-fundo {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 14, 28, .55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .16s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.janela-fundo.aparece { opacity: 1; }

/* O display:grid acima pesa mais que o [hidden] do navegador. Sem esta linha
   a janela some da vista mas continua por cima, engolindo todos os cliques. */
.janela-fundo[hidden] { display: none; }

.janela {
  width: 100%;
  max-width: 430px;
  background: #fff;
  color: #1a2233;
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: 0 24px 64px rgba(8, 13, 30, .35);
  transform: translateY(8px) scale(.98);
  transition: transform .16s ease;
}
.janela-fundo.aparece .janela { transform: none; }

.janela-icone {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #eef3ff;
  margin-bottom: 14px;
}
.janela-icone svg { width: 24px; height: 24px; fill: #1d4ed8; }
.janela-icone.perigo { background: #fdecec; }
.janela-icone.perigo svg { fill: #b02a37; }

.janela h2 {
  margin: 0 0 6px;
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.3;
}
.janela p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: #5b6579;
  overflow-wrap: anywhere;
}

.janela-campo { margin-top: 18px; }
.janela-campo label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #39435c;
  margin-bottom: 6px;
}
.janela-campo input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dfe3ee;
  border-radius: 10px;
  font: 16px inherit;
  color: #1a2233;
  background: #fff;
}
.janela-campo input:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .16);
}

.janela-erro {
  margin-top: 10px;
  font-size: 13px;
  color: #b02a37;
}
.janela-erro[hidden] { display: none; }

.janela-botoes {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
.janela-botoes button {
  padding: 11px 20px;
  border: 0;
  border-radius: 10px;
  font: 600 14.5px inherit;
  cursor: pointer;
  transition: filter .14s, background .14s;
}
.janela-cancelar {
  background: #f1f3f8;
  color: #4a5568;
}
.janela-cancelar:hover { background: #e6e9f2; }
.janela-ok {
  background: #1d4ed8;
  color: #fff;
}
.janela-ok:hover { filter: brightness(1.08); }
.janela-ok.perigo { background: #b02a37; }

/* ---------- Bolinha girando (usada também fora da janela) ---------- */
.girinho {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -3px;
  animation: girar .7s linear infinite;
}
.girinho.grande { width: 26px; height: 26px; border-width: 3px; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Tema escuro (a home segue o Windows; o painel não) ---------- */
@media (prefers-color-scheme: dark) {
  body:not(.painel) .janela {
    background: #1a1f2e;
    color: #e8eaed;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
  }
  body:not(.painel) .janela p { color: #9aa0a6; }
  body:not(.painel) .janela-icone { background: #21283c; }
  body:not(.painel) .janela-icone svg { fill: #8ab4f8; }
  body:not(.painel) .janela-icone.perigo { background: #3a1c1f; }
  body:not(.painel) .janela-icone.perigo svg { fill: #f28b82; }
  body:not(.painel) .janela-campo label { color: #c3c9d6; }
  body:not(.painel) .janela-campo input {
    background: #232838; border-color: #39405a; color: #e8eaed;
  }
  body:not(.painel) .janela-campo input:focus {
    border-color: #6f9bff; box-shadow: 0 0 0 3px rgba(111, 155, 255, .22);
  }
  body:not(.painel) .janela-cancelar { background: #2a3044; color: #c3c9d6; }
  body:not(.painel) .janela-cancelar:hover { background: #333a53; }
  body:not(.painel) .janela-ok { background: #2f62e0; }
  body:not(.painel) .janela-erro { color: #f28b82; }
}

@media (prefers-reduced-motion: reduce) {
  .janela-fundo, .janela { transition: none; }
  .girinho { animation-duration: 1.4s; }
}
