/* ════════════════════════════════════════════════════════════════════════
   e-force · Control de Usuarios — Hoja de estilos
   Diseño limpio, moderno y responsivo. Sin frameworks externos.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --text:          #0f172a;
  --text-soft:     #475569;
  --text-mute:     #94a3b8;
  --border:        #e2e8f0;
  --primary:       #4f46e5;
  --primary-dark:  #4338ca;
  --success:       #059669;
  --danger:        #dc2626;
  --danger-soft:   #fef2f2;
  --focus:         #6366f1;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #1d4ed8 0%, #7c3aed 100%);
  color: #fff;
  padding: 36px 20px;
  text-align: center;
}
.hero__title    { font-size: 2rem; font-weight: 700; letter-spacing: .5px; }
.hero__subtitle { margin-top: 4px; color: #dbeafe; font-size: .95rem; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card__title { font-size: 1.15rem; margin-bottom: 18px; color: var(--text); }
.card__head  { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.card__head .card__title { margin-bottom: 0; }

/* ── Form grid ────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }

label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.req  { color: var(--danger); }

input, textarea, select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
input.invalid, textarea.invalid { border-color: var(--danger); background: var(--danger-soft); }

textarea { resize: vertical; }

.field__error { color: var(--danger); font-size: .75rem; min-height: 1em; }

/* ── Radio group + label de bloque ────────────────────────────────────── */
.label-block { font-size: .85rem; font-weight: 600; color: var(--text-soft); display: block; margin-bottom: 6px; }
.radio-group { display: flex; gap: 18px; align-items: center; padding: 10px 0; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer; }
.radio input { width: auto; cursor: pointer; }

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .05s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn--success { background: var(--success); color: #fff; }
.btn--success:hover:not(:disabled) { background: #047857; }

.btn--ghost { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn--ghost:hover { background: #f8fafc; }

.btn--danger-sm {
  background: var(--danger-soft); color: var(--danger);
  border-color: #fecaca; padding: 6px 10px; font-size: .8rem;
}
.btn--danger-sm:hover { background: #fee2e2; }

/* ── Tabla de usuarios ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.users-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.users-table th, .users-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: .85rem; vertical-align: middle; }
.users-table thead th { background: #f8fafc; color: var(--text-soft); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.users-table tbody tr:hover { background: #fafbff; }
.users-table input, .users-table select { padding: 7px 9px; font-size: .85rem; }
.users-table select { min-width: 110px; }
.col-tipo, .col-tipo-doc { width: 130px; }
.col-accion { width: 84px; text-align: center; }
.row-num { text-align: center; color: var(--text-mute); font-weight: 600; }
.row-empty td { padding: 24px; text-align: center; color: var(--text-mute); }

.counter { margin-top: 12px; font-size: .85rem; color: var(--text-soft); font-weight: 600; }

/* ── Acciones del formulario ──────────────────────────────────────────── */
.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* ── Alerta global ────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
  font-size: .9rem; display: flex; gap: 10px; align-items: center;
}
.alert--error   { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.alert--success { background: #ecfdf5; color: var(--success); border: 1px solid #a7f3d0; }
.alert--hidden  { display: none; }

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 100; }
.modal[aria-hidden="false"] { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); }
.modal__dialog {
  position: relative; background: #fff; border-radius: var(--radius);
  padding: 32px; max-width: 420px; width: calc(100% - 32px); text-align: center;
  box-shadow: var(--shadow); animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal__icon {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--success); color: #fff; font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
}
.modal__dialog h3 { margin-bottom: 8px; }
.modal__dialog p  { color: var(--text-soft); margin-bottom: 20px; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 20px; color: var(--text-mute); font-size: .8rem; }

/* ── Spinner en botón ─────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .hero__title { font-size: 1.6rem; }
  .actions { flex-direction: column-reverse; }
  .actions .btn { width: 100%; justify-content: center; }
}
