/* =========================================================
   DADOS DA ANÁLISE — #aba1
   Estilos exclusivos desta seção.
   ========================================================= */

/* ----------------------------------------------------------
   Paleta por grupo analítico
   ---------------------------------------------------------- */
:root {
  --a1-ph-hd:    #166534;  --a1-ph-chip:    #bbf7d0;  --a1-ph-bd:    #86efac;
  --a1-bas-hd:   #1d4ed8;  --a1-bas-chip:   #bfdbfe;  --a1-bas-bd:   #93c5fd;
  --a1-ac-hd:    #92400e;  --a1-ac-chip:    #fde68a;  --a1-ac-bd:    #fcd34d;
  --a1-an-hd:    #6b21a8;  --a1-an-chip:    #e9d5ff;  --a1-an-bd:    #d8b4fe;
  --a1-mic-hd:   #0e7490;  --a1-mic-chip:   #a5f3fc;  --a1-mic-bd:   #67e8f9;
  --a1-comp-hd:  #374151;  --a1-comp-chip:  #e5e7eb;  --a1-comp-bd:  #d1d5db;
  --a1-amber:    #b45309;
  --a1-amber-bg: #fffbeb;
  --a1-focus:    rgba(180, 83, 9, .15);
}

/* ----------------------------------------------------------
   Seção e wrapper principal
   ---------------------------------------------------------- */
#aba1 {
  background: #f1f5f9;
}

#aba1 .solo-wrap {
  padding: 1.5rem .75rem 3rem;
  max-width: 1280px;
  margin: 0 auto;
}

/* ----------------------------------------------------------
   qcard — cartão de grupo de campos
   ---------------------------------------------------------- */
#aba1 .qcard {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
  padding: 0 1rem 1rem;
  height: 100%;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .18s ease;
}

#aba1 .qcard:hover {
  box-shadow: 0 6px 22px rgba(0, 0, 0, .12);
  transform: translateY(-2px);
}

/* Título — header colorido full-width (quebra o padding para sangrar) */
#aba1 .qtitle {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff;
  margin: 0 -1rem .9rem;
  padding: .55rem 1rem;
  line-height: 1.4;
}

/* cores por variante */
#aba1 .qcard--ph     .qtitle { background: var(--a1-ph-hd); }
#aba1 .qcard--bases  .qtitle { background: var(--a1-bas-hd); }
#aba1 .qcard--acidos .qtitle { background: var(--a1-ac-hd); }
#aba1 .qcard--anions .qtitle { background: var(--a1-an-hd); }
#aba1 .qcard--micro  .qtitle { background: var(--a1-mic-hd); }
#aba1 .qcard--comp   .qtitle { background: var(--a1-comp-hd); }

/* fundo levemente colorido só no card de micro */
#aba1 .bg-micro-soft {
  background: linear-gradient(160deg, #fff 70%, #ecfeff 100%);
}

/* ----------------------------------------------------------
   pH — select de modo
   ---------------------------------------------------------- */
#aba1 .ph-mode-select {
  font-size: .78rem;
  height: auto;
  padding: .2rem .45rem;
  border-color: #d1d5db;
  color: #6b7280;
  border-radius: 6px;
}

/* ----------------------------------------------------------
   qfield — container de campo individual (foco sutil)
   ---------------------------------------------------------- */
#aba1 .qfield {
  border-radius: 8px;
  padding: .35rem .5rem;
  transition: background .15s;
}

#aba1 .qfield:focus-within {
  background: var(--a1-amber-bg);
}

#aba1 .qfield .input-group:focus-within {
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--a1-focus);
}

/* ----------------------------------------------------------
   Identificação (builder) — card para usuário logado
   ---------------------------------------------------------- */
#identificacao_builder {
  border: 1.5px solid #e5e7eb !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.05) !important;
  transition: border-color .2s, box-shadow .2s;
}

#identificacao_builder:focus-within {
  border-color: var(--a1-amber) !important;
  box-shadow: 0 0 0 3px var(--a1-focus), 0 2px 8px rgba(0,0,0,.05) !important;
}

#identificacao_builder .card-header {
  background: #f8fafc;
  border-bottom: 1px solid #f0f4f8;
  border-radius: 10px 10px 0 0 !important;
}

#identificacao_builder.is-map-open {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15), 0 2px 8px rgba(0,0,0,.05) !important;
}

/* Prévia da identificação */
#identificacao_preview {
  min-height: 2.2rem;
  font-size: .9rem;
  color: #374151;
  border-color: #e5e7eb !important;
}

/* ----------------------------------------------------------
   Botão "Escolher no mapa"
   ---------------------------------------------------------- */
#btnPickOnMap {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #fff;
  border-color: #1d4ed8;
  transition: filter .15s, box-shadow .15s;
}

#btnPickOnMap:hover,
#btnPickOnMap:focus {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(29, 78, 216, .35);
  color: #fff;
}

/* Animação de atenção (classe adicionada por JS) */
#btnPickOnMap.is-attn {
  animation: a1-btnPulse .55s ease 3;
}

@keyframes a1-btnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.5); }
  60%  { box-shadow: 0 0 0 8px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}

/* ----------------------------------------------------------
   Botões de ação (CTA + danger)
   ---------------------------------------------------------- */
.btn.btn-solid-cta {
  background: var(--a1-ph-hd);
  color: #fff;
  border: none;
  padding: .55rem 1.75rem;
  font-weight: 600;
  border-radius: 8px;
  transition: background .15s, box-shadow .15s;
}

