/* =========================================
   ATRIA BASE — DESIGN SYSTEM
   =========================================
   Tokens de cor, tipografia e componentes base.
   Para personalizar um produto, altere apenas as variáveis
   da seção "Identidade do produto" no :root abaixo.
   ========================================= */

:root {
  /* ─── TODO: Identidade do produto ───────────────────────
     Troque estas 4 variáveis para mudar toda a paleta:       */
  --brand-darkest:  #3D6B58;   /* cor principal escura        */
  --brand-mid:      #5A8A76;   /* meio-tom                    */
  --brand:          #6B9E8A;   /* cor principal               */
  --brand-light:    #C8DDD7;   /* claro (sidebar, bg suave)   */
  --brand-pale:     #EAF2EF;   /* muito claro (hover, badge)  */
  /* ─────────────────────────────────────────────────────── */

  /* Superfícies */
  --bg:           #F7F4EF;
  --surface:      #FDFCFA;
  --surface-soft: #F7F4EF;
  --line:         #E8E3DB;

  /* Texto */
  --text:         #1E2A28;
  --text-soft:    #6B8178;
  --text-muted:   #9DB3AE;

  /* Semânticas de alerta */
  --amber:        #C08B3A;
  --rose:         #B85A5A;
  --danger:       var(--rose);
  --danger-light: #F7EAEA;

  /* Aliases semânticos (usados nos componentes — não altere) */
  --primary:        var(--brand-darkest);
  --primary-mid:    var(--brand);
  --primary-hover:  var(--brand-mid);
  --primary-light:  var(--brand-pale);
  --gold:           var(--amber);
  --gold-text:      #7B5A22;
  --gold-light:     #F8EBD4;
  --accent:         var(--brand-mid);
  --accent-light:   var(--brand-pale);
  --card:           var(--surface);
  --card-soft:      var(--surface);
  --card-glass:     rgba(253, 252, 250, 0.92);
  --card-subtle:    rgba(253, 252, 250, 0.84);
  --sidebar-bg:     var(--brand-light);
  --sidebar-text:   var(--text);
  --sidebar-muted:  var(--text-soft);
  --sidebar-active-text: var(--brand-darkest);
  --sidebar-danger-text: #8F4141;
  --muted:          var(--text-soft);
  --label-color:    var(--text-soft);
  --text-mid:       var(--text-soft);

  /* Sombras */
  --shadow-sm:  0 2px 8px rgba(30, 42, 40, 0.05);
  --shadow-md:  0 10px 28px rgba(30, 42, 40, 0.08);
  --shadow-lg:  0 18px 48px rgba(30, 42, 40, 0.11);
  --card-border: rgba(232, 227, 219, 0.95);
  --card-shadow: 0 18px 44px rgba(30, 42, 40, 0.09);
  --card-shadow-soft: 0 10px 28px rgba(30, 42, 40, 0.06);

  /* Bordas */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;

  /* Tipografia
     TODO: troque as fontes se o produto usar família diferente */
  --font-serif:  'Instrument Serif', Georgia, serif;
  --font-sans:   'Figtree', system-ui, sans-serif;
  --font-ui:     var(--font-sans);
  --font-brand:  var(--font-serif);
  --font-weight-body:    400;
  --font-weight-ui:      500;
  --font-weight-heading: 600;
  --font-weight-cta:     600;
}

/* ─── Reset base ──────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--font-weight-body);
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, select { font-family: inherit; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; letter-spacing: -0.04em; }
h2 { font-size: 19px; letter-spacing: -0.02em; }

/* ─── Utilitários globais ─────────────────────────────── */
.hidden   { display: none !important; }
.muted    { color: var(--muted); line-height: 1.55; }
.tiny     { color: var(--muted); font-size: 12px; line-height: 1.4; margin-bottom: 0; }
.eyebrow  { color: var(--primary); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }

/* ─── Formulário ──────────────────────────────────────── */
label {
  display: block;
  font-size: 13px;
  font-weight: var(--font-weight-ui);
  margin: 14px 0 6px;
  color: var(--label-color);
}
.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  outline: none;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(61, 107, 88, .10);
}
.textarea { min-height: 96px; resize: vertical; }

