/* ═══════════════════════════════════════════════════════════════
   Talenkai — Design System (producto de ATAYIN Digital)
   Paleta: idéntica a ofertas_publicas.php (la que gusta)
   bg: #f8f9fc  surface: #fff  border: #e4e7ef  text: #1a1d2e
   accent: #f5a623  pill-bg: #eef0f8  pill-tx: #4a4f72
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens globales ──────────────────────────────────────────── */
:root {
  --bg:       #f8f9fc;
  --surface:  #ffffff;
  --border:   #e4e7ef;
  --text:     #1a1d2e;
  --text2:    #6b7280;
  --accent:   #f5a623;
  --accent2:  #e09618;
  --pill-bg:  #eef0f8;
  --pill-tx:  #4a4f72;
  --tag-bg:   #f0f2fa;
  --navy:     #0f1e35;
  --navy2:    #1b2a4a;
  --shadow:   0 1px 4px rgba(0,0,0,.07);
  --shadow-md:0 4px 16px rgba(0,0,0,.09);
  --radius:   10px;
  --radius-sm:6px;
}

/* ── Reset base ───────────────────────────────────────────────── */
body {
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow) !important;
  background: var(--surface) !important;
}
.card-header {
  background: var(--surface) !important;
  border-bottom-color: var(--border) !important;
}

/* ── Tablas ───────────────────────────────────────────────────── */
.table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  border-bottom-color: var(--border);
}
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--pill-bg); }
.table-light { background: var(--pill-bg) !important; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { font-weight: 600; font-size: 10px; letter-spacing: .2px; border-radius: 5px; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,166,35,.12);
}
.form-control-sm, .form-select-sm { font-size: 12px; }
.form-label { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
pre { font-size: 12px; }

/* ── Field labels en fichas ───────────────────────────────────── */
.field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #9ca3af;
  margin-bottom: 2px;
}
.field-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.card-body .fw-medium { color: var(--text); font-size: 13px; }

