/* ══════════════════════════════════════════════════════════
   PESQUISA-FUNCIONARIO.CSS
   Estilos específicos para a página de pesquisa de funcionários

   Inclua APÓS header.css e base.css:
   <link rel="stylesheet" href="/css/base.css">
   <link rel="stylesheet" href="/css/header.css">
   <link rel="stylesheet" href="/css/hub.css">
   <link rel="stylesheet" href="/css/pesquisa-funcionario.css">
   ══════════════════════════════════════════════════════════ */


/* ============================================================
   VARIÁVEIS DO SISTEMA
   (inclui as variáveis base que o HTML antigo definia inline)
   ============================================================ */
:root {
  --bg:           #f4f3ff;
  --card:         #ffffff;
  --text:         #1e1b4b;
  --muted:        #6b7280;
  --border:       var(--brand-border, #ddd6fe);
  --line:         var(--brand-border, #ddd6fe);
  --shadow:       0 4px 20px rgba(0,0,0,0.06);
  --danger:       #b91c1c;
  --ink:          #1e1b4b;
  --radius:       14px;
  --radius2:      10px;
  --field-bg:     #ffffff;
  --field-border: var(--brand-border, #ddd6fe);
  --chip-bg:      var(--brand-faded, #f5f3ff);
  --chip-border:  var(--brand-border, #ddd6fe);
  --chip-color:   var(--brand-text, #6d28d9);
  --chip-name:    #4b5563;
  --sub-color:    var(--brand-text, #6d28d9);
  --mark-bg:      var(--brand-faded, #f5f3ff);

  --table-hover-bg:    rgba(124, 58, 237, 0.04);
  --turno-hint-bg:     var(--chip-bg);
  --turno-hint-border: var(--chip-border);
  --turno-hint-color:  var(--chip-color);

  --ativo-bg:     rgba(22, 163, 74, 0.10);
  --ativo-color:  #15803d;
  --ativo-border: rgba(22, 163, 74, 0.30);
}

html[data-theme="dark"] {
  --bg:           #0a0e1a;
  --card:         #131c2e;
  --text:         #e2e8f0;
  --muted:        #94a3b8;
  --border:       #2a3a5c;
  --line:         #1e2540;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --ink:          #e2e8f0;
  --field-bg:     #0a1426;
  --field-border: #1e2540;
  --chip-bg:      var(--brand-faded-d, rgba(124,58,237,0.28));
  --chip-border:  var(--brand-border-d, #7c3aed);
  --chip-color:   var(--brand-text-d, #c4b5fd);
  --chip-name:    var(--brand-text-d, #c4b5fd);
  --sub-color:    var(--brand-text-d, #c4b5fd);
  --mark-bg:      rgba(124,58,237,0.28);

  --table-hover-bg:    rgba(124, 58, 237, 0.08);
  --turno-hint-bg:     var(--brand-faded-d);
  --turno-hint-border: var(--brand-border-d);
  --turno-hint-color:  var(--brand-text-d);

  --ativo-bg:     rgba(22, 163, 74, 0.15);
  --ativo-color:  #4ade80;
  --ativo-border: rgba(22, 163, 74, 0.35);
}


/* ============================================================
   CONTAINER PRINCIPAL
   ============================================================ */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}


/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  transition: background 0.3s, border-color 0.3s;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.card .sub,
.card .muted {
  color: var(--muted);
  font-size: 13px;
}

#cardFiltros {
  margin-bottom: 20px;
}

#cardFiltros .card-head {
  margin-bottom: 16px;
}

#cardResultados {
  margin-bottom: 20px;
}


/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, transform 0.06s;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--brand, #7c3aed);
  border-color: var(--brand, #7c3aed);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-hover, #6d28d9);
  border-color: var(--brand-hover, #6d28d9);
}

html[data-theme="dark"] .btn.primary {
  background: var(--brand-d, #7c3aed);
  border-color: var(--brand-d, #7c3aed);
}

.btn.danger {
  background: rgba(185,28,28,0.10);
  border-color: rgba(185,28,28,0.30);
  color: var(--danger);
}

.btn.danger:hover {
  background: rgba(185,28,28,0.18);
}

.btn.ghost,
.btn.secondary {
  background: var(--chip-bg);
  border-color: var(--chip-border);
  color: var(--chip-color);
}

.btn.ghost:hover,
.btn.secondary:hover {
  background: var(--brand-faded, #f5f3ff);
  border-color: var(--brand, #7c3aed);
  color: var(--brand-text, #6d28d9);
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}


@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ============================================================
   CAMPOS (inputs e selects)
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.field input,
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  font-family: 'Nunito', sans-serif;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  border-color: var(--brand, #7c3aed);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select {
  background: var(--field-bg);
  color: var(--text);
  border-color: var(--field-border);
}

html[data-theme="dark"] .field select option {
  background: #0a1426;
  color: #e2e8f0;
}

html[data-theme="dark"] input::placeholder {
  color: rgba(226, 232, 240, 0.45);
}


/* ============================================================
   PILL — chip/badge genérico
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--chip-color);
  white-space: nowrap;
}


/* ============================================================
   BADGE — chip de ano ativo e estatísticas
   Substitui .ano-chip e .stat-pill do HTML antigo
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-color);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge strong {
  font-size: 14px;
  color: var(--text);
  font-weight: 800;
}

.badge select {
  border: none;
  background: transparent;
  color: var(--chip-color);
  font-weight: 800;
  font-size: 13px;
  font-family: 'Nunito', sans-serif;
  outline: none;
  cursor: pointer;
  padding: 0 2px;
}

html[data-theme="dark"] .badge select {
  color: var(--chip-color);
}

html[data-theme="dark"] .badge select option {
  background: #0a1426;
  color: #e2e8f0;
}


/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}


/* ============================================================
   ACTIONS — linha de ações genérica
   ============================================================ */
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}


/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}


/* ============================================================
   FILTROS GRID
   ============================================================ */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}


/* ============================================================
   FILTROS DE TURNO (CHECKBOXES)
   ============================================================ */
.turnos-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.turno-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--field-border);
  background: var(--field-bg);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.turno-checkbox-wrap:hover {
  border-color: var(--brand, #7c3aed);
  background: var(--chip-bg);
  color: var(--chip-color);
}

.turno-checkbox-wrap.checked {
  border-color: var(--brand, #7c3aed);
  background: var(--chip-bg);
  color: var(--chip-color);
}

html[data-theme="dark"] .turno-checkbox-wrap {
  background: var(--field-bg);
  border-color: var(--field-border);
  color: var(--muted);
}

html[data-theme="dark"] .turno-checkbox-wrap.checked {
  border-color: var(--brand-d, #7c3aed);
  background: var(--chip-bg);
  color: var(--chip-color);
}

.turno-checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand, #7c3aed);
}

.turno-checkbox-wrap label {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  cursor: pointer;
  color: inherit;
}

#turnoHint {
  font-size: 12px;
  color: var(--chip-color);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* ============================================================
   RESULTADOS
   ============================================================ */
.resultados-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.resultados-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.resultados-info h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.resultados-info .sub {
  font-size: 13px;
  color: var(--muted);
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}


/* ============================================================
   TABELA
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
  font-size: 13px;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  text-align: left;
}

th {
  background: var(--chip-bg);
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--table-hover-bg);
}

td.nome-cell {
  font-weight: 700;
  color: var(--text);
}

td.status-cell {
  text-align: center;
}

.empty-row td {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
  font-size: 14px;
}


/* ============================================================
   CABEÇALHO ORDENÁVEL
   ============================================================ */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.15s;
  white-space: nowrap;
}

th.sortable:hover {
  background: var(--brand-faded, #f5f3ff);
  color: var(--brand-text, #6d28d9);
}

th.sortable .sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.4;
  transition: opacity 0.15s;
}

th.sortable:hover .sort-icon {
  opacity: 1;
}

th.sortable.asc .sort-icon,
th.sortable.desc .sort-icon {
  opacity: 1;
  color: var(--brand, #7c3aed);
}


/* ============================================================
   BADGE STATUS (vínculo na tabela)
   ============================================================ */
.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid;
}

.badge-status.ativo {
  background: var(--ativo-bg);
  color: var(--ativo-color);
  border-color: var(--ativo-border);
}

.badge-status.inativo {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
  border-color: rgba(107, 114, 128, 0.3);
}

html[data-theme="dark"] .badge-status.inativo {
  background: rgba(148, 163, 184, 0.18);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}


/* ============================================================
   PAGINAÇÃO
   ============================================================ */
.paginacao-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.paginacao-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.paginacao-controles {
  display: flex;
  gap: 8px;
}

.paginacao-controles .btn {
  min-width: 100px;
}


/* ============================================================
   MARK — destaque de busca
   ============================================================ */
mark {
  background: var(--brand-faded, #f5f3ff);
  color: var(--brand-text, #6d28d9);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 800;
}

html[data-theme="dark"] mark {
  background: rgba(124, 58, 237, 0.35);
  color: #c4b5fd;
}


/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 768px) {
  .wrap {
    padding: 16px 12px 32px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .resultados-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .export-actions {
    width: 100%;
  }

  .export-actions .btn {
    flex: 1;
  }

  .paginacao-row {
    flex-direction: column;
    align-items: stretch;
  }

  .paginacao-controles {
    width: 100%;
  }

  .paginacao-controles .btn {
    flex: 1;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .turnos-row {
    flex-direction: column;
    align-items: stretch;
  }

  .turno-checkbox-wrap {
    width: 100%;
    justify-content: flex-start;
  }

  #turnoHint {
    width: 100%;
    justify-content: center;
  }
}
