/* RESET BÁSICO E VARIÁVEIS */
:root {
  --cor-bg: #f4f7fa;
  --cor-primary: #0066ff;
  --cor-primary-dark: #004bcc;
  --cor-accent: #ff4d4d;
  --cor-texto: #333;
  --cor-borda: #e0e6ef;
  --radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.1);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
  accent-color: var(--cor-primary);
}

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

body {
  background: var(--cor-bg);
  color: var(--cor-texto);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* BOTÃO ENTRAR */
#btn-entrar {
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  color: #fff;
  background: var(--cor-primary);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

#btn-entrar:hover {
  background: var(--cor-primary-dark);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* MODAL NOME */
#modal-nome,
#loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

#modal-nome .caixa,
#loading .caixa {
  background: #fff;
  padding: 30px 26px;
  border-radius: var(--radius);
  width: min(90%, 380px);
  text-align: center;
  box-shadow: var(--shadow);
}

#modal-nome h3 {
  margin-bottom: 18px;
  font-weight: 600;
}

#modal-nome input {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--cor-borda);
  border-radius: var(--radius);
  font-size: 1rem;
}

#modal-nome button {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--cor-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

#modal-nome button:hover {
  background: var(--cor-primary-dark);
}

/* LOADING */
.spinner {
  width: 46px;
  height: 46px;
  border: 6px solid var(--cor-primary);
  border-top-color: transparent;
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: gira 1s linear infinite;
}

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

/* CHAT BOX */
#chat-box {
  display: none;
  flex-direction: column;
  width: min(95%, 600px);
  height: 80vh;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#chat-header {
  background: var(--cor-primary);
  color: #fff;
  padding: 14px 20px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chat-mensagens {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  background: var(--cor-bg);
}

.msg {
  margin-bottom: 14px;
  line-height: 1.4;
}

.msg strong {
  color: var(--cor-primary-dark);
}

#chat-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--cor-borda);
  background: #fdfdfd;
}

#chat-form input[type="text"] {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--cor-borda);
  border-radius: var(--radius);
  font-size: 1rem;
}

#chat-form button {
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  background: var(--cor-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

#chat-form button:hover {
  background: var(--cor-primary-dark);
  transform: translateY(-1px);
}

/* RESPONSIVIDADE EXTRA */
@media (max-width: 480px) {
  #chat-box {
    height: 90vh;
  }
  #chat-header {
    font-size: 0.95rem;
  }
}
