/* Dra. Rúbia — estilo infantil / pediátrico */

:root {
  --azul: #5fc9f3;
  --azul-escuro: #2f9bd6;
  --rosa: #ff9ecf;
  --amarelo: #ffd166;
  --verde: #8de3a3;
  --roxo: #b39ddb;
  --texto: #37474f;
  --fundo1: #fff6e9;
  --fundo2: #d8f3ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Comic Sans MS", "Comic Sans", "Segoe Print", sans-serif;
  color: var(--texto);
  background: linear-gradient(135deg, var(--fundo1), var(--fundo2));
  background-attachment: fixed;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.topo {
  text-align: center;
  margin-bottom: 28px;
}

.topo h1 {
  font-size: 2.4rem;
  margin: 0;
  color: var(--azul-escuro);
  text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(0,0,0,0.05);
}

.topo .emoji {
  font-size: 2.4rem;
  margin: 0 6px;
}

.topo p {
  margin: 6px 0 0;
  color: #78909c;
  font-size: 0.95rem;
}

.login-caixa {
  background: #fffdf8;
  border-radius: 24px;
  padding: 28px 32px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  width: min(360px, 90vw);
  border: 4px solid var(--azul);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: bold;
  color: var(--texto);
  font-size: 0.95rem;
}

.login-form input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--azul);
  font-family: inherit;
  font-size: 1rem;
}

.login-form .btn {
  margin-top: 6px;
  align-self: center;
  padding: 10px 28px;
  font-size: 1rem;
}

.login-erro {
  color: #ef5350;
  font-size: 0.85rem;
  min-height: 1em;
  text-align: center;
}

.botoes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(8px, 3vw, 20px);
  max-width: 720px;
}

.botao-principal {
  width: clamp(56px, 17.5vw, 100px);
  height: clamp(56px, 17.5vw, 100px);
  border: none;
  border-radius: 28px;
  font-family: inherit;
  font-size: clamp(0.58rem, 2.94vw, 1.05rem);
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 1.5vw, 8px);
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 8px 16px rgba(0,0,0,0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.botao-principal .icone {
  font-size: clamp(1.1rem, 6.2vw, 2.2rem);
  flex-shrink: 0;
}

.botao-principal .rotulo {
  display: block;
  width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.botao-principal:hover {
  transform: translateY(-3px);
}

.botao-principal:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.15);
}

.botao-principal.c1 { background: var(--azul); }
.botao-principal.c2 { background: var(--rosa); }
.botao-principal.c3 { background: var(--verde); }
.botao-principal.c4 { background: var(--amarelo); color: #6b4c00; }
.botao-principal.c5 { background: var(--roxo); }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--azul-escuro);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: bold;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Janelas (modais arrastáveis) ---------- */

.janela-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 500;
}

.janela-overlay.aberta { display: block; }

.janela {
  position: absolute;
  width: min(560px, 92vw);
  max-height: 82vh;
  background: #fffdf8;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 4px solid var(--azul);
}

.janela-cabecalho {
  background: var(--azul);
  color: #fff;
  padding: 12px 16px;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

#janela-tuss { border-color: var(--amarelo); }
#janela-tuss .janela-cabecalho { background: var(--amarelo); color: #6b4c00; }

#janela-medicin { border-color: var(--roxo); }
#janela-medicin .janela-cabecalho { background: var(--roxo); color: #fff; }

.janela-cabecalho .fechar-x {
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 50%;
}
.janela-cabecalho .fechar-x:hover { background: rgba(255,255,255,0.25); }

.janela-corpo {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.janela-nota {
  background: #fff3d6;
  border: 1px dashed var(--amarelo);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.janela-rodape {
  padding: 10px 16px;
  border-top: 2px solid #eee;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.btn {
  font-family: inherit;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: bold;
  cursor: pointer;
  color: #fff;
  background: var(--azul-escuro);
}
.btn:hover { filter: brightness(1.08); }
.btn.secundario { background: #b0bec5; }
.btn.perigo { background: #ef5350; }

/* linhas da lista TUSS */
.linha-tuss {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid #f0f0f0;
}
.linha-tuss:hover { background: #f4fbff; }
.codigo-tuss {
  flex-shrink: 0;
  font-weight: bold;
  color: #fff;
  background: var(--verde);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.codigo-tuss:hover { filter: brightness(1.1); }
.texto-tuss {
  cursor: pointer;
  font-size: 0.92rem;
}
.texto-tuss:hover { text-decoration: underline; }

/* calculadora medicin */
.calc-caixa {
  background: #eef8ff;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.calc-caixa label {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  gap: 4px;
}
.calc-caixa input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--azul);
  font-family: inherit;
  font-size: 0.95rem;
}

.med-item {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.med-item .nome {
  font-weight: bold;
  color: var(--azul-escuro);
}
.med-item pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
  margin: 4px 0;
  color: #607d8b;
}
.med-item .dose-calculada {
  color: #d32f2f;
  font-weight: bold;
  margin-top: 4px;
}

.editar-textarea {
  width: 100%;
  min-height: 300px;
  font-family: "Consolas", monospace;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--azul);
  resize: vertical;
}
