/* ============================================
   ENFERMAGEM - Estilos específicos
   Herda base de styles.css + agenda.css + orcamentos.css
   ============================================ */

/* Override: permitir scroll no conteúdo */
#app-content {
  overflow: auto;
}

/* Sub-abas internas */
.enf-tabs-container {
  padding: 0 20px 20px;
}

.enf-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.enf-tab-sep {
  margin-left: 16px;
  border-left: 2px solid #e2e8f0;
  padding-left: 20px;
}

.enf-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.enf-tab:hover {
  color: #5b3aab;
  background: #f8fafc;
}

.enf-tab.active {
  color: #5b3aab;
  border-bottom-color: #5b3aab;
  font-weight: 600;
}

.enf-tab-content {
  display: none;
}

.enf-tab-content.active {
  display: block;
}

/* Seções */
.enf-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(91, 58, 171, 0.07);
}

.enf-section h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.enf-section h3 i {
  color: #5b3aab;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.empty-message {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ============================================
   PRONTUÁRIO — Layout 3 faixas
   ============================================ */
.pront-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pront-full { width: 100%; }

/* 3 colunas iguais, mesma altura */
.pront-row3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: stretch;
}

/* Card base */
.pront-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(91,58,171,0.08);
  overflow: hidden;
}

/* Header dos cards */
.pront-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #edf0f5;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pront-card-header i { color: #5b3aab; font-size: 12px; }
.pront-header-red    .pront-card-header i,
.pront-header-red i  { color: #dc2626; }
.pront-header-yellow .pront-card-header i,
.pront-header-yellow i { color: #d97706; }

.pront-badge-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: #e9edf3;
  color: #475569;
  min-width: 20px;
  text-align: center;
}

.pront-badge-red    { background: #fee2e2; color: #dc2626; }
.pront-badge-yellow { background: #fef3c7; color: #d97706; }

/* ── Faixa 1: Dados cadastrais ── */
.pront-dados-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
}

.dado-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  border-right: 1px solid #f1f5f9;
  min-width: 0;
}

.dado-item:last-child { border-right: none; }

.dado-item label {
  font-size: 9.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.dado-item span {
  font-size: 12.5px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Faixa 2: Tags (alergias / comorbidades / medicações) ── */
.pront-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 12px;
  min-height: 44px;
  align-content: flex-start;
}

.alergia-item {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.alergia-item i { font-size: 10px; }

.comorbidade-item {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.comorbidade-item i { font-size: 8px; }

.alergia-origem {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0,0,0,0.1);
}

/* Medicações */
.pront-med-list { display: flex; flex-direction: column; }

.medicacao-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}

.medicacao-item:last-child { border-bottom: none; }
.medicacao-item:hover { background: #fafbff; }

.med-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5b3aab;
  margin-top: 4px;
}

.medicacao-item strong {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.medicacao-item span {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.medicacao-item small {
  display: block;
  font-size: 10.5px;
  color: #94a3b8;
  font-style: italic;
  padding: 0 14px 6px 26px;
  margin-top: -4px;
}

/* ── Faixa 3: Histórico ── */
.historico-container { overflow-x: auto; }

.historico-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.historico-table th {
  background: #f8fafc;
  padding: 8px 14px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #edf0f5;
  white-space: nowrap;
}

.historico-table td {
  padding: 7px 14px;
  border-bottom: 1px solid #f4f6fa;
  color: #334155;
  font-size: 12px;
}

.historico-table tr:last-child td { border-bottom: none; }
.historico-table tr:hover td { background: #fafbff; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.status-badge.executado { background: #dcfce7; color: #16a34a; }
.status-badge.normal    { background: #dbeafe; color: #2563eb; }
.status-badge.cancelado { background: #fee2e2; color: #dc2626; }

/* Botão + nos headers dos cards */
.pront-add-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  line-height: 1;
}

.pront-add-btn:hover {
  color: #5b3aab;
  background: #ede9f9;
}

.pront-header-red .pront-add-btn:hover    { color: #dc2626; background: #fee2e2; }
.pront-header-yellow .pront-add-btn:hover { color: #d97706; background: #fef3c7; }

/* Checklist comorbidades no modal */
.comorbid-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.comorbid-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: background 0.1s;
}

.comorbid-checklist label:hover { background: #fffbeb; }

.comorbid-checklist input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #d97706;
  flex-shrink: 0;
}

.enf-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}

/* Tag com botão de excluir */
.alergia-item .tag-del,
.comorbidade-item .tag-del {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 0;
  margin-left: 2px;
  font-size: 10px;
  line-height: 1;
  transition: opacity 0.15s;
}

.alergia-item .tag-del:hover,
.comorbidade-item .tag-del:hover { opacity: 1; }

/* Medicação com ações inline */
.med-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.medicacao-item:hover .med-actions { opacity: 1; }

.med-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 11px;
  padding: 3px 5px;
  border-radius: 4px;
  transition: all 0.1s;
}

.med-actions button:hover       { color: #5b3aab; background: #ede9f9; }
.med-actions button.btn-delete:hover { color: #dc2626; background: #fee2e2; }

/* Barra de alergias do paciente */
.patient-alergias { margin-top: 4px; }

.alergia-badge {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.alergia-badge i { margin-right: 4px; }

/* Responsivo */
@media (max-width: 1200px) {
  .pront-dados-grid { grid-template-columns: repeat(4, 1fr); }
  .dado-item { border-bottom: 1px solid #f1f5f9; }
  .dado-item:nth-child(4n) { border-right: none; }
  .dado-item:nth-last-child(-n+4) { border-bottom: none; }
}

@media (max-width: 900px) {
  .pront-row3 { grid-template-columns: 1fr; }
  .pront-dados-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Evolução */
.evolucao-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enf-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.enf-form-row label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.enf-form-row select,
.enf-form-row input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #d5dae2;
  border-radius: 8px;
  font-size: 13px;
  background: #f9fafb;
  color: #1e293b;
}

.enf-form-row select:focus,
.enf-form-row input[type="text"]:focus {
  outline: none;
  border-color: #5b3aab;
  box-shadow: 0 0 0 2px rgba(91, 58, 171, 0.12);
}

.evolucao-form textarea,
.sae-obs {
  width: 100%;
  padding: 12px;
  border: 1px solid #d5dae2;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  color: #1e293b;
  box-sizing: border-box;
  background: #f9fafb;
}

.evolucao-form textarea:focus,
.sae-obs:focus {
  outline: none;
  border-color: #5b3aab;
  box-shadow: 0 0 0 2px rgba(91, 58, 171, 0.12);
}

.enf-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.auto-save-status {
  font-size: 12px;
  color: #94a3b8;
}

.auto-save-status.saved {
  color: #16a34a;
}

.enf-btn-primary {
  padding: 8px 20px;
  background: #5b3aab;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.enf-btn-primary:hover { background: #4a2e8f; }
.enf-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.enf-btn-secondary {
  padding: 8px 20px;
  background: #f9fafb;
  color: #475569;
  border: 1px solid #d5dae2;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.enf-btn-secondary:hover { background: #e2e8f0; }

.btn-edit-phone {
  background: none;
  border: none;
  color: #5b3aab;
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
}

/* Timeline de Evolução */
.evolucao-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.evolucao-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 4px solid #5b3aab;
}

.evolucao-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.evolucao-tipo {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  background: #f4f1fa;
  color: #5b3aab;
}

.evolucao-meta {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  gap: 12px;
}

.evolucao-card-body {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
  white-space: pre-wrap;
}

.evolucao-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.evolucao-assinatura {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
}

.evolucao-actions {
  display: flex;
  gap: 8px;
}

.evolucao-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #94a3b8;
  padding: 4px;
}

.evolucao-actions button:hover { color: #5b3aab; }
.evolucao-actions button.btn-delete:hover { color: #dc2626; }

/* SAE Wizard */
.sae-wizard {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(91, 58, 171, 0.07);
}

.sae-steps {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.sae-step {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  border-bottom: 3px solid #e2e8f0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  white-space: nowrap;
}

.sae-step:hover { color: #5b3aab; }

.sae-step.active {
  color: #5b3aab;
  border-bottom-color: #5b3aab;
  font-weight: 600;
}

.sae-step.completed {
  color: #16a34a;
  border-bottom-color: #16a34a;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.sae-step.active .step-num {
  background: #5b3aab;
  color: #fff;
}

.sae-step.completed .step-num {
  background: #16a34a;
  color: #fff;
}

.sae-step-content {
  display: none;
}

.sae-step-content.active {
  display: block;
}

.sae-step-content h3 {
  font-size: 16px;
  color: #1e293b;
  margin-bottom: 16px;
}

.sae-step-content h4 {
  font-size: 14px;
  color: #475569;
  margin: 14px 0 8px;
}

.sae-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.sae-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: background 0.15s;
}

.sae-checklist label:hover {
  background: #f4f1fa;
}

.sae-checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #5b3aab;
}

.sae-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* Anexos */
.anexo-upload-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-area {
  border: 2px dashed #d5dae2;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #94a3b8;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #5b3aab;
  background: #f4f1fa;
  color: #5b3aab;
}

.upload-area i {
  font-size: 36px;
  margin-bottom: 8px;
  display: block;
}

.upload-area p {
  font-size: 14px;
  margin-bottom: 4px;
}

.upload-info {
  font-size: 12px;
}

.upload-area.has-file {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #16a34a;
}

.anexos-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.anexo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.15s;
}

.anexo-item:hover {
  background: #f4f1fa;
}

.anexo-icon {
  font-size: 24px;
  color: #5b3aab;
  width: 36px;
  text-align: center;
}

.anexo-info {
  flex: 1;
}

.anexo-info strong {
  font-size: 13px;
  color: #1e293b;
  display: block;
}

.anexo-info small {
  font-size: 11px;
  color: #94a3b8;
}

.anexo-tipo-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f4f1fa;
  color: #5b3aab;
}

.anexo-actions {
  display: flex;
  gap: 6px;
}

.anexo-actions a,
.anexo-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #64748b;
  padding: 4px 6px;
  border-radius: 4px;
  text-decoration: none;
}

.anexo-actions a:hover,
.anexo-actions button:hover {
  color: #5b3aab;
  background: #f4f1fa;
}

.anexo-actions button.btn-delete:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* Modal telefone - usa classes próprias para não conflitar */
.enf-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(30, 20, 60, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.enf-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 4px 20px rgba(91, 58, 171, 0.1);
}

.enf-modal-box h3 {
  font-size: 16px;
  color: #1e293b;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.enf-modal-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d5dae2;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.enf-modal-box input:focus {
  outline: none;
  border-color: #5b3aab;
  box-shadow: 0 0 0 2px rgba(91, 58, 171, 0.12);
}

.enf-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* Responsivo */
@media (max-width: 768px) {
  .enf-tabs {
    overflow-x: auto;
  }
  .sae-steps {
    flex-wrap: nowrap;
  }
  .enf-form-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .dados-grid {
    grid-template-columns: 1fr;
  }
}
