/* =============================================================
   Enaulix Design System · components.css
   Clases semánticas que leen los tokens de tokens.css.
   Funciona igual en PHP (clases) y en React (className).
   Requiere: tokens.css cargado antes que este archivo.
   ============================================================= */

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

/* scrollbars discretos */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(120,135,170,.35); border-radius: var(--r-full); border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(120,135,170,.55); background-clip: content-box; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card-pad { padding: 20px; }
.card-lift { transition: transform var(--dur), box-shadow var(--dur), border-color var(--dur); }
.card-lift:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

/* Tarjeta KPI / destacada — admite degradado de marca */
.card-kpi { background: var(--brand-gradient); color: var(--brand-ink); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r); font-weight: 600; font-size: 13.5px;
  padding: 9px 15px; transition: filter var(--dur), background var(--dur), box-shadow var(--dur), transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-gradient); color: var(--brand-ink); box-shadow: var(--sh-sm); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-solid { background: var(--brand); color: var(--brand-ink); box-shadow: var(--sh-sm); }
.btn-solid:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover { filter: brightness(.97); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { filter: brightness(.97); }
.btn-lg { font-size: 15.5px; padding: 14px 36px; border-radius: var(--r-lg); min-width: 160px; }
.btn-block { width: 100%; }
/* Botones de acción de formulario: tamaño/radio/sombra del botón "Enviar Información"
   de incorporaciones (color = marca actual). */
.form-actions { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; }
.form-actions .btn { font-size: 15px; font-weight: 600; padding: .85rem 2.5rem; border-radius: .75rem; min-width: 160px; }
.form-actions .btn-primary { padding: .85rem 4rem; min-width: 280px; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.form-actions .btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 42%, transparent); }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-full); line-height: 1.4; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok    { color: var(--ok);     background: var(--ok-bg); }
.b-warn  { color: var(--warn);   background: var(--warn-bg); }
.b-info  { color: var(--info);   background: var(--info-bg); }
.b-danger{ color: var(--danger); background: var(--danger-bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------- Avatar ---------- */
.avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--brand-ink); flex-shrink: 0; background: var(--brand); }

/* ---------- Formularios (kit estándar, basado en incorporaciones) ---------- */
.form-wrapper { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 2rem; margin-bottom: 2rem; }
.section-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; margin-bottom: 1.25rem; }
.section-title { font-size: 18px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; }
.section-icon { width: 2rem; height: 2rem; border-radius: .45rem; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .82rem; font-weight: 700; flex-shrink: 0; }

.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: .375rem; }
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 10px 13px; font-size: 14px; color: var(--ink); background: var(--surface-2);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur); outline: 0;
}
.form-input::placeholder { color: var(--faint); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand); background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.form-input.err, .form-select.err { border-color: var(--danger); background: #fff5f5; }
.form-textarea { resize: vertical; min-height: 72px; }
.help { font-size: 11.5px; margin-top: 5px; color: var(--muted); }
.help.err { color: var(--danger); }

/* Radio-cards seleccionables */
.nac-card {
  display: flex; align-items: center; gap: .6rem; padding: .65rem 1.4rem;
  border: 2px solid var(--line); border-radius: var(--r-lg); cursor: pointer;
  transition: all var(--dur); background: var(--surface); user-select: none;
}
.nac-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-soft); }
.nac-card.sel { border-color: var(--brand); background: var(--brand-soft); }
.nac-card.sel .nac-text { color: var(--brand-strong); font-weight: 600; }

/* Barra de progreso sticky inferior */
.progress-sticky {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding: .5rem 1rem; display: flex; align-items: center; gap: .75rem;
  opacity: 0; transform: translateY(100%); pointer-events: none;
}
.progress-sticky.visible { animation: slideUp .3s ease forwards; pointer-events: auto; }
.progress-sticky.hiding  { animation: slideDown .25s ease forwards; pointer-events: none; }
.progress-bar { height: 6px; border-radius: var(--r-full); background: var(--line); overflow: hidden; flex: 1; }
.progress-bar > span { display: block; height: 100%; background: var(--brand-gradient); transition: width .3s var(--ease); }