.btn.btn-solid-cta:hover,
.btn.btn-solid-cta:focus {
  background: #14532d;
  box-shadow: 0 4px 14px rgba(22,101,52,.3);
  color: #fff;
}

.btn.btn-ghost-danger {
  background: transparent;
  color: #dc2626;
  border: 1.5px solid #dc2626;
  padding: .5rem 1.35rem;
  font-weight: 600;
  border-radius: 8px;
  transition: background .15s, color .15s;
}

.btn.btn-ghost-danger:hover,
.btn.btn-ghost-danger:focus {
  background: #dc2626;
  color: #fff;
}

/* ----------------------------------------------------------
   Resultado do cálculo — cartões de análise armazenada
   ---------------------------------------------------------- */
#resultadoCalculo {
  width: 100%;
}

.solo-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.solo-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  background: #1e293b;
  color: #fff;
  padding: .5rem 1rem;
  font-size: .82rem;
}

.solo-id {
  font-weight: 700;
  font-size: .75rem;
  background: rgba(255, 255, 255, .15);
  border-radius: 4px;
  padding: .1rem .4rem;
  white-space: nowrap;
}

.solo-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.solo-prof {
  font-size: .75rem;
  opacity: .7;
  white-space: nowrap;
}

.solo-body {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .75rem 1rem;
}

/* -- Chips individuais de dados analíticos -- */
.solo-chip {
  display: inline-flex;
  align-items: center;
  gap: .25em;
  font-size: .77rem;
  border-radius: 6px;
  padding: .2rem .55rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
}

.solo-chip em { font-style: normal; color: #64748b; font-size: .72rem; }
.solo-chip b  { font-weight: 700; color: #1e293b; }

/* Cor por grupo analítico */
.solo-chip[data-g="ph"]     { background: var(--a1-ph-chip);   border-color: var(--a1-ph-bd); }
.solo-chip[data-g="bases"]  { background: var(--a1-bas-chip);  border-color: var(--a1-bas-bd); }
.solo-chip[data-g="acidos"] { background: var(--a1-ac-chip);   border-color: var(--a1-ac-bd); }
.solo-chip[data-g="anions"] { background: var(--a1-an-chip);   border-color: var(--a1-an-bd); }
.solo-chip[data-g="micro"]  { background: var(--a1-mic-chip);  border-color: var(--a1-mic-bd); }
.solo-chip[data-g="comp"]   { background: var(--a1-comp-chip); border-color: var(--a1-comp-bd); }

.solo-chip[data-g="ph"]     em, .solo-chip[data-g="ph"]     b { color: #14532d; }
.solo-chip[data-g="bases"]  em, .solo-chip[data-g="bases"]  b { color: #1e3a8a; }
.solo-chip[data-g="acidos"] em, .solo-chip[data-g="acidos"] b { color: #78350f; }
.solo-chip[data-g="anions"] em, .solo-chip[data-g="anions"] b { color: #581c87; }
.solo-chip[data-g="micro"]  em, .solo-chip[data-g="micro"]  b { color: #164e63; }
.solo-chip[data-g="comp"]   em, .solo-chip[data-g="comp"]   b { color: #374151; }

/* ----------------------------------------------------------
   Dica / hint
   ---------------------------------------------------------- */
#aba1 .hint.muted {
  font-size: .82rem;
  color: #6b7280;
}

/* ----------------------------------------------------------
   Resultado: corrige posicionamento dentro do flex de botões
   ---------------------------------------------------------- */
#resultadoCalculo {
  flex-basis: 100%;       /* força nova linha no flex container pai */
  margin-top: 1rem;       /* substitui o mt-4 do Bootstrap para evitar gap duplo */
}

/* ----------------------------------------------------------
   Responsividade
   ---------------------------------------------------------- */

/* --- Mobile portrait (< 576px) --- */
@media (max-width: 575.98px) {
  #aba1 .solo-wrap  { padding: .75rem .25rem 2.5rem; }
  #aba1 .qcard      { padding: 0 .75rem .75rem; }
  #aba1 .qtitle     { margin: 0 -.75rem .75rem; }
  .solo-head        { font-size: .78rem; gap: .35rem; }
  .solo-chip        { font-size: .72rem; }

  /* Botões empilhados, full-width */
  .btn.btn-solid-cta,
  .btn.btn-ghost-danger {
    flex-basis: 100%;
    text-align: center;
  }
}

/* --- Mobile landscape / tablet pequeno (576px – 767px): 2 colunas --- */
@media (min-width: 576px) and (max-width: 767.98px) {
  #aba1 .row > .col-12.col-lg-4 {
    flex: 0 0 auto;
    width: 50%;
  }

  /* 3º card de cada linha ocupa a largura toda para evitar orphan */
  #aba1 .row > .col-12.col-lg-4:nth-child(3) {
    width: 100%;
  }
}

/* --- Tablet (768px – 991px): 3 colunas (igual ao desktop) --- */
@media (min-width: 768px) and (max-width: 991.98px) {
  #aba1 .row > .col-12.col-lg-4 {
    flex: 0 0 auto;
    width: 33.333%;
  }

  /* Títulos um pouco menores para caber sem quebrar em colunas estreitas */
  #aba1 .qtitle {
    font-size: .65rem;
    letter-spacing: .05em;
  }
}