/* ── Score colors ─────────────────────────────────────────────── */
.score-high { color: #198754; }
.score-mid  { color: #d97706; }
.score-low  { color: #9ca3af; }

/* ── Email items ──────────────────────────────────────────────── */
.email-item:hover { background: var(--pill-bg); }
.email-body img { max-width: 100%; }
.email-body table { max-width: 100%; }
.email-body { word-wrap: break-word; overflow-wrap: anywhere; }

/* ── Skill tags en tablas ─────────────────────────────────────── */
.skill-tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--pill-tx);
  font-size: 10px;
  font-family: ui-monospace, monospace;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .12s;
}
.skill-tag:hover, .skill-tag.s4 { background: #dbeafe; color: #1e40af; }

/* ────────────────────────────────────────────────────────────────
   SISTEMA DE BOTONES — paleta idéntica a ofertas_publicas.php
   ──────────────────────────────────────────────────────────────── */

/* Base compartida */
.btn-at, .btn-at-gold, .btn-at-add,
.btn-at-ghost, .btn-at-danger, .btn-at-back, .btn-at-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .13s ease;
  line-height: 1.4;
  white-space: nowrap;
  font-family: inherit;
  vertical-align: middle;
  letter-spacing: .1px;
}

/* Primario: acción principal */
.btn-at {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-at:hover { background: var(--navy2); color: #fff; }

/* Acento dorado: Matching, IA */
.btn-at-gold {
  background: var(--accent);
  color: var(--navy);
  border-color: var(--accent);
  font-weight: 700;
}
.btn-at-gold:hover { background: var(--accent2); color: var(--navy); border-color: var(--accent2); }

/* Positivo: crear, añadir */
.btn-at-add {
  background: var(--surface);
  color: #065f46;
  border-color: #a7f3d0;
}
.btn-at-add:hover { background: #ecfdf5; border-color: #6ee7b7; }

/* Ghost: secundarias, editar, navegación */
.btn-at-ghost {
  background: var(--surface);
  color: var(--pill-tx);
  border-color: var(--border);
}
.btn-at-ghost:hover { background: var(--pill-bg); border-color: #c8cde0; color: var(--text); }

/* btn-check (Agencia / Cliente final, etc.): estado seleccionado */
.btn-check:checked + .btn-at-ghost,
.btn-check:checked + .btn-at,
label.btn-at-ghost.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  font-weight: 600;
}
.btn-check:checked + .btn-at-ghost:hover,
label.btn-at-ghost.active:hover {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e40af;
}

/* Peligro: borrar, reset */
.btn-at-danger {
  background: var(--surface);
  color: #991b1b;
  border-color: #fca5a5;
}
.btn-at-danger:hover { background: #fef2f2; border-color: #f87171; }

/* Volver: siempre igual, sin borde */
.btn-at-back {
  background: transparent;
  color: var(--text2);
  border-color: transparent;
  padding: 5px 8px;
  font-weight: 500;
}
.btn-at-back:hover { background: var(--pill-bg); color: var(--text); }

/* Tab: Oferta / Matches / Kanban */
.btn-at-tab {
  background: var(--surface);
  color: var(--text2);
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 5px 13px;
}
.btn-at-tab:hover { background: var(--pill-bg); color: var(--text); }
.btn-at-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* Icono solo */
.btn-at-icon { padding: 5px 9px; }

/* Filtro texto + botón limpiar (sidebar listados) */
.at-filter-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.at-filter-wrap .form-control {
  flex: 1;
  min-width: 0;
}
.at-filter-wrap .at-filter-clear-btn {
  flex-shrink: 0;
  align-self: stretch;
  padding: 0 9px;
  min-width: 32px;
}

/* Focus */
.btn-at:focus-visible, .btn-at-gold:focus-visible, .btn-at-add:focus-visible,
.btn-at-ghost:focus-visible, .btn-at-danger:focus-visible,
.btn-at-back:focus-visible, .btn-at-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Anular estilos Bootstrap en botones que ahora usamos con clases at- */
.btn-at-ghost.active,
.btn-at-tab.active { /* ya cubierto */ }

/* ── Filtros tipo pill (candidatos, ofertas sidebar) ──────────── */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--pill-bg);
  color: var(--pill-tx);
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 3px 13px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .13s;
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Col-sort en tablas ───────────────────────────────────────── */
.col-sort { cursor: pointer; user-select: none; }
.col-sort:hover { color: var(--accent); }

/* ── Pestañas de vista (Oferta / Matches / Kanban) ───────────────────────── */
.at-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .13s, border-color .13s;
  white-space: nowrap;
  margin-bottom: -2px;
}
.at-tab:hover { color: var(--text); border-bottom-color: var(--border); }
.at-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.at-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  background: var(--pill-bg);
  color: var(--pill-tx);
  border-radius: 9px;
}
.at-tab.active .at-tab-count {
  background: rgba(245,166,35,.15);
  color: var(--accent2);
}

/* ── Toasts (feedback operativo) ──────────────────────────────── */
#at-toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10800;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  max-width: min(400px, calc(100vw - 28px));
  pointer-events: none;
}
.at-toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  border-left-width: 5px;
  box-shadow: 0 12px 40px rgba(15, 30, 53, .22), 0 2px 8px rgba(15, 30, 53, .12);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #0f1e35;
  animation: atToastIn .25s ease-out;
}
.at-toast.is-out {
  animation: atToastOut .2s ease-in forwards;
}
.at-toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-top: 0;
  color: #fff;
}
.at-toast-msg { flex: 1; min-width: 0; }
.at-toast-close {
  border: 0;
  background: transparent;
  color: rgba(15, 30, 53, .45);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  font-weight: 700;
}
.at-toast-close:hover { color: #0f1e35; }
.at-toast-success {
  background: #ecfdf5;
  border-color: #6ee7b7;
  border-left-color: #059669;
}
.at-toast-success .at-toast-icon { background: #059669; }
.at-toast-info {
  background: #eff6ff;
  border-color: #93c5fd;
  border-left-color: #2563eb;
}
.at-toast-info .at-toast-icon { background: #2563eb; }
.at-toast-warning {
  background: #fff7ed;
  border-color: #fdba74;
  border-left-color: #f5a623;
}
.at-toast-warning .at-toast-icon { background: #f5a623; color: #0f1e35; }
.at-toast-danger {
  background: #fef2f2;
  border-color: #fca5a5;
  border-left-color: #dc2626;
}
.at-toast-danger .at-toast-icon { background: #dc2626; }
@keyframes atToastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes atToastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(.96); }
}

/* Modales maestro encima de otro modal: más abajo para ver el de detrás atenuado */
.modal.modal-maestro-stack {
  z-index: 1065;
  padding-top: 5.5rem !important;
  align-items: flex-start !important;
}
.modal.modal-maestro-stack .modal-dialog {
  margin-top: 1.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 16px 48px rgba(15, 30, 53, 0.28);
}
/* Modal padre (p. ej. editar oferta) visible pero atenuado */
.modal.show.modal-maestro-under .modal-content {
  opacity: 0.52;
  filter: brightness(0.94) saturate(0.9);
  transition: opacity 0.22s ease, filter 0.22s ease;
  pointer-events: none;
}
.modal.show.modal-maestro-under {
  z-index: 1055;
}
.modal-backdrop.modal-maestro-backdrop {
  z-index: 1060;
  opacity: 0.28 !important;
}

/* Campo secreto con botón mostrar/ocultar */
.at-secret-wrap .form-control {
  border-right: 0;
}
.at-secret-wrap .at-secret-toggle {
  border-color: #dee2e6;
  padding: 0 0.55rem;
  line-height: 1;
  color: #6b7280;
}
.at-secret-wrap .at-secret-toggle:hover {
  color: #374151;
  background: #f3f4f6;
}
.at-secret-wrap .at-secret-toggle i {
  font-size: 0.95em;
  pointer-events: none;
}
