/* Estilos institucionales complementarios a Tailwind (paleta clara, sobria). */

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: background-color 0.15s, color 0.15s;
}
.nav-link:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}
.nav-active {
  color: #1e3a8a;
  background-color: #eff3fb;
  font-weight: 600;
}

/* Pestañas internas de una sección (p. ej. Usuarios / Auditoría). */
.tab {
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  padding: 0.65rem 0.15rem;
  margin-right: 1.75rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: #0f172a; }
.tab-active { color: #1e3a8a; border-bottom-color: #2563eb; font-weight: 600; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  transition: background-color 0.15s, opacity 0.15s, border-color 0.15s;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background-color: #2563eb; color: #fff; }
.btn-primary:hover:not(:disabled) { background-color: #1d4ed8; }
.btn-success { background-color: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background-color: #15803d; }
.btn-danger { background-color: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background-color: #b91c1c; }
.btn-ghost { background-color: #fff; color: #0f172a; border: 1px solid #e2e8f0; }
.btn-ghost:hover:not(:disabled) { border-color: #94a3b8; }

/* Tarjetas / contenedores */
.card {
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

/* Inputs */
.input, .select {
  width: 100%;
  font-size: 0.875rem;
  color: #0f172a;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}
.input:focus, .select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.label { display:block; font-size: 0.8rem; font-weight: 600; color: #334155; margin-bottom: 0.35rem; }

/* Badges de rol/estado */
.badge { display:inline-flex; align-items:center; font-size: 0.72rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 9999px; }
.badge-admin { background-color: #fee2e2; color: #dc2626; }
.badge-editor { background-color: #dbeafe; color: #2563eb; }
.badge-operator { background-color: #dcfce7; color: #16a34a; }

/* Zona de carga drag-and-drop */
.dropzone {
  background-color: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone.dragover { border-color: #2563eb; background-color: #eff6ff; }
.dropzone.disabled { opacity: 0.55; pointer-events: none; }

/* Datagrid */
.datagrid { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.datagrid th {
  background-color: #f8fafc; text-align: left; font-weight: 600; color: #334155;
  padding: 0.6rem 0.75rem; border: 1px solid #e2e8f0; white-space: nowrap;
}
.datagrid td {
  padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; color: #0f172a; cursor: text;
}
.datagrid td:hover { background-color: #f8fafc; }
.datagrid td input { width: 100%; border: none; outline: none; font-size: 0.875rem; background: transparent; }

/* Tabla de resultados: columnas con ancho ajustable por el usuario */
#grid.datagrid { table-layout: fixed; }
#grid.datagrid th {
  position: relative;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1rem;
}
#grid.datagrid td {
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}
#grid .col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}
#grid .col-resizer:hover,
#grid .col-resizer:active {
  background-color: #93c5fd;
}

/* Celda cuyo contenido no correspondía al tipo de la columna: se exporta vacía,
   pero se resalta para que el operador la revise antes de descargar. */
#grid td.cell-review {
  background-color: #fffbeb;
  box-shadow: inset 3px 0 0 #f59e0b;
}
#grid td.cell-review:hover {
  background-color: #fef3c7;
}
.review-mark {
  color: #b45309;
  font-size: 0.8rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 100%;
}

/* Toast. El color va por clase, no por atributo style, para que la CSP pueda
   prohibir los estilos en línea (el HTML del toast se inyecta con innerHTML). */
.toast-box {
  padding: 0.75rem 1rem; border-radius: 8px; color: #fff; font-size: 0.875rem;
  font-weight: 500; box-shadow: 0 10px 25px rgba(15,23,42,0.18); max-width: 360px;
}
.toast-success { background-color: #16a34a; }
.toast-error   { background-color: #dc2626; }
.toast-info    { background-color: #2563eb; }
