/* ==========================================================================
   Rosainer Simas | Design System Unificado: Portal da Família & Painel Admin
   Paleta Oficial da Logo: Obsidiana Profundo, Dourado 24k, Marfim & 6 Cores Puzzle
   ========================================================================== */

:root {
  --cream: #F6F3EB;
  --cream-hi: #FCFBF8;
  --cream-lo: #E8E1D1;
  --plum: #111520;
  --plum-soft: #1B2133;
  --ink: #161A26;
  --ink-soft: #52586B;
  --gold: #E5B94E;
  --gold-edge: #B38520;
  --blue: #368CE7;
  --blue-edge: #1E63B3;
  --green: #3EAD54;
  --green-edge: #267B38;
  --pink: #EC4E67;
  --orange: #F28C28;
  --purple: #8F5AE3;
  --cyan: #3CB4D9;
  --danger: #C93B4B;

  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.58;
  color: var(--ink);
  background:
    radial-gradient(80% 60% at 75% 20%, var(--cream-hi) 0%, rgba(252, 251, 248, 0) 65%),
    var(--cream);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ---------- Botões Táteis ---------- */
.btn {
  --bg: var(--ink);
  --fg: #fff;
  --edge: #080A10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.82em 1.4em;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  color: var(--fg);
  background: var(--bg);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--edge), 0 10px 20px rgba(17, 21, 32, 0.14);
  cursor: pointer;
  transition: transform 180ms var(--ease-spring), box-shadow 180ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--edge), 0 14px 24px rgba(17, 21, 32, 0.18); }
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { opacity: 0.6; pointer-events: none; }

.btn--green { --bg: var(--green); --edge: var(--green-edge); }
.btn--blue { --bg: var(--blue); --edge: var(--blue-edge); }
.btn--gold { --bg: var(--gold); --fg: #14120B; --edge: var(--gold-edge); }
.btn--purple { --bg: var(--purple); --edge: #6335B2; }
.btn--soft { --bg: #fff; --fg: var(--ink); --edge: #D7CEBC; }
.btn--cream { --bg: var(--cream); --fg: var(--ink); --edge: #D4CBB8; box-shadow: 0 3px 0 var(--edge); }
.btn--danger { --bg: #FCE8EB; --fg: #9E2031; --edge: #E5B6BD; box-shadow: 0 3px 0 var(--edge); }
.btn--sm { padding: 0.54em 1.02em; font-size: 0.83rem; box-shadow: 0 3px 0 var(--edge); }
.btn--full { width: 100%; }

/* ---------- Campos de Formulário ---------- */
.field { display: grid; gap: 6px; margin-bottom: 15px; }
.field label { font-size: 0.86rem; font-weight: 800; color: var(--ink); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.78em 1em;
  font: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--cream-hi);
  border: 2px solid #E1D9C8;
  border-radius: 16px;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--blue);
}
.field textarea { resize: vertical; min-height: 105px; }
.field small { font-size: 0.79rem; color: var(--ink-soft); font-weight: 600; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* ---------- Tela de Login (Portal & Admin) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px clamp(16px, 4vw, 48px);
}

.auth-shell {
  width: 100%;
  max-width: 1040px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  background: #fff;
  border-radius: 36px;
  box-shadow: 0 10px 0 #DDD4C1, 0 28px 60px rgba(17, 21, 32, 0.16);
  overflow: hidden;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 4vw, 44px);
  color: var(--cream-hi);
  background:
    radial-gradient(70% 65% at 50% 38%, rgba(229, 185, 78, 0.18) 0%, rgba(17, 21, 32, 0) 70%),
    linear-gradient(165deg, #171D2C 0%, #0D1018 100%);
  border-right: 1px solid rgba(229, 185, 78, 0.22);
}

.auth-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  color: #F4D57E;
  background: rgba(229, 185, 78, 0.12);
  border: 1px solid rgba(229, 185, 78, 0.3);
  border-radius: 999px;
}
.auth-back:hover { background: rgba(229, 185, 78, 0.22); }

.auth-hero__art {
  margin: 18px auto;
  max-width: 280px;
}
.auth-hero__art img {
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 28px rgba(229, 185, 78, 0.16));
}

.auth-hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 72;
  font-weight: 820;
  font-size: clamp(1.75rem, 2.8vw, 2.35rem);
  line-height: 1.1;
  color: #FAF7F0;
}

