@import url("./tokens.css");

[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

/* ── LOGIN ── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand h1 {
  margin: 0 0 0.3rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-grid { display: grid; gap: 1rem; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.form-group input:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  font-family: inherit;
}

.btn-primary   { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--text); background: var(--surface-hover); }
.btn-ghost     { background: none; color: var(--text-muted); border: none; padding: 0.4rem 0.75rem; }
.btn-ghost:hover { color: var(--text); }
.btn-full      { width: 100%; }
.btn-sm        { padding: 0.45rem 0.875rem; font-size: 0.85rem; }

.error-msg { margin: 0; font-size: 0.875rem; color: #f87171; }

.login-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.login-hint code {
  color: var(--text);
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
}

/* ── APP SHELL ── */
.familia-app {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.familia-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.familia-header-left {}
.familia-brand   { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; line-height: 1.2; }
.familia-utente  { font-size: 0.8rem; color: var(--accent); font-weight: 600; margin-top: 0.1rem; }
.familia-greeting { font-size: 0.8rem; color: var(--text-muted); }

.familia-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

/* ── SECTIONS ── */
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.familia-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── ESTADO GERAL ── */
.estado-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius);
  transition: border-left-color 0.2s;
}

.estado-bom     { border-left-color: #22c55e; }
.estado-estavel { border-left-color: var(--accent); }
.estado-agitado { border-left-color: #f97316; }
.estado-triste  { border-left-color: #a78bfa; }
.estado-ansioso { border-left-color: #facc15; }

.estado-emoji  { font-size: 2.75rem; line-height: 1; flex-shrink: 0; }
.estado-label  { font-weight: 700; font-size: 1.05rem; }
.estado-meta   { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── ÚLTIMOS CUIDADOS ── */
.cuidados-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cuidado-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.cuidado-item:last-child { border-bottom: none; }
.cuidado-icon  { font-size: 1.1rem; flex-shrink: 0; }
.cuidado-label { flex: 1; font-size: 0.9rem; font-weight: 500; }
.cuidado-val   { font-size: 0.85rem; font-weight: 600; }
.val-ok  { color: #4ade80; }
.val-no  { color: var(--text-muted); }
.val-warn { color: #fbbf24; }

.section-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  text-align: right;
}

/* ── TABS ── */
.tab-bar {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem;
  gap: 0.2rem;
  margin-bottom: 0.875rem;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  font: 600 0.875rem var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-btn.active {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── RELATÓRIO DIÁRIO ── */
.rel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}

.rel-data { font-weight: 700; font-size: 0.95rem; }
.rel-aux  { font-size: 0.8rem; color: var(--text-muted); }

.rel-obs {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
}

.rel-obs-admin { border-color: rgba(59,130,246,0.3); }

.obs-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.rel-obs p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
}

/* ── RELATÓRIO SEMANAL ── */
.semanal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.semanal-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem 0.75rem;
  text-align: center;
}

.semanal-stat strong {
  display: block;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.semanal-stat span { font-size: 0.75rem; color: var(--text-muted); }

.semanal-days {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.semanal-day {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.semanal-day:last-child { border-bottom: none; }
.day-date  { width: 75px; color: var(--text-muted); flex-shrink: 0; }
.day-humor { flex: 1; font-weight: 500; }
.day-alert { color: #fbbf24; flex-shrink: 0; }

/* ── OCORRÊNCIAS ── */
.ocorrencias-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ocorrencia-item {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.ocorrencia-item:last-child { border-bottom: none; }

.oc-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.oc-data { font-weight: 600; font-size: 0.875rem; }
.oc-aux  { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }
.oc-desc { margin: 0; font-size: 0.875rem; color: var(--text-muted); line-height: 1.55; }

/* ── MENSAGENS ── */
.msgs-list { display: flex; flex-direction: column; gap: 0.5rem; }

.msg-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.msg-urgente {
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.04);
}

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.msg-origem { font-weight: 600; font-size: 0.85rem; }
.msg-data   { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.msg-texto  { margin: 0; font-size: 0.9rem; color: var(--text); line-height: 1.65; }

/* ── HISTÓRICO ── */
.historico-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.hist-row:last-child { border-bottom: none; }

.hist-data  { width: 75px; color: var(--text-muted); flex-shrink: 0; font-size: 0.8rem; }
.hist-humor { flex: 1; font-weight: 500; }
.hist-oc    { color: #fbbf24; flex-shrink: 0; font-size: 0.9rem; }
.hist-aux   { font-size: 0.78rem; color: var(--text-muted); flex-shrink: 0; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── BADGE NOVO ── */
.badge-novo {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: middle;
}
