/* NES — Medicamentos Estruturados — v1.0 — 2026-06-27 */

/* ── Seção wrapper ────────────────────────────────────────── */
.nes-med-wrap {
  padding: 16px 0;
  max-width: 900px;
}

.nes-med-titulo {
  font-size: 1rem;
  font-weight: 700;
  color: #0f4c66;
  margin: 0 0 14px;
}

/* ── Aviso legado ─────────────────────────────────────────── */
.nes-med-aviso-legado {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #854d0e;
  margin-bottom: 14px;
  line-height: 1.5;
}

.nes-med-aviso-legado strong { color: #78350f; }

/* ── Formulário de adição ─────────────────────────────────── */
.nes-med-form-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.nes-med-form-box h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 12px;
}

.nes-med-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.nes-med-form-grid input,
.nes-med-form-grid select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.83rem;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.nes-med-form-grid input:focus,
.nes-med-form-grid select:focus {
  outline: none;
  border-color: #0f4c66;
  box-shadow: 0 0 0 2px rgba(15,76,102,0.12);
}

.nes-med-form-grid .nes-med-textarea {
  grid-column: 1 / -1;
}

.nes-med-form-grid textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.83rem;
  font-family: inherit;
  background: #fff;
  color: #111827;
  resize: vertical;
  box-sizing: border-box;
}

.nes-med-form-grid textarea:focus {
  outline: none;
  border-color: #0f4c66;
  box-shadow: 0 0 0 2px rgba(15,76,102,0.12);
}

.nes-med-form-label-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #374151;
  padding: 7px 0;
  cursor: pointer;
}

.nes-med-form-label-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.nes-med-form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nes-med-msg {
  font-size: 0.80rem;
  color: #64748b;
}

.nes-med-msg.erro  { color: #dc2626; }
.nes-med-msg.ok    { color: #16a34a; }

/* ── Cabeçalho da lista ───────────────────────────────────── */
.nes-med-lista-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.nes-med-lista-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f4c66;
}

.nes-med-filtros {
  display: flex;
  gap: 6px;
}

.nes-med-filtro {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}

.nes-med-filtro.ativo,
.nes-med-filtro:hover { background: #0f4c66; color: #fff; border-color: #0f4c66; }

/* ── Lista de medicamentos ────────────────────────────────── */
.nes-med-lista {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.nes-med-vazia {
  text-align: center;
  padding: 24px 16px;
  color: #64748b;
  font-size: 0.84rem;
}

/* ── Card de medicamento ──────────────────────────────────── */
.nes-med-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 14px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  transition: box-shadow 0.1s;
}

.nes-med-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.nes-med-card.suspenso  { opacity: 0.65; border-color: #fcd34d; background: #fffbeb; }
.nes-med-card.encerrado { opacity: 0.50; border-color: #e2e8f0; background: #f8fafc; }

.nes-med-card-info { flex: 1; min-width: 0; }

.nes-med-card-info strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: #111827;
  display: block;
  margin-bottom: 3px;
}

.nes-med-card-info .nes-med-detalhe {
  font-size: 0.80rem;
  color: #334155;
  margin: 2px 0;
  line-height: 1.5;
}

.nes-med-card-info small {
  font-size: 0.74rem;
  color: #64748b;
  display: block;
  margin-top: 4px;
}

/* Status badges dentro do card */
.nes-med-status {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nes-med-status-ativo     { background: #dcfce7; color: #166534; }
.nes-med-status-suspenso  { background: #fef9c3; color: #854d0e; }
.nes-med-status-encerrado { background: #f1f5f9; color: #64748b; }

/* ── Ações do card ────────────────────────────────────────── */
.nes-med-acoes {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: flex-start;
  flex-shrink: 0;
}

.nes-med-btn {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  background: #f8fafc;
  color: #374151;
  transition: background 0.1s, border-color 0.1s;
  white-space: nowrap;
}

.nes-med-btn:hover          { background: #e2e8f0; }
.nes-med-btn.btn-editar     { border-color: #93c5fd; color: #1e40af; }
.nes-med-btn.btn-suspender  { border-color: #fcd34d; color: #854d0e; }
.nes-med-btn.btn-reativar   { border-color: #86efac; color: #166534; }
.nes-med-btn.btn-excluir    { border-color: #fca5a5; color: #991b1b; }

/* ── Modal de edição inline ───────────────────────────────── */
.nes-med-edit-inline {
  margin-top: 10px;
  padding: 10px 12px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 10px;
}

.nes-med-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.nes-med-edit-grid input,
.nes-med-edit-grid select,
.nes-med-edit-grid textarea {
  width: 100%;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.80rem;
  background: #fff;
  box-sizing: border-box;
}

.nes-med-edit-grid textarea { min-height: 60px; font-family: inherit; resize: vertical; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nes-med-card   { flex-direction: column; }
  .nes-med-acoes  { width: 100%; }
  .nes-med-form-grid { grid-template-columns: 1fr; }
  .nes-med-edit-grid { grid-template-columns: 1fr; }
}
