/* ============================================================
   SistemaRH GT — Hoja de estilos principal
   ============================================================ */

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

:root {
  --c-primary:   #1a5276;
  --c-primary-d: #154360;
  --c-primary-l: #2e86c1;
  --c-accent:    #27ae60;
  --c-accent-d:  #1e8449;
  --c-danger:    #e74c3c;
  --c-warning:   #f39c12;
  --c-info:      #2980b9;
  --c-text:      #2c3e50;
  --c-muted:     #7f8c8d;
  --c-border:    #d5d8dc;
  --c-bg:        #f4f6f8;
  --c-white:     #ffffff;
  --c-sidebar:   #1a2744;
  --c-sidebar-d: #111c36;
  --c-sidebar-l: #243358;
  --sidebar-w:   260px;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 2px 8px rgba(0,0,0,.09);
  --shadow-md:   0 4px 16px rgba(0,0,0,.12);
  --transition:  .2s ease;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 15px; color: var(--c-text); background: var(--c-bg); display: flex; min-height: 100vh; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 17px; font-weight: 700; }
.logo i { color: #5dade2; font-size: 22px; }
.empresa-badge { margin-top: 8px; font-size: 11px; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Nav con scroll */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.3) rgba(255,255,255,.05);
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: rgba(255,255,255,.04); }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.5); }

/* ── Secciones colapsables ── */
.nav-section { margin-bottom: 2px; }

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 5px 18px;
  cursor: pointer;
  user-select: none;
}
.nav-section-header:hover { background: rgba(255,255,255,.04); }

.nav-label {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.38);
  transition: color .15s;
}
.nav-section-header:hover .nav-label { color: rgba(255,255,255,.65); }

.nav-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.3);
  font-size: 10px;
  padding: 2px 5px;
  line-height: 1;
  transition: transform .22s ease, color .15s;
}
.nav-toggle:hover { color: rgba(255,255,255,.7); }
.nav-section.collapsed .nav-toggle { transform: rotate(-90deg); }

.nav-section-body {
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transition: max-height .28s ease, opacity .22s ease;
}
.nav-section.collapsed .nav-section-body {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; color: rgba(255,255,255,.72); text-decoration: none;
  font-size: 14px; transition: all var(--transition); border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(93,173,226,.15); color: #5dade2; border-left-color: #5dade2; }
.nav-item i { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--c-primary-l); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-name { font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.45); }
.btn-logout { color: rgba(255,255,255,.4); text-decoration: none; font-size: 16px; transition: color var(--transition); }
.btn-logout:hover { color: var(--c-danger); }

/* ── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.top-bar { background: var(--c-white); border-bottom: 1px solid var(--c-border); padding: 0 24px; height: 58px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.sidebar-toggle { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--c-muted); display: none; }
.breadcrumb { flex: 1; font-size: 14px; color: var(--c-muted); }
.breadcrumb a { color: var(--c-primary); text-decoration: none; }
.top-actions { display: flex; gap: 8px; }
.main-content { flex: 1; padding: 28px 28px 40px; }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--c-text); }
.page-header p { color: var(--c-muted); font-size: 14px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 20px; padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 16px; font-weight: 700; }
.card-body { padding: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.blue   { background: #ebf5fb; color: #2e86c1; }
.stat-icon.green  { background: #eafaf1; color: #27ae60; }
.stat-icon.orange { background: #fef9e7; color: #f39c12; }
.stat-icon.red    { background: #fdedec; color: #e74c3c; }
.stat-icon.purple { background: #f4ecf7; color: #8e44ad; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--c-text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--c-muted); margin-top: 3px; }

/* ── TABLES ───────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { background: #f8f9fa; font-weight: 600; color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; border-bottom: 2px solid var(--c-border); text-align: left; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #ecf0f1; vertical-align: middle; }
.table tr:hover td { background: #f8f9fa; }
.table tr:last-child td { border-bottom: none; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: #555; }
.required::after { content: ' *'; color: var(--c-danger); }
.form-control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], input[type="file"],
select, textarea {
  border: 1px solid var(--c-border); border-radius: var(--radius); padding: 9px 12px;
  font-size: 14px; color: var(--c-text); background: var(--c-white);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-primary-l); box-shadow: 0 0 0 3px rgba(46,134,193,.15);
}
textarea { min-height: 80px; resize: vertical; }
.form-section { padding: 20px 0 0; margin-bottom: 4px; }
.form-section-title { font-size: 14px; font-weight: 700; color: var(--c-primary); text-transform: uppercase; letter-spacing: .5px; padding-bottom: 10px; border-bottom: 2px solid var(--c-border); margin-bottom: 18px; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none; transition: all var(--transition); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary   { background: var(--c-primary); color: #fff; }
.btn-primary:hover   { background: var(--c-primary-d); }
.btn-success   { background: var(--c-accent); color: #fff; }
.btn-success:hover   { background: var(--c-accent-d); }
.btn-danger    { background: var(--c-danger); color: #fff; }
.btn-danger:hover    { background: #c0392b; }
.btn-warning   { background: var(--c-warning); color: #fff; }
.btn-secondary { background: #ecf0f1; color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: #d5d8dc; }
.btn-outline   { background: transparent; color: var(--c-primary); border: 1.5px solid var(--c-primary); }
.btn-outline:hover   { background: var(--c-primary); color: #fff; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success  { background: #eafaf1; color: #1e8449; }
.badge-danger   { background: #fdedec; color: #c0392b; }
.badge-warning  { background: #fef9e7; color: #b7770d; }
.badge-info     { background: #ebf5fb; color: #1a5276; }
.badge-secondary{ background: #f2f3f4; color: var(--c-muted); }
.badge-primary  { background: #ebf5fb; color: #1a5276; }
.badge-purple   { background: #f4ecf7; color: #7d3c98; }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert { padding: 13px 18px; border-radius: var(--radius); margin-bottom: 18px; display: flex; align-items: center; gap: 10px; font-size: 14px; border-left: 4px solid; position: relative; }
.alert-success { background: #eafaf1; border-color: var(--c-accent); color: #1e8449; }
.alert-danger  { background: #fdedec; border-color: var(--c-danger);  color: #922b21; }
.alert-warning { background: #fef9e7; border-color: var(--c-warning); color: #784212; }
.alert-info    { background: #ebf5fb; border-color: var(--c-info);    color: #1a5276; }
.alert-dismissible button { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .5; }
.alert-dismissible button:hover { opacity: 1; }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px 0 0; }
.page-link { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--c-border); text-decoration: none; color: var(--c-text); font-size: 14px; transition: all var(--transition); }
.page-link:hover, .page-link.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--c-border); margin-bottom: 20px; }
.tab-link { padding: 10px 20px; text-decoration: none; color: var(--c-muted); font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); }
.tab-link:hover { color: var(--c-primary); }
.tab-link.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-btn { padding: 8px 16px; border: none; background: none; cursor: pointer; color: var(--c-muted); border-bottom: 2px solid transparent; font-size: 14px; font-weight: 600; margin-bottom: -2px; transition: all var(--transition); }
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* ── MODALS ───────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.48); z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal-content { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; padding: 0; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--c-muted); }
form { padding: 20px 22px; }

/* ── EMPLOYEE CARD ────────────────────────────────────────── */
.emp-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius-lg); border: 1px solid var(--c-border); background: var(--c-white); transition: box-shadow var(--transition); }
.emp-card:hover { box-shadow: var(--shadow-md); }
.emp-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--c-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }

/* ── SEARCH BAR ───────────────────────────────────────────── */
.search-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.search-bar input, .search-bar select { max-width: 220px; }

/* ── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .top-bar, .btn, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
  body { font-size: 13px; }
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .main-content { padding: 16px; }
}

/* ── LOGIN ────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a2744 0%, #1a5276 100%); }
.login-card { background: var(--c-white); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 40px; width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo i { font-size: 48px; color: var(--c-primary); }
.login-logo h1 { font-size: 22px; margin-top: 10px; }
.login-logo p { color: var(--c-muted); font-size: 13px; margin-top: 4px; }

/* ── TOOLTIPS ─────────────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: #2c3e50; color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 5px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 999; }
[data-tooltip]:hover::after { opacity: 1; }

/* ── TEXT UTILITIES ───────────────────────────────────────── */
.text-muted { color: var(--c-muted); }
.text-center { text-align: center; }