/* ─── Botões ──────────────────────────────────────────── */
.button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: var(--primary);
  color: white;
  font-weight: var(--font-weight-cta);
  cursor: pointer;
  font: inherit;
  transition: background .15s, opacity .15s;
}
.button:hover    { background: var(--primary-hover); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.full     { width: 100%; margin-top: 18px; }
.button.secondary { background: var(--brand-mid); }
.button.ghost    { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.button.danger   { background: var(--danger); }

/* ─── Tabs ────────────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #eef2f7;
  padding: 5px;
  border-radius: 14px;
  margin: 24px 0;
}
.tab {
  border: 0;
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: var(--font-weight-ui);
  background: transparent;
}
.tab.active {
  background: white;
  color: var(--text);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .06);
}

/* ─── Badge ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

/* ─── Tela de Auth ────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, var(--brand-light), transparent 35%), var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 430px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 28px;
  box-shadow: var(--shadow-md);
  padding: 32px;
}
.auth-brand { margin-bottom: 20px; }
.auth-brand img { height: 36px; }
.auth-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text);
}
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--brand-darkest) !important; }

/* ─── Layout principal (sidebar + main) ──────────────── */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 255px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .2);
}
#navItems { display: grid; gap: 8px; }
.nav-button {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 12px 14px;
  color: var(--sidebar-text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: var(--font-weight-ui);
}
.nav-button:hover,
.nav-button.active { background: rgba(255, 255, 255, .15); }
.sidebar-logout {
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 12px 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: var(--font-weight-ui);
  margin-top: auto;
  color: var(--sidebar-danger-text);
}
.main {
  margin-left: 255px;
  padding: 32px;
  width: calc(100% - 255px);
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

/* ─── Grid e Cards ────────────────────────────────────── */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two   { grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--card);
  border: 1px solid rgba(229, 231, 235, .75);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* ─── Lista ───────────────────────────────────────────── */
.list { display: grid; gap: 12px; }
.list-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #fff;
}
.list-item strong { display: block; margin-bottom: 5px; }
.list-item.alert  { border-color: #fecaca; background: #fff7f7; }

/* ─── Métrica ─────────────────────────────────────────── */
.metric span   { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.metric strong { font-size: 26px; letter-spacing: -0.03em; }

/* ─── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999;
  background: #111827;
  color: white;
  border-radius: 16px;
  padding: 13px 16px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: .25s ease;
  max-width: 360px;
  font-size: 14px;
}
.toast.show    { opacity: 1; transform: translateY(0); }
.toast.toast-erro { background: var(--danger); }

/* ─── Skeleton ────────────────────────────────────────── */
.skeleton-card  { border-radius: 18px; padding: 16px; background: #f3f4f6; }
.skeleton-line  { background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
                  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Responsividade mobile ───────────────────────────── */
@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  .main { margin-left: 0; width: 100%; padding: 18px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .header { align-items: flex-start; flex-direction: column; gap: 12px; }
}

/* ─── TODO: estilos específicos do produto ───────────────
   Adicione abaixo (ou em um arquivo separado) os estilos
   das telas e componentes do novo produto.
   ─────────────────────────────────────────────────────── */

/* =========================================
   FISIOTESTS — BRAND & COMPONENTES
   =========================================
   Sobrescreve tokens de cor e adiciona
   componentes específicos do produto.
   ========================================= */

:root {
  --brand-darkest:  #1A5E7A;
  --brand-mid:      #2A7D9F;
  --brand:          #3D9DC3;
  --brand-light:    #B8D9E8;
  --brand-pale:     #E8F4F9;
}

/* ── Auth logo ──────────────────────────── */
.auth-logo-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--brand-pale);
  color: var(--brand-darkest);
  font-size: 28px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.auth-logo-text {
  font-size: 22px; font-weight: 800;
  text-align: center; margin: 0 0 4px;
  color: var(--text);
}
.auth-logo-text span { color: var(--primary); }

/* ── Badges de confiabilidade ───────────── */
.badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  white-space: nowrap; line-height: 1.5;
}
.badge-gold   { background: var(--gold-light); color: var(--gold-text); }
.badge-silver { background: #EEECE8;           color: #5A6B65; }
.badge-bronze { background: #F5E8DA;           color: #8A5B32; }
.badge-positivo { background: var(--danger-light); color: var(--danger); }
.badge-negativo { background: var(--brand-pale);   color: var(--brand-darkest); }
.badge-anormal  { background: #FBF0D5;             color: #7B5A22; }

/* ── Region Cards ───────────────────────── */
.region-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px; text-align: left;
  cursor: pointer; width: 100%;
  transition: box-shadow 0.2s;
}
.region-card:hover { box-shadow: var(--shadow-sm); }
.region-letter {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--brand-pale); color: var(--brand-darkest);
  font-size: 15px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.region-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.region-sub   { font-size: 11px; color: var(--text-soft); line-height: 1.4; }
.region-count { font-size: 11px; color: var(--primary); font-weight: 600; margin-top: 8px; }

/* ── Test Cards ─────────────────────────── */
.test-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 16px 18px;
  text-align: left; cursor: pointer; width: 100%;
  margin-bottom: 10px; display: block;
  transition: box-shadow 0.2s;
}
.test-card:hover { box-shadow: var(--shadow-sm); }
.test-card-header    { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 8px; }
.test-card-nome      { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
.test-card-condition { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 5px; }
.test-card-desc      { font-size: 12px; color: var(--text-soft); line-height: 1.5; margin-bottom: 8px; }
.test-card-stats     { display: flex; gap: 14px; font-size: 11px; color: var(--text-soft); }
.test-card-stats strong { color: var(--text); }

/* ── Stat Bars ──────────────────────────── */
.stat-bar-row   { margin-bottom: 8px; }
.stat-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-soft); margin-bottom: 3px; }
.stat-bar-track { height: 3px; background: var(--line); border-radius: 4px; overflow: hidden; }
.stat-bar-fill  { height: 100%; background: var(--primary); border-radius: 4px; }
.stat-lr        { display: flex; gap: 20px; }

/* ── Toggle Buttons (Bool / Lado) ────────── */
.toggle-group     { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg); color: var(--text-soft);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.toggle-btn.active      { background: var(--brand-pale); color: var(--brand-darkest); border-color: var(--brand-light); font-weight: 700; }
.toggle-btn.active-sim  { background: #EAF5EA !important; color: #2A6B2A !important; border-color: #A8D4A8 !important; }
.toggle-btn.active-nao  { background: var(--danger-light) !important; color: var(--danger) !important; border-color: #DDA5A5 !important; }

/* ── Select Buttons ─────────────────────── */
.sel-group { display: flex; flex-direction: column; gap: 5px; }
.sel-btn {
  padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-soft); font-size: 13px;
  text-align: left; cursor: pointer; transition: all 0.15s;
  font-family: inherit; width: 100%;
}
.sel-btn.active { background: var(--brand-pale); color: var(--brand-darkest); border-color: var(--brand-light); font-weight: 600; }

/* ── Scale Slider ───────────────────────── */
.scale-group  { display: flex; align-items: center; gap: 12px; }
.scale-input  { flex: 1; accent-color: var(--primary); cursor: pointer; }
.scale-value  { font-size: 22px; font-weight: 800; color: var(--primary); min-width: 32px; text-align: right; }
.scale-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Form helpers ───────────────────────── */
.form-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px;
}
.field-group  { margin-bottom: 18px; }
.field-label  { font-size: 13px; color: var(--text-soft); line-height: 1.5; margin-bottom: 8px; display: block; font-weight: 400; margin-top: 0; }
.info-box     { background: var(--brand-pale); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--brand-darkest); line-height: 1.55; }

/* ── Resultado ──────────────────────────── */
.resultado-card {
  border-radius: var(--radius-md); padding: 24px 20px;
  text-align: center; margin-bottom: 14px; border: 1px solid transparent;
}
.resultado-positivo { background: var(--danger-light); border-color: #DDA5A5; }
.resultado-negativo { background: var(--brand-pale);   border-color: var(--brand-light); }
.resultado-anormal  { background: #FBF0D5;             border-color: #DDC080; }
.resultado-label {
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px;
}
.resultado-positivo .resultado-label { color: var(--danger); }
.resultado-negativo .resultado-label { color: var(--brand-darkest); }
.resultado-anormal  .resultado-label { color: var(--gold-text); }
.resultado-condition { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.resultado-conf      { font-size: 12px; color: var(--text-soft); }

/* ── Filter Pills ───────────────────────── */
.filter-pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.pill {
  padding: 5px 12px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text-soft); font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: all 0.15s;
}
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Back button ────────────────────────── */
.btn-voltar {
  background: none; border: none; color: var(--text-soft);
  font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 16px;
  display: flex; align-items: center; gap: 4px;
  font-family: inherit;
}
.btn-voltar:hover { color: var(--text); }