.auth-hero p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(250, 247, 240, 0.8);
}

.auth-form-pane {
  padding: clamp(28px, 4.5vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.auth-brand img { width: 42px; }
.auth-brand strong { display: block; font-family: var(--font-display); font-size: 1.18rem; }
.auth-brand span { font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }

.auth-form-pane h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.55rem;
}
.auth-form-pane > p {
  margin: 0 0 22px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.demo-box {
  margin-top: 20px;
  padding: 15px 18px;
  background: var(--cream);
  border-radius: 20px;
}
.demo-box__title {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
}
.demo-box__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Destaque claro para acesso profissional da psicóloga na tela dos pais */
.prof-switch-card {
  margin-top: 16px;
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #131826;
  color: #FAF7F0;
  border: 1px solid rgba(229, 185, 78, 0.42);
  border-radius: 20px;
}
.prof-switch-card strong {
  display: block;
  font-size: 0.88rem;
  color: #F4D57E;
}
.prof-switch-card span {
  display: block;
  font-size: 0.78rem;
  color: rgba(250, 247, 240, 0.76);
  font-weight: 600;
}

.alert {
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 16px;
}
.alert--error { background: #FCE8EB; color: #9E2031; }
.alert--ok { background: #E1F6E6; color: #1D632D; }

/* ---------- Topbar Autenticada ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(246, 243, 235, 0.92);
  border-bottom: 1px solid rgba(22, 26, 38, 0.08);
  backdrop-filter: blur(12px);
}

.app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.app-topbar__brand img { width: 40px; }
.app-topbar__brand strong { display: block; font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; }
.app-topbar__brand span { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }

.app-topbar__right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.app-shell {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 48px) 80px;
}

/* ---------- Guia Rápido da Psicóloga no /admin ---------- */
.guide-banner-admin {
  padding: 20px 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #131826 0%, #1C2338 100%);
  color: #FAF7F0;
  border: 1px solid rgba(229, 185, 78, 0.35);
  border-radius: 26px;
  box-shadow: 0 12px 28px rgba(17, 21, 32, 0.14);
}
.guide-banner-admin__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.guide-banner-admin__head strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  color: #F4D57E;
}
.guide-steps-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.guide-step-item {
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.45;
}
.guide-step-item b {
  display: block;
  color: #F4D57E;
  margin-bottom: 3px;
  font-size: 0.88rem;
}

/* ---------- Hero Card Interno da Família ---------- */
.family-banner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  align-items: center;
  gap: 24px;
  padding: clamp(22px, 3.5vw, 34px);
  margin-bottom: 24px;
  color: var(--cream-hi);
  background:
    radial-gradient(70% 90% at 90% 20%, rgba(229, 185, 78, 0.22) 0%, rgba(17, 21, 32, 0) 65%),
    linear-gradient(155deg, #161C2B 0%, #0E121C 100%);
  border: 1px solid rgba(229, 185, 78, 0.28);
  border-radius: 30px;
  box-shadow: 0 8px 0 #080A10, 0 20px 40px rgba(17, 21, 32, 0.18);
}

.family-banner__child {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.child-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  background: var(--blue);
  border-radius: 18px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22);
  flex: none;
}

.family-banner h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.12;
}
.family-banner__sub {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #F4D57E;
}

.family-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.meta-pill {
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
}
.meta-pill strong { color: #F4D57E; }

.family-banner__actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

/* ---------- Abas (Tabs) ---------- */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(17, 21, 32, 0.06);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.62em 1.15em;
  font: inherit;
  font-size: 0.89rem;
  font-weight: 800;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, transform 160ms var(--ease-spring);
}
.tab-btn.is-active {
  color: #fff;
  background: var(--plum);
  box-shadow: 0 3px 0 #07090E;
}
.tab-badge {
  padding: 1px 8px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #14120B;
  background: var(--gold);
  border-radius: 999px;
}

/* ---------- Cards, KPIs e Listas ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.kpi-card {
  padding: 20px 22px;
  background: #fff;
  border-top: 6px solid var(--kpi-c, var(--blue));
  border-radius: 24px;
  box-shadow: 0 5px 0 #E0D8C7, 0 12px 24px rgba(17, 21, 32, 0.06);
}
.kpi-card span { display: block; font-size: 0.82rem; font-weight: 800; color: var(--ink-soft); }
.kpi-card strong { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; }

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: start;
  gap: 22px;
}

.clay-panel {
  padding: clamp(22px, 3vw, 32px);
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 6px 0 #E0D8C7, 0 16px 32px rgba(17, 21, 32, 0.07);
}

.clay-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.clay-panel__head h2,
.clay-panel__head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.42rem;
}

.entry-list { display: grid; gap: 16px; }

.entry-card {
  padding: 22px 24px;
  background: var(--cream-hi);
  border-left: 6px solid var(--entry-c, var(--blue));
  border-radius: 22px;
}

.entry-card__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 11px;
  font-size: 0.76rem;
  font-weight: 800;
  border-radius: 999px;
  background: #E3EEFF;
  color: #19539E;
}
.badge--gold { background: #FFF3CF; color: #7A5400; }
.badge--green { background: #E1F6E6; color: #1D632D; }
.badge--pink { background: #FCE4EF; color: #992356; }
.badge--purple { background: #EFE6FF; color: #582AA8; }

.entry-date { font-size: 0.79rem; font-weight: 700; color: var(--ink-soft); }

.entry-card h3,
.entry-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.22;
}
.entry-card p {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: pre-line;
}

/* ---------- Galeria Inline de Fotos & Player de Vídeo ---------- */
.entry-media-box {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.entry-photo {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 18px;
  border: 2px solid #E6DFCF;
  cursor: zoom-in;
  background: #fff;
  transition: transform 200ms var(--ease-out);
}
.entry-photo:hover {
  transform: scale(1.01);
}
.entry-video {
  width: 100%;
  max-height: 440px;
  border-radius: 18px;
  background: #0D1018;
  border: 2px solid #22293D;
}

.entry-attach {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  font-size: 0.85rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--blue-edge);
  background: #E7F1FF;
  border-radius: 999px;
  width: fit-content;
}
.entry-attach:hover { background: #D3E6FF; }
.entry-attach--gold {
  color: #6B4A00;
  background: #FFF1C7;
}
.entry-attach--gold:hover { background: #FFE69E; }

.reply-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #FFF8E3;
  border-left: 4px solid var(--gold);
  border-radius: 16px;
}
.reply-box strong { display: block; font-size: 0.82rem; color: #7A5400; margin-bottom: 3px; }
.reply-box p { margin: 0; font-size: 0.92rem; color: var(--ink); }

.family-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: var(--cream-hi);
  border-radius: 22px;
  border: 1px solid #E4DDD0;
}

.family-row__info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.empty-state {
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--cream-hi);
  border: 2px dashed #DAD1BF;
  border-radius: 24px;
  font-weight: 700;
}

/* Toast Notification */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  padding: 14px 22px;
  font-weight: 800;
  color: #fff;
  background: var(--plum);
  border: 1px solid rgba(229, 185, 78, 0.4);
  border-radius: 999px;
  box-shadow: 0 6px 0 #07090E, 0 16px 32px rgba(0,0,0,0.28);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms var(--ease-spring), opacity 180ms ease;
}
.toast.is-visible { transform: translateY(0); opacity: 1; }

/* Modal Leitor no Portal / Lightbox / Convite no Admin */
.app-modal {
  width: min(720px, calc(100vw - 28px));
  max-height: 90vh;
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 65px rgba(10, 13, 22, 0.48);
}
.app-modal::backdrop { background: rgba(13, 16, 24, 0.65); backdrop-filter: blur(5px); }
.app-modal__body { padding: clamp(22px, 4vw, 38px); max-height: 90vh; overflow-y: auto; }

@media (max-width: 960px) {
  .auth-shell,
  .family-banner,
  .panel-grid,
  .guide-steps-mini {
    grid-template-columns: 1fr;
  }
  .family-banner__actions { justify-items: start; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: 1fr; }
  .tabs-bar { border-radius: 22px; }
}
