/* ══════════════════════════════════════════════════════════
   CADASTRO-FUNCIONARIO.CSS
   Estilos exclusivos da página de cadastro de funcionários.

   Carregue APÓS os arquivos compartilhados:
     <link rel="stylesheet" href="/css/base.css">
     <link rel="stylesheet" href="/css/header.css">
     <link rel="stylesheet" href="/css/components.css">
     <link rel="stylesheet" href="/css/cadastro-funcionario.css">
   ══════════════════════════════════════════════════════════ */


/* ============================================================
   VARIÁVEIS AUSENTES NOS ARQUIVOS COMPARTILHADOS
   (base.css / header.css não definem --card, --shadow, --radius)
   ============================================================ */
:root {
  --card:    var(--header-bg, #ffffff);
  --shadow:  0 4px 20px rgba(0,0,0,0.06);
  --radius:  14px;
  --radius2: 10px;
}
html[data-theme="dark"] {
  --card:   #131c2e;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}


/* ============================================================
   BANNER DE EDIÇÃO
   ============================================================ */
.edit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.40);
  color: #92400e;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}
html[data-theme="dark"] .edit-banner {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
  color: #fde68a;
}


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


/* ============================================================
   CARD — override de components.css
   (components usa var(--brand) como borda e border-radius: 16px)
   ============================================================ */
.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;
}

h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
}

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


/* ============================================================
   BOTÕES — override de components.css
   (components usa border-radius:8px, font-size:13px, padding diferente)
   ============================================================ */
.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; }


/* ============================================================
   CAMPOS — override de components.css
   (components usa uppercase no label, border: var(--brand), padding menor)
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.field input,
.field select {
  margin-top: 0;
  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(0,0,0,0.06);
}

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);
}


/* ============================================================
   TABELA — override de components.css
   (components usa text-align:center e border em todos os lados)
   ============================================================ */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

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

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--chip-bg);
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: none;
}

th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.th-sort:hover {
  color: var(--brand);
  background: color-mix(in srgb, var(--chip-bg) 60%, var(--brand-faded));
}

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

tr:hover td {
  background: var(--chip-bg);
  opacity: 0.8;
}

html[data-theme="dark"] tr:hover td { opacity: 1; }


/* ============================================================
   GRIDS (exclusivos desta página)
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.inline-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; align-items: start; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}


/* ============================================================
   TURNOS (checkboxes visuais)
   ============================================================ */
.turnos-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.turno-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
  padding: 9px 14px;
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--field-bg);
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.turno-check input { display: none; }

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

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

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


/* ============================================================
   MISC
   ============================================================ */
.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);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.2;
  min-height: 14px;
}
.help.err { color: var(--danger); font-weight: 700; }
.help.ok  { color: #1f8f4a; font-weight: 700; }

.req {
  color: #ef4444;
  font-weight: 700;
  margin-left: 4px;
}

.warn {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(185,28,28,0.08);
  border: 1px solid rgba(185,28,28,0.25);
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
}

.ok-msg {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(22,163,74,0.10);
  border: 1px solid rgba(22,163,74,0.25);
  color: #15803d;
  font-size: 14px;
  margin-bottom: 12px;
}
html[data-theme="dark"] .ok-msg { color: #4ade80; }

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

.badge-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--chip-color);
}


/* ============================================================
   CAMPO IDADE (somente leitura)
   ============================================================ */
.field-age { pointer-events: none; }
.field-age input {
  background: var(--chip-bg) !important;
  color: var(--muted) !important;
  cursor: default;
}


/* ============================================================
   CPF — ícone de status dentro do input
   ============================================================ */
.cpf-wrap { position: relative; }
.cpf-wrap input { padding-right: 12px; transition: padding-right 0.1s; }
.cpf-wrap input.has-icon { padding-right: 34px; }

.cpf-status-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 900;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1;
}
.cpf-status-icon.ok  { opacity: 1; color: #16a34a; }
.cpf-status-icon.err { opacity: 1; color: #b91c1c; }


/* ============================================================
   ANO ATIVO — chip com select embutido
   ============================================================ */
.ano-chip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.ano-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-color);
  font-size: 13px;
  font-weight: 800;
  cursor: default;
}

.ano-chip 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"] .ano-chip select option {
  background: #0a1426;
  color: #e2e8f0;
}


/* ============================================================
   MENU FLUTUANTE DE AÇÕES DA TABELA
   ============================================================ */
.acoes-menu {
  position: fixed;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15,23,42,0.14);
  padding: 6px;
  min-width: 148px;
}

html[data-theme="dark"] .acoes-menu {
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}

.acoes-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.15s;
  white-space: nowrap;
}

.acoes-btn:hover { background: var(--chip-bg); }

.acoes-btn.danger { color: var(--danger); }
.acoes-btn.danger:hover { background: rgba(185,28,28,0.09); }

html[data-theme="dark"] .acoes-btn.danger:hover {
  background: rgba(185,28,28,0.18);
}

.btn-acoes {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 4px 10px;
  line-height: 1;
}


/* ============================================================
   NATURALIDADE — autocomplete
   ============================================================ */
.nat-wrap { position: relative; }

.nat-ghost-layer {
  position: absolute;
  inset: 0;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-family: 'Nunito', inherit;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  color: transparent;
}

.nat-ghost-layer span.ghost-tail { color: #adb5bd; }

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

.nat-input-real:focus {
  border-color: var(--brand, #7c3aed);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

html[data-theme="dark"] .nat-input-real {
  background: transparent;
  color: var(--text);
}

.nat-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.10);
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.nat-dropdown.open { display: block; }

.nat-opt {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nat-opt:hover,
.nat-opt.active { background: var(--chip-bg); }

.nat-opt .nat-uf {
  font-size: 11px;
  font-weight: 800;
  color: var(--chip-color);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}
