/* ==============================================
   Calculadora — Z-Score Ecocardiografia Fetal
   Styles específicos (carrega após calc.css)
   ============================================== */

/* ── Disclaimer (amarelo) ── */
.zs-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #92400e;
}

.zs-disclaimer svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #d97706;
}

/* ── Gestational Age row ── */
.zs-ga-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 768px) {
  .zs-ga-row {
    grid-template-columns: 1fr;
  }
}

/* ── Input groups ── */
.zs-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zs-input-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.zs-select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--text-primary, #1e293b);
  background: var(--bg-white, #fff);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L1.175 4 2.238 2.938 6 6.7l3.763-3.763L10.825 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.zs-select:focus {
  outline: none;
  border-color: var(--teal, #0d9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* ── Section headers ── */
.zs-section {
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.zs-section-header { border-left: 3px solid #e11d48;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.zs-section-header svg {
  flex-shrink: 0;
  color: var(--teal, #0d9488);
}

.zs-section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0;
}

/* ── Fields grid ── */
.zs-fields-grid {
  display: flex;
  flex-direction: column;
}

/* ── Individual field row ── */
.zs-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  align-items: center;
}

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

@media (max-width: 768px) {
  .zs-field-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px;
  }
}

.zs-field-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zs-field-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.zs-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.zs-input {
  width: 100%;
  padding: 10px 44px 10px 14px;
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 10px;
  font-size: 0.9375rem;
  color: var(--text-primary, #1e293b);
  background: var(--bg-white, #fff);
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.zs-input::-webkit-inner-spin-button,
.zs-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.zs-input:focus {
  outline: none;
  border-color: var(--teal, #0d9488);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.zs-input::placeholder {
  color: #94a3b8;
  font-size: 0.8125rem;
}

.zs-input-unit {
  position: absolute;
  right: 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #94a3b8;
  pointer-events: none;
}

/* ── Inline result per field ── */
.zs-field-result {
  min-height: 42px;
}

.zs-result-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

@media (max-width: 600px) {
  .zs-result-inner {
    flex-wrap: wrap;
    gap: 8px;
  }
}

.zs-res-mean,
.zs-res-range,
.zs-res-zscore {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.zs-res-zscore {
  flex: 0 0 auto;
  align-items: center;
}

.zs-res-lbl {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.zs-res-val {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
}

/* ── Z-Score badge ── */
.zs-res-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
}

.zs-res-badge.zs-badge-normal {
  background: #16a34a;
}

.zs-res-badge.zs-badge-borderline {
  background: #d97706;
}

.zs-res-badge.zs-badge-abnormal {
  background: #dc2626;
}

/* ── Error state on inputs ── */
.zs-input.zs-input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

/* ── Result card ── */
.zs-result-card {
  animation: zsSlideIn 0.4s ease-out;
}

@keyframes zsSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.zs-result-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  margin: 0 0 4px;
}

.zs-result-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 20px;
}

/* ── Legend ── */
.zs-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.zs-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: #64748b;
}

.zs-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zs-dot-normal {
  background: #16a34a;
}

.zs-dot-borderline {
  background: #d97706;
}

.zs-dot-abnormal {
  background: #dc2626;
}

/* ── Results table ── */
.zs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.zs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.zs-table thead th {
  padding: 12px 16px;
  background: #1e293b;
  color: #fff;
  font-weight: 600;
  font-size: 0.8125rem;
  text-align: center;
  white-space: nowrap;
  border: none;
}

.zs-table thead th:first-child {
  text-align: left;
  border-radius: 9px 0 0 0;
}

.zs-table thead th:last-child {
  border-radius: 0 9px 0 0;
}

.zs-table tbody td {
  padding: 11px 16px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-primary, #1e293b);
}

.zs-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.zs-table tbody tr:last-child td {
  border-bottom: none;
}

.zs-table tbody tr:hover {
  background: #f8fafc;
}

/* Section divider row in table */
.zs-table tbody tr.zs-section-row td {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.8125rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  text-align: left;
}

/* Z-Score cell badges in table */
.zs-table .zs-tbl-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #fff;
}

.zs-tbl-badge.zs-badge-normal {
  background: #16a34a;
}

.zs-tbl-badge.zs-badge-borderline {
  background: #d97706;
}

.zs-tbl-badge.zs-badge-abnormal {
  background: #dc2626;
}

.zs-table-note {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin-top: 12px;
  text-align: center;
}

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
  .zs-disclaimer {
    padding: 14px 16px;
    font-size: 0.8125rem;
  }

  .zs-section-header { border-left: 3px solid #e11d48;
    padding: 12px 16px;
  }

  .zs-table thead th {
    padding: 10px 10px;
    font-size: 0.75rem;
  }

  .zs-table tbody td {
    padding: 9px 10px;
    font-size: 0.8125rem;
  }

  .zs-legend {
    flex-direction: column;
    gap: 8px;
  }
}

/* ── Standard calculator fixes ── */
#zs-card .btn-row {
  display: flex !important;
  align-items: stretch !important;
  gap: 10px;
  margin-top: 20px;
}
#zs-card .btn-row .btn-calcular {
  flex: 1;
  width: auto !important;
  margin-top: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#zs-card .btn-row .btn-limpar {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 24px !important;
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  margin-top: 0 !important;
  width: auto !important;
}
#zs-card .btn-row .btn-limpar:hover { background: #e2e8f0 !important; }

/* ── Heart section colors ── */
.zs-section-header svg { color: #e11d48; }
.zs-section-header h3 { color: #e11d48; }

/* ── Fix link colors in other calculators grid ── */
#zs-card ~ .calcs-grid .calc-card,
.calc-card { color: #0f172a; text-decoration: none; }
.calc-card:visited { color: #0f172a; }
.calc-card-name { color: #0f172a; }