/* Carga de documentos (estándar para todos los formularios) */
.dropzone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 1.25rem .9rem; min-height: 120px;
  cursor: pointer; text-align: center; background: var(--surface-2); color: var(--muted);
  transition: border-color var(--dur), background var(--dur), color var(--dur);
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.dropzone .dz-ic { width: 26px; height: 26px; opacity: .85; }
.dropzone .dz-text { font-size: 13px; font-weight: 600; }
.dropzone .dz-hint { font-size: 11px; color: var(--faint); }
/* Tarjeta de archivo ya cargado (misma altura que el dropzone para alinear) */
.file-card {
  display: flex; align-items: center; gap: 11px; min-height: 120px;
  border: 1.5px solid var(--ok); background: var(--ok-bg); border-radius: var(--r-lg); padding: 14px 16px;
}
/* Icono según tipo de archivo: forma de documento + extensión, color por tipo.
   La app aplica la clase .ft-* según la extensión del archivo subido. */
.file-ic {
  width: 30px; height: 38px; border-radius: 5px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-size: 8.5px; font-weight: 800;
  letter-spacing: .3px; box-shadow: var(--sh-sm); position: relative;
}
.file-ic::after { /* esquina doblada del documento */
  content: ""; position: absolute; top: 0; right: 0;
  border-width: 0 0 8px 8px; border-style: solid;
  border-color: transparent transparent rgba(255,255,255,.5) transparent; border-top-right-radius: 5px;
}
.file-ic.ft-pdf     { background: #dc2626; }
.file-ic.ft-img     { background: #0284c7; }
.file-ic.ft-doc     { background: #2563eb; }
.file-ic.ft-xls     { background: #059669; }
.file-ic.ft-zip     { background: #b7791f; }
.file-ic.ft-default { background: var(--c-slate); }
.file-card .fc-body { min-width: 0; overflow: hidden; }   /* permite el recorte con ellipsis */
.file-card .fc-name { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .fc-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.file-card .fc-remove { margin-left: auto; align-self: flex-start; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.file-card .fc-remove:hover { color: var(--danger); }

/* ---------- Tablas ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); color: var(--ink-soft); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,20,50,.5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; padding: 24px; animation: fade .16s ease; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg); width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; animation: pop .18s var(--ease); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 14px; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast { background: var(--ink); color: #fff; padding: 13px 17px; border-radius: var(--r); box-shadow: var(--sh-lg); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 11px; animation: slideIn .22s ease; max-width: 360px; }

/* ---------- Switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 9px; background: transparent; border: 0; padding: 0; }
.switch-track { width: 38px; height: 22px; border-radius: var(--r-full); background: var(--line); position: relative; transition: background var(--dur); flex-shrink: 0; }
.switch-track.on { background: var(--ok); }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--sh-sm); transition: transform var(--dur); }
.switch-track.on .switch-thumb { transform: translateX(16px); }

/* ---------- App shell (sidebar CLARO) ---------- */
.app { display: flex; height: 100vh; background: var(--bg); overflow: hidden; }
.sidebar { width: 264px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-gradient); color: var(--brand-ink); font-weight: 800; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--ink); line-height: 1.1; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.nav { padding: 10px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); padding: 14px 12px 7px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; color: var(--ink-soft); padding: 9px 12px; border-radius: var(--r); font-size: 13.5px; font-weight: 500; text-align: left; transition: background var(--dur), color var(--dur); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.nav-ic { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 26px; }
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.content { flex: 1; overflow-y: auto; padding: 26px; }

/* ---------- Utilidades de texto ---------- */
.h-xl { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.h-lg { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.h-md { font-size: 16px; font-weight: 700; }
.t-muted { color: var(--muted); }
.t-faint { color: var(--faint); }
.t-sm { font-size: 12.5px; }
.t-xs { font-size: 11px; }

/* ---------- Animaciones ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(100%); } }
