/* ==========================================================================
   PayrollHR — HR & Payroll SaaS
   Custom layer on top of Bootstrap 5.3. Keep this file small: Bootstrap
   utilities should do most of the work.
   ========================================================================== */

:root {
  --hr-primary: #1d4ed8;
  --hr-primary-dark: #1739a8;
  --hr-primary-soft: #eef2ff;
  --hr-ink: #0f172a;
  --hr-muted: #64748b;
  --hr-line: #e6eaf1;
  --hr-surface: #f6f8fb;
  --hr-sidebar-w: 264px;
  --hr-topbar-h: 62px;
  --hr-radius: 14px;
  --hr-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
}

/* Bootstrap theme overrides -------------------------------------------------- */
body {
  padding-top: var(--hr-topbar-h);
  --bs-primary: var(--hr-primary);
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: var(--hr-primary);
  --bs-link-hover-color: var(--hr-primary-dark);
  --bs-body-color: var(--hr-ink);
  --bs-body-bg: var(--hr-surface);
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --bs-border-color: var(--hr-line);
  font-size: .9375rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.btn-primary {
  --bs-btn-bg: var(--hr-primary);
  --bs-btn-border-color: var(--hr-primary);
  --bs-btn-hover-bg: var(--hr-primary-dark);
  --bs-btn-hover-border-color: var(--hr-primary-dark);
  --bs-btn-active-bg: var(--hr-primary-dark);
  --bs-btn-active-border-color: var(--hr-primary-dark);
  --bs-btn-disabled-bg: var(--hr-primary);
  --bs-btn-disabled-border-color: var(--hr-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--hr-primary);
  --bs-btn-border-color: #c7d4f7;
  --bs-btn-hover-bg: var(--hr-primary);
  --bs-btn-hover-border-color: var(--hr-primary);
  --bs-btn-active-bg: var(--hr-primary-dark);
}

.text-primary { color: var(--hr-primary) !important; }
.bg-primary { background-color: var(--hr-primary) !important; }
.bg-primary-soft { background-color: var(--hr-primary-soft) !important; }
.form-control:focus, .form-select:focus, .form-check-input:focus, .btn:focus-visible {
  border-color: #9fb6f0;
  box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .15);
}
.form-check-input:checked { background-color: var(--hr-primary); border-color: var(--hr-primary); }

/* Typography ---------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6, .fw-display { letter-spacing: -.015em; font-weight: 650; }
.page-title { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); margin: 0; }
.text-muted { color: var(--hr-muted) !important; }
.text-xs { font-size: .75rem; }
.text-sm { font-size: .8125rem; }
.tracking-wide { letter-spacing: .06em; }
.num { font-variant-numeric: tabular-nums; }

/* App shell ----------------------------------------------------------------- */
.hr-topbar {
  height: var(--hr-topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--hr-line);
  z-index: 1035;
}

.hr-sidebar {
  position: fixed;
  top: var(--hr-topbar-h);
  bottom: 0;
  left: 0;
  width: var(--hr-sidebar-w);
  background: #fff;
  border-right: 1px solid var(--hr-line);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1030;
}

.hr-main {
  padding: 1.25rem 1rem 3rem;
  min-height: calc(100vh - var(--hr-topbar-h));
}

@media (min-width: 992px) {
  .hr-main { margin-left: var(--hr-sidebar-w); padding: 1.5rem 1.75rem 4rem; }
}

/* Sidebar navigation -------------------------------------------------------- */
.hr-nav { padding: .875rem .75rem 2rem; }
.hr-nav .nav-section {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 1rem .625rem .375rem;
}
.hr-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  min-height: 42px;
  padding: .5rem .625rem;
  border-radius: 10px;
  color: #334155;
  font-weight: 500;
  line-height: 1.25;
}
.hr-nav .nav-link i { font-size: 1.05rem; color: #94a3b8; flex: 0 0 auto; }
.hr-nav .nav-link:hover { background: #f1f5f9; color: var(--hr-ink); }
.hr-nav .nav-link.active { background: var(--hr-primary-soft); color: var(--hr-primary-dark); font-weight: 600; }
.hr-nav .nav-link.active i { color: var(--hr-primary); }
.hr-nav .nav-link[data-bs-toggle="collapse"]::after {
  content: "\F282";
  font-family: bootstrap-icons;
  margin-left: auto;
  font-size: .7rem;
  color: #cbd5e1;
  transition: transform .18s ease;
}
.hr-nav .nav-link[aria-expanded="true"]::after { transform: rotate(180deg); }
.hr-nav .nav-sub { margin: .125rem 0 .25rem 1.6rem; border-left: 1px solid var(--hr-line); padding-left: .5rem; }
.hr-nav .nav-sub .nav-link { min-height: 38px; font-size: .875rem; }

/* Cards --------------------------------------------------------------------- */
.card {
  border-color: var(--hr-line);
  border-radius: var(--hr-radius);
  box-shadow: var(--hr-shadow);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--hr-line);
  padding: 1rem 1.125rem;
  border-radius: var(--hr-radius) var(--hr-radius) 0 0 !important;
}

.stat-card .stat-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 1.15rem;
  flex: 0 0 auto;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }

