/* BioCare Ocupacional - Estilos */

:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-light: #ccfbf1;
  --green: #16a34a;
  --green-light: #dcfce7;
  --yellow: #d97706;
  --yellow-light: #fef3c7;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --gray: #6b7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Layout */
#sidebar { width: 240px; min-width: 240px; transition: all 0.3s; }
#sidebar.collapsed { width: 64px; min-width: 64px; }
#main-content { flex: 1; overflow-y: auto; }

/* Sidebar */
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 8px; cursor: pointer; transition: all 0.2s; color: #94a3b8; font-size: 14px; margin: 2px 8px; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active { background: var(--teal); color: #fff; }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #475569; padding: 16px 16px 6px; font-weight: 600; }

/* Cards */
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: pointer; transition: all 0.2s; border: 2px solid transparent; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.stat-card.active { border-color: var(--teal); }
.stat-card-conclusao { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); transition: all 0.2s; }
.stat-card-conclusao:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray); border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: #f1f5f9; color: var(--gray); }
.badge-teal { background: var(--teal-light); color: var(--teal-dark); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-secondary { background: #f1f5f9; color: #374151; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #c2410c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.form-label.required::after { content: ' *'; color: var(--red); }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; color: #1f2937; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; }
.form-control:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,0.1); }
.form-control:disabled { background: #f9fafb; color: var(--gray); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #e5e7eb; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #e5e7eb; display: flex; justify-content: flex-end; gap: 8px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #86efac; }
.alert-warning { background: var(--yellow-light); color: var(--yellow); border: 1px solid #fcd34d; }
.alert-info { background: var(--blue-light); color: var(--blue); border: 1px solid #93c5fd; }

/* SLA Progress */
.progress-bar { height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* Toast */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); font-size: 14px; min-width: 280px; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast-success { background: var(--green); color: #fff; }
.toast-error { background: var(--red); color: #fff; }
.toast-warning { background: var(--orange); color: #fff; }
.toast-info { background: var(--blue); color: #fff; }

/* Loading */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-card { background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); padding: 40px; width: 100%; max-width: 420px; }

/* Exam row actions */
.exam-row { transition: background 0.15s; }
.exam-row:hover { background: #f0fdfa !important; }
.quick-btn { padding: 4px 10px; font-size: 11px; border-radius: 6px; cursor: pointer; border: none; font-weight: 500; transition: all 0.15s; white-space: nowrap; }

/* Pagination dots for long lists */
.table-container { overflow-x: auto; }

/* Filters bar */
.filters-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; background: #f8fafc; border-radius: 10px; margin-bottom: 12px; }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { position: fixed; z-index: 100; height: 100vh; transform: translateX(-100%); }
  #sidebar.mobile-open { transform: translateX(0); }
  .stat-cards-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Animations */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Tab */
.tab-btn { padding: 8px 16px; font-size: 13px; font-weight: 500; border: none; background: none; cursor: pointer; color: var(--gray); border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-btn:hover { color: var(--teal-dark); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-state i { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }

/* CNPJ loading */
.cnpj-loading { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--teal); }

/* ── Modal de Contrato: grid de exames ──────────────────────────────── */
.contract-exam-grid {
  grid-template-columns: 1fr 120px 110px 40px;
  gap: 8px;
  align-items: center;
}

/* ── Dropdown de sugestões de exame no contrato ─────────────────────── */
.contract-exam-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 200;
  overflow: hidden;
  max-height: 280px;
  overflow-y: auto;
}
.ced-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
}
.ced-item:last-child { border-bottom: none; }
.ced-item:hover { background: #f0fdfa; }
.ced-item-new {
  background: #f0fdfa;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-top: 1px dashed #99f6e4;
}
.ced-item-new:hover { background: #ccfbf1; }

/* ── Botões de Status de Comparecimento ─────────────────────────────── */
.att-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  transition: all 0.18s;
  white-space: nowrap;
  user-select: none;
}
.att-status-btn:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}
.att-status-btn:active {
  transform: scale(0.97);
}

/* ── Chips de Exame (selecionáveis) ─────────────────────────────────── */
.exam-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}
.exam-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.13);
}
.exam-chip:active { transform: scale(0.97); }

/* Chip ADICIONADO (selecionado pelo usuário) — verde forte, bem visível */
.exam-chip-on {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(15,118,110,0.35);
}
.exam-chip-on:hover {
  background: #0d9488;
  border-color: #0d9488;
  box-shadow: 0 2px 8px rgba(15,118,110,0.4);
}

/* Chip DISPONÍVEL (não selecionado) — cinza claro, discreto */
.exam-chip-off {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #e5e7eb;
  font-weight: 400;
}
.exam-chip-off:hover {
  background: #e8faf8;
  border-color: #5eead4;
  color: #0f766e;
  font-weight: 500;
}

/* Highlight de texto nos chips de busca */
.exam-chip mark {
  background: #fef08a;
  color: inherit;
  border-radius: 2px;
  padding: 0;
  font-weight: 700;
}
.exam-chip-on mark {
  background: rgba(255,255,150,0.5);
}

/* ===== Lista de Exames (substitui chips em nuvem) ===== */

/* Container: lista vertical com scroll */
.exam-list-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  padding: 4px;
}
.exam-list-container::-webkit-scrollbar { width: 5px; }
.exam-list-container::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.exam-list-container::-webkit-scrollbar-track { background: transparent; }

/* Linha da lista: botão full-width */
.exam-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
  user-select: none;
  line-height: 1.3;
}
.exam-list-row:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.exam-list-row:active { transform: scale(0.995); }

/* Ícone de check/estrela/círculo */
.exam-list-check {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 13px;
}

/* Nome do exame (ocupa o espaço restante) */
.exam-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Metadados à direita (SLA, tag favorito) */
.exam-list-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.exam-list-sla {
  font-size: 10.5px;
  color: #9ca3af;
  background: #f3f4f6;
  border-radius: 4px;
  padding: 1px 5px;
}
.exam-list-tag-fav {
  font-size: 10px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 600;
}

/* Estado: ADICIONADO (verde) */
.exam-list-row-on {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
  font-weight: 700;
}
.exam-list-row-on .exam-list-check { color: #16a34a; }
.exam-list-row-on .exam-list-sla   { background: #bbf7d0; color: #166534; }
.exam-list-row-on:hover { background: #bbf7d0; border-color: #15803d; }

/* Estado: DISPONÍVEL, comum */
.exam-list-row-off {
  background: #ffffff;
  border-color: transparent;
  color: #374151;
}
.exam-list-row-off .exam-list-check { color: #d1d5db; }
.exam-list-row-off:hover {
  background: #f0fdf4;
  border-color: #a7f3d0;
  color: #065f46;
}
.exam-list-row-off:hover .exam-list-check { color: #10b981; }

/* Favorito disponível: fundo âmbar bem suave */
.exam-list-row-fav.exam-list-row-off {
  background: #fffbeb;
  border-color: #fde68a;
}
.exam-list-row-fav.exam-list-row-off .exam-list-check { color: #f59e0b; }
.exam-list-row-fav.exam-list-row-off:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

/* Favorito adicionado: verde mais escuro com ★ */
.exam-list-row-fav.exam-list-row-on {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
}
.exam-list-row-fav.exam-list-row-on .exam-list-check { color: #16a34a; }

/* Highlight de texto na busca */
.exam-highlight {
  background: #fef08a;
  color: #713f12;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 700;
}

/* ===== Searchable Company Select ===== */
.searchable-wrap {
  position: relative;
}
.searchable-input-box {
  display: flex;
  align-items: center;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s;
  overflow: hidden;
}
.searchable-input-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13,148,136,.1);
}
.searchable-input-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 9px 12px;
  font-size: 0.9rem;
  background: transparent;
  color: #374151;
  min-width: 0;
}
.searchable-input-box input::placeholder { color: #9ca3af; }
.searchable-arrow {
  padding: 0 12px;
  color: #6b7280;
  font-size: 0.75rem;
  pointer-events: none;
}
.searchable-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 9999;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}
.searchable-dropdown.open { display: block; }
.searchable-option {
  padding: 9px 14px;
  font-size: 0.88rem;
  color: #374151;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid #f3f4f6;
}
.searchable-option:last-child { border-bottom: none; }
.searchable-option:hover,
.searchable-option.active { background: #f0fdfa; color: var(--teal-dark); }
.searchable-option.selected { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.searchable-option.no-result { color: #9ca3af; font-style: italic; cursor: default; }
.searchable-option.no-result:hover { background: none; }

/* ===== Troca rápida de status de comparecimento ===== */
.att-quick-status-wrap {
  position: relative;
  display: inline-block;
}

/* Botão principal (badge clicável) */
.att-quick-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}
.att-quick-status-btn:hover { filter: brightness(0.93); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.13); }
.att-quick-status-btn:disabled { opacity: 0.6; cursor: wait; }

.att-quick-status-arrow { font-size: 9px; opacity: 0.6; margin-left: 2px; }

/* Estados do botão */
.att-quick-status-agendado       { background:#dbeafe; color:#1d4ed8; border-color:#93c5fd; }
.att-quick-status-compareceu     { background:#dcfce7; color:#15803d; border-color:#86efac; }
.att-quick-status-nao_compareceu { background:#fee2e2; color:#b91c1c; border-color:#fca5a5; }

/* Dropdown de opções */
.att-quick-status-dropdown {
  /* position e top/left são definidos via JS (position:fixed) para escapar do overflow */
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.16);
  min-width: 175px;
  overflow: hidden;
  animation: fadeInDown 0.12s ease;
}
@keyframes fadeInDown {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Opções do dropdown */
.att-quick-drop-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  transition: background 0.1s;
  border-bottom: 1px solid #f3f4f6;
}
.att-quick-drop-opt:last-child { border-bottom: none; }

.att-quick-drop-agendado:hover       { background:#eff6ff; color:#1d4ed8; }
.att-quick-drop-compareceu:hover     { background:#f0fdf4; color:#15803d; }
.att-quick-drop-nao:hover            { background:#fff1f2; color:#b91c1c; }

.att-quick-drop-agendado       { color:#374151; }
.att-quick-drop-compareceu     { color:#374151; }
.att-quick-drop-nao            { color:#374151; }
