/* =====================================================================
   IIT RRHH — Estilos principales
   ===================================================================== */

:root {
  --primary:       #0078d4;
  --primary-dark:  #005a9e;
  --primary-light: #e6f2fb;
  --success:       #107c10;
  --success-bg:    #dff6dd;
  --warning:       #797600;
  --warning-bg:    #fff4ce;
  --danger:        #c50f1f;
  --danger-bg:     #fde7e9;
  --info:          #0078d4;
  --info-bg:       #e6f2fb;
  --text:          #1b1b1b;
  --text-muted:    #605e5c;
  --text-light:    #a19f9d;
  --border:        #e1dfdd;
  --border-dark:   #c8c6c4;
  --bg:            #f3f2f1;
  --bg-card:       #ffffff;
  --bg-sidebar:    #1b1b1b;
  --sidebar-text:  #f3f2f1;
  --sidebar-hover: #2d2d2d;
  --sidebar-active:#0078d4;
  --radius:        6px;
  --radius-lg:     10px;
  --shadow:        0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:     0 4px 20px rgba(0,0,0,0.12);
  --transition:    all 0.18s ease;
  --sidebar-w:     220px;
  --topbar-h:      52px;
  --font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── LOGIN ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0078d4 0%, #005a9e 50%, #1b1b1b 100%);
}

.login-wrap { width: 100%; padding: 20px; }

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 400px;
  margin: 0 auto;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.logo-icon {
  width: 48px; height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
}

.logo-main { display: block; font-size: 16px; font-weight: 600; color: var(--text); }
.logo-sub  { display: block; font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-footer a { color: var(--primary); text-decoration: none; }

/* ── LAYOUT PRINCIPAL ──────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100dvh;
}

/* ── TOPBAR ────────────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: calc(var(--sidebar-w) - 20px);
}

.topbar-logo .logo-icon { width: 32px; height: 32px; font-size: 11px; border-radius: 4px; }
.topbar-logo .logo-main { font-size: 14px; color: var(--text); }

.topbar-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: 6px 12px 6px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.badge-empresa { background: #fde7e9; color: #c50f1f; }
.badge-admin   { background: #fff4ce; color: #797600; }
.badge-usuario { background: #e6f2fb; color: #0078d4; }
.badge-empleado{ background: #dff6dd; color: #107c10; }

.topbar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.topbar-name { font-size: 13px; color: var(--text-muted); }

/* ── SIDEBAR ───────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  padding: 12px 0;
  overflow-y: auto;
  height: calc(100dvh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
}

.nav-section {
  font-size: 10px;
  letter-spacing: .1em;
  color: #6e6e6e;
  padding: 12px 16px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: #c8c6c4;
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
  transition: var(--transition);
}

.nav-item:hover { background: var(--sidebar-hover); color: #fff; }

.nav-item.active {
  background: rgba(0,120,212,0.15);
  color: #5ea8f5;
  border-left-color: var(--sidebar-active);
}

.nav-item .nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ── MAIN CONTENT ──────────────────────────────────────────────────── */
.main-content {
  padding: 24px;
  overflow-y: auto;
  height: calc(100dvh - var(--topbar-h));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title { font-size: 20px; font-weight: 600; color: var(--text); }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── CARDS ─────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── MÉTRICAS ──────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.metric-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.metric-value { font-size: 26px; font-weight: 700; color: var(--text); }
.metric-sub   { font-size: 11px; color: var(--text-light); margin-top: 3px; }
.metric-bar   { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.metric-fill  { height: 100%; border-radius: 2px; transition: width .6s ease; }

/* ── FORMULARIOS ───────────────────────────────────────────────────── */
.field-group { margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field-label .required { color: var(--danger); margin-left: 2px; }

.field-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: var(--transition);
  font-family: var(--font);
}
.field-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,120,212,.15); }
.field-input:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }

select.field-input { cursor: pointer; }
textarea.field-input { resize: vertical; min-height: 80px; }

.input-wrap { position: relative; }
.input-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; color: var(--text-light);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }

/* ── BOTONES ───────────────────────────────────────────────────────── */
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f1bcbe;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
}

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #9fd89f;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
}

.btn-full { width: 100%; justify-content: center; padding: 10px; }
.btn-sm   { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px; }

/* ── TABLA ─────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead { background: var(--bg); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-light); }

/* ── BADGES ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-ok      { background: var(--success-bg); color: var(--success); }
.badge-warn    { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ── ALERTAS ───────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #f1bcbe; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #9fd89f; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #b3d6f5; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #f8e08e; }

/* ── WIZARD ────────────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  gap: 0;
}
.wz-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.wz-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid var(--border-dark);
  color: var(--text-muted);
  background: #fff;
  flex-shrink: 0;
}
.wz-step.active .wz-num { border-color: var(--primary); color: var(--primary); }
.wz-step.done .wz-num   { border-color: var(--success); background: var(--success); color: #fff; }
.wz-label { font-size: 12px; color: var(--text-muted); }
.wz-step.active .wz-label { color: var(--primary); font-weight: 600; }
.wz-step.done .wz-label   { color: var(--success); }
.wz-line { flex: 1; height: 1px; background: var(--border-dark); margin: 0 4px; }

/* ── FOTO PERFIL ───────────────────────────────────────────────────── */
.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
}
.photo-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.photo-preview {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-light);
  overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ── AVATAR ────────────────────────────────────────────────────────── */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

/* ── PAGINACIÓN ────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}
.page-btn:hover  { background: var(--primary-light); border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── MODAL ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body   { padding: 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: #fff;
}

/* ── TABS ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  gap: 2px;
}
.tab {
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: var(--transition);
}
.tab:hover  { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── UTILIDADES ────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── FOTO CELDA TABLA ──────────────────────────────────────────────── */
.cell-avatar { display: flex; align-items: center; gap: 10px; }
.cell-name   { font-weight: 500; }
.cell-sub    { font-size: 11px; color: var(--text-muted); }

/* ── RESPONSIVE ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