.hover-lift { transition: transform .18s ease, box-shadow .18s ease; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -16px rgba(15, 23, 42, .3); }

/* Tables -------------------------------------------------------------------- */
/*.table-responsive {
  overflow: unset;
}*/
.table-wrap { border-radius: 0 0 var(--hr-radius) var(--hr-radius); }
.table { --bs-table-hover-bg: #f8fafc; margin-bottom: 0; }
.table > thead th {
  background: #fbfcfe;
  border-bottom: 1px solid var(--hr-line);
  color: var(--hr-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: .75rem 1rem;
}
.table > tbody td { padding: .8125rem 1rem; vertical-align: middle; border-color: #f1f5f9; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable::after { content: "\F282"; font-family: bootstrap-icons; font-size: .6rem; margin-left: .35rem; opacity: .35; }
.table th.sortable.asc::after { content: "\F286"; opacity: 1; color: var(--hr-primary); }
.table th.sortable.desc::after { content: "\F282"; opacity: 1; color: var(--hr-primary); }
.table-nowrap td, .table-nowrap th { white-space: nowrap; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--hr-primary-soft);
  color: var(--hr-primary-dark);
  font-size: .75rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.avatar-lg { width: 76px; height: 76px; font-size: 1.5rem; }

.badge { font-weight: 600; letter-spacing: .01em; padding: .4em .65em; border-radius: 999px; }
.badge-soft-success { background: #e8f7ef; color: #157347; }
.badge-soft-warning { background: #fff5e6; color: #a35c00; }
.badge-soft-danger  { background: #fdecec; color: #b02a37; }
.badge-soft-info    { background: #e7f3fb; color: #0a6c8f; }
.badge-soft-primary { background: var(--hr-primary-soft); color: var(--hr-primary-dark); }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }

/* Charts (pure CSS placeholders, no chart library) --------------------------- */
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; }
.chart-bars .bar { flex: 1 1 0; background: linear-gradient(180deg, #3b6ce0, var(--hr-primary)); border-radius: 6px 6px 3px 3px; min-width: 8px; }
.chart-bars .bar.muted { background: #dde5f5; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.donut {
  width: 148px; height: 148px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--hr-primary) 0 62%, #60a5fa 62% 80%, #a5b4fc 80% 92%, #e2e8f3 92% 100%);
}
.donut::after {
  content: ""; position: absolute; width: 96px; height: 96px; border-radius: 50%; background: #fff;
}
.donut > * { position: relative; z-index: 1; text-align: center; }

/* Timeline / activity ------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 1.1rem 1.75rem; }
.timeline > li::before {
  content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--hr-primary); box-shadow: 0 0 0 3px var(--hr-primary-soft);
}
.timeline > li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--hr-line); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li:last-child::after { display: none; }

/* Misc ---------------------------------------------------------------------- */
.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state i { font-size: 2.25rem; color: #cbd5e1; }
.required::after { content: " *"; color: #dc3545; font-weight: 700; }
.filter-bar { background: #fbfcfe; border-bottom: 1px solid var(--hr-line); padding: .875rem 1.125rem; }
.payslip-table td { padding: .45rem .25rem; }
.cal-cell { min-height: 74px; border: 1px solid var(--hr-line); border-radius: 10px; padding: .4rem .5rem; }
.cal-cell.muted { background: #fbfcfe; color: #cbd5e1; }
.scroll-y-320 { max-height: 320px; overflow-y: auto; }

/* Touch targets on small screens */
@media (max-width: 575.98px) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .form-control, .form-select { min-height: 44px; }
  .page-header-actions .btn { flex: 1 1 auto; }
}

@media print {
  .hr-topbar, .hr-sidebar, .no-print { display: none !important; }
  .hr-main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: none; }
}

.pagination-sm .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  font-size: .75rem;
}