/* NexForge shared UI layer: loaded after the theme so every module gets the same look. */

:root {
  --nf-primary: #601ae9;
  --nf-primary-hover: #4d15c7;
  --nf-primary-soft: #f1ebfe;
  --nf-primary-ring: rgba(96, 26, 233, .14);
  --nf-text: #2f2b3d;
  --nf-muted: #6f6b7d;
  --nf-border: #e8e6ef;
  --nf-surface-alt: #f8f7fc;
  --nf-radius: .75rem;
  --nf-menu-width: 16.25rem;
  --nf-menu-collapsed-width: 5.25rem;
}

/* ---------------------------------------------------------------------------
 * Page progress bar, button loading state, focus ring
 * ------------------------------------------------------------------------- */
#nf-page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 20000;
  background: linear-gradient(90deg, var(--nf-primary), #a78bfa);
  box-shadow: 0 0 8px rgba(96, 26, 233, .5);
  opacity: 0;
  transition: width .25s ease, opacity .3s ease;
  pointer-events: none;
}
#nf-page-progress.is-active { opacity: 1; }
.nf-btn-loading { position: relative; pointer-events: none; opacity: .85; }
.nf-btn-loading .nf-btn-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: .4em;
  vertical-align: -0.15em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nf-spin .7s linear infinite;
}
@keyframes nf-spin { to { transform: rotate(360deg); } }
.table-responsive { -webkit-overflow-scrolling: touch; }
:focus-visible { outline: 2px solid rgba(96, 26, 233, .55); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
 * Collapsible sidebar (desktop): icon rail when collapsed, expands while hovered (nf-menu-peek)
 * ------------------------------------------------------------------------- */
.nf-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: .625rem;
  border: 1px solid var(--nf-border);
  background: #fff;
  color: var(--nf-text);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.nf-sidebar-toggle:hover,
.nf-sidebar-toggle:focus-visible {
  background: var(--nf-primary-soft);
  border-color: #d8c8fb;
  color: var(--nf-primary);
}
.nf-sidebar-toggle i { font-size: 1.375rem; transition: transform .25s ease; }

.nf-sidebar-pin {
  position: absolute;
  top: 50%;
  right: .75rem;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid var(--nf-border);
  background: #fff;
  color: var(--nf-muted);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: color .2s ease, background .2s ease, transform .25s ease;
}
.nf-sidebar-pin:hover { color: var(--nf-primary); background: var(--nf-primary-soft); }
.nf-sidebar-pin i { font-size: 1.125rem; }

.nf-brand-mini {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .625rem;
  background: linear-gradient(135deg, #7c3aed, var(--nf-primary));
  color: #fff;
  font-weight: 800;
  font-size: 1.125rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -6px rgba(96, 26, 233, .6);
}

#layout-menu .app-brand { position: relative; }
#layout-menu .menu-inner > .menu-item > .menu-link > div { white-space: nowrap; }

@media (min-width: 1200px) {
  #layout-menu,
  .layout-menu-fixed .layout-page {
    transition: width .22s ease, padding-left .22s ease, box-shadow .22s ease;
  }
  html.nf-no-transition #layout-menu,
  html.nf-no-transition .layout-page { transition: none !important; }

  html.nf-menu-collapsed #layout-menu { width: var(--nf-menu-collapsed-width) !important; overflow: hidden; }
  html.nf-menu-collapsed.layout-menu-fixed .layout-page { padding-left: var(--nf-menu-collapsed-width) !important; }
  html.nf-menu-collapsed .nf-sidebar-toggle i { transform: rotate(180deg); }
  html.nf-menu-collapsed .nf-sidebar-pin i { transform: rotate(180deg); }

  html.nf-menu-collapsed.nf-menu-peek #layout-menu {
    width: var(--nf-menu-width) !important;
    box-shadow: 0 0 40px -10px rgba(47, 43, 61, .35);
    transition-delay: .12s;
  }

  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .app-brand-logo,
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .nf-sidebar-pin { display: none !important; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .nf-brand-mini { display: inline-flex; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .app-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .app-brand-link { margin: 0 auto; }

  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-header { visibility: hidden; height: .5rem; padding: 0; margin: 0; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item {
    width: calc(var(--nf-menu-collapsed-width) - 1.5rem) !important;
    margin-left: .75rem !important;
    margin-right: .75rem !important;
  }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-link > div,
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-link > .badge { display: none; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-link .menu-icon { margin-right: 0; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-toggle::after { display: none; }
  html.nf-menu-collapsed:not(.nf-menu-peek) #layout-menu .menu-inner > .menu-item > .menu-sub { display: none !important; }
}

@media (max-width: 1199.98px) {
  .nf-sidebar-pin { display: none !important; }
}

/* ---------------------------------------------------------------------------
 * Sidebar polish
 * ------------------------------------------------------------------------- */
#layout-menu .menu-inner > .menu-item > .menu-link { border-radius: .625rem; }
#layout-menu .menu-inner > .menu-item.active > .menu-link:not(.menu-toggle) {
  background: linear-gradient(72deg, var(--nf-primary) 22%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(96, 26, 233, .7);
}
#layout-menu .menu-inner > .menu-item.active > .menu-link:not(.menu-toggle) .menu-icon { color: #fff; }
#layout-menu .menu-inner > .menu-item.active::before { display: none; }
#layout-menu .menu-sub > .menu-item.active > .menu-link { color: var(--nf-primary); font-weight: 600; }

/* ---------------------------------------------------------------------------
 * Page header (x-module-hero): compact and consistent across modules
 * ------------------------------------------------------------------------- */
.layout-page .module-hero {
  background: linear-gradient(120deg, #ffffff 0%, #f4eefe 55%, #e4d6fc 100%);
  border: 1px solid #ebe3fb;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px -18px rgba(96, 26, 233, .45);
}
.layout-page .module-hero::before,
.layout-page .module-hero::after { opacity: .35; }
.layout-page .module-hero-content { gap: 1rem; }
.layout-page .module-hero-title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--nf-text);
}
.layout-page .module-hero-title i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  border-radius: .75rem;
  background: #fff;
  color: var(--nf-primary);
  font-size: 1.375rem;
  box-shadow: 0 4px 12px -6px rgba(96, 26, 233, .45);
}
.layout-page .module-hero-subtitle { color: var(--nf-muted); font-size: .875rem; margin: .35rem 0 0; }
.layout-page .module-action-btn,
.layout-page .module-action-btn-secondary { padding: .6rem 1.25rem; font-size: .875rem; }
.layout-page .module-action-btn:hover,
.layout-page .module-action-btn-secondary:hover,
.layout-page .module-action-btn-outline:hover { transform: none; }
.layout-page .module-action-btn-outline { padding: .4rem .9rem; font-size: .8125rem; }

@media (max-width: 767.98px) {
  .layout-page .module-hero { padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
  .layout-page .module-hero-title { font-size: 1.15rem; }
  .layout-page .module-hero-title i { width: 2.125rem; height: 2.125rem; font-size: 1.15rem; }
  .layout-page .module-hero-actions { width: 100%; }
  .layout-page .module-hero-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* ---------------------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------------------- */
.content-wrapper .card {
  border: 1px solid var(--nf-border);
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(47, 43, 61, .04), 0 6px 20px -12px rgba(47, 43, 61, .12);
}
.content-wrapper .card > .card-header {
  background: transparent;
  border-bottom: 1px solid var(--nf-border);
  padding: 1rem 1.5rem;
}
.content-wrapper .card > .card-header .card-title,
.content-wrapper .card > .card-header h5 { margin-bottom: 0; font-weight: 600; }

/* ---------------------------------------------------------------------------
 * Tables & listings
 * ------------------------------------------------------------------------- */
.content-wrapper .table { --bs-table-hover-bg: rgba(96, 26, 233, .035); margin-bottom: 0; }
.content-wrapper .table > thead > tr > th {
  background: var(--nf-surface-alt);
  color: #5d596c;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--nf-border);
  padding-top: .8rem;
  padding-bottom: .8rem;
  white-space: nowrap;
  vertical-align: middle;
}
.content-wrapper .table > thead > tr > th:first-child { border-top-left-radius: .625rem; }
.content-wrapper .table > thead > tr > th:last-child { border-top-right-radius: .625rem; }
.content-wrapper .table > tbody > tr > td {
  padding-top: .8rem;
  padding-bottom: .8rem;
  vertical-align: middle;
  border-color: #f1f0f5;
}
.content-wrapper .table > tbody > tr { transition: background-color .15s ease; }
.content-wrapper .table > tbody > tr > td[colspan] {
  padding: 2.5rem 1rem;
  color: var(--nf-muted);
  text-align: center;
}
.content-wrapper .table a:not(.btn):not(.dropdown-item):not(.module-action-btn-outline) { font-weight: 500; }

.content-wrapper .table-responsive {
  border-radius: .75rem;
  scrollbar-width: thin;
  scrollbar-color: #d6d3e0 transparent;
}
.content-wrapper .table-responsive::-webkit-scrollbar { height: 8px; }
.content-wrapper .table-responsive::-webkit-scrollbar-thumb { background: #d6d3e0; border-radius: 8px; }

/* Row action dropdowns */
.content-wrapper .table .dropdown-menu { border-radius: .75rem; overflow: hidden; padding-top: 0; }
.content-wrapper .table .dropdown-menu .dropdown-header { border-radius: 0; }
.content-wrapper .dropdown-item h6 { font-size: .8125rem; }

/* Pagination (Laravel + Bootstrap) */
.pagination { gap: .25rem; flex-wrap: wrap; }
.pagination .page-link {
  border-radius: .5rem !important;
  border: 1px solid var(--nf-border);
  color: var(--nf-text);
  min-width: 2.25rem;
  text-align: center;
}
.pagination .page-item.active .page-link {
  background: var(--nf-primary);
  border-color: var(--nf-primary);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(96, 26, 233, .6);
}
.pagination .page-link:hover { background: var(--nf-primary-soft); color: var(--nf-primary); }

/* DataTables */
.dataTables_wrapper { padding-top: .25rem; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid #d9dee3;
  border-radius: .5rem;
  padding: .45rem .75rem;
  background-color: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.dataTables_wrapper .dataTables_filter input { min-width: 220px; margin-left: .5rem; }
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--nf-primary);
  box-shadow: 0 0 0 .2rem var(--nf-primary-ring);
}
.dataTables_wrapper .dataTables_info { color: var(--nf-muted); font-size: .8125rem; padding-top: 1rem !important; }
.dataTables_wrapper .dataTables_paginate { padding-top: .75rem !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: .5rem !important;
  border: 1px solid var(--nf-border) !important;
  background: #fff !important;
  color: var(--nf-text) !important;
  margin-left: .25rem !important;
  padding: .35rem .75rem !important;
  min-width: 2.25rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
  background: var(--nf-primary-soft) !important;
  color: var(--nf-primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--nf-primary) !important;
  border-color: var(--nf-primary) !important;
  color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled { opacity: .45; }
table.dataTable.no-footer { border-bottom: 1px solid var(--nf-border) !important; }
table.dataTable thead th, table.dataTable thead td { border-bottom: 1px solid var(--nf-border) !important; }
.dataTables_wrapper .dataTables_processing {
  background: #fff !important;
  border: 1px solid var(--nf-border);
  border-radius: .75rem;
  box-shadow: 0 10px 30px -12px rgba(47, 43, 61, .3);
  color: var(--nf-primary);
  font-weight: 600;
  padding: .9rem 1rem !important;
}
@media (max-width: 767.98px) {
  .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; margin-left: 0; }
  .dataTables_wrapper .dataTables_filter label { width: 100%; }
}

/* ---------------------------------------------------------------------------
 * Forms (create / edit)
 * ------------------------------------------------------------------------- */
.content-wrapper .form-label,
.modal .form-label {
  font-size: .8125rem;
  font-weight: 600;
  color: #444050;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: .4rem;
}
.nf-required { color: #ea5455; margin-left: .15rem; font-weight: 700; }

.content-wrapper .form-control,
.content-wrapper .form-select,
.modal .form-control,
.modal .form-select {
  border-radius: .5rem;
  border-color: #d9dee3;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.content-wrapper .form-control:not(.form-control-sm):not(.form-control-lg):not(textarea),
.content-wrapper .form-select:not(.form-select-sm):not(.form-select-lg),
.modal .form-control:not(.form-control-sm):not(.form-control-lg):not(textarea),
.modal .form-select:not(.form-select-sm):not(.form-select-lg) { min-height: 2.625rem; }
.form-control:focus,
.form-select:focus {
  border-color: var(--nf-primary) !important;
  box-shadow: 0 0 0 .2rem var(--nf-primary-ring) !important;
}
.form-control::placeholder { color: #a8aab8; }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: #f6f6f9; }
.form-control.is-invalid, .form-select.is-invalid { border-color: #ea5455 !important; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 .2rem rgba(234, 84, 85, .14) !important; }
.content-wrapper form small.text-danger,
.content-wrapper form span.text-danger:not(.nf-required) { display: inline-block; margin-top: .25rem; font-size: .78rem; }
.form-check-input:checked { background-color: var(--nf-primary); border-color: var(--nf-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--nf-primary-ring); }

/* Section headings inside forms */
.content-wrapper .card form h5:not(.modal-title),
.content-wrapper .card form h6 {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--nf-text);
  font-weight: 600;
}
.content-wrapper .card form h6::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--nf-border);
}

/* Select2 aligned with Bootstrap inputs */
.select2-container--default .select2-selection--single {
  height: 2.625rem;
  border: 1px solid #d9dee3;
  border-radius: .5rem;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 2.5rem; padding-left: .875rem; color: var(--nf-text); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 2.5rem; right: .4rem; }
.select2-container--default .select2-selection--multiple { min-height: 2.625rem; border: 1px solid #d9dee3; border-radius: .5rem; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--nf-primary);
  box-shadow: 0 0 0 .2rem var(--nf-primary-ring);
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--nf-primary-soft);
  border: 1px solid #ddd0fb;
  color: var(--nf-primary);
  border-radius: .4rem;
}
.select2-dropdown { border-color: #d9dee3; border-radius: .5rem; overflow: hidden; box-shadow: 0 10px 30px -12px rgba(47, 43, 61, .3); }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--nf-primary); }

/* ---------------------------------------------------------------------------
 * Buttons, badges, alerts, modals
 * ------------------------------------------------------------------------- */
.btn { border-radius: .5rem; font-weight: 500; }
.btn-sm { border-radius: .4rem; }
.btn-primary { box-shadow: 0 4px 12px -6px rgba(96, 26, 233, .7); }

.badge { font-weight: 600; letter-spacing: .02em; border-radius: .45rem; padding: .4em .7em; }

.content-wrapper .alert {
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: .75rem;
  padding: .85rem 1rem;
}
.content-wrapper .alert-success { border-color: #b8ecd0; border-left-color: #28c76f; }
.content-wrapper .alert-danger { border-color: #f8c9c9; border-left-color: #ea5455; }
.content-wrapper .alert-warning { border-color: #fde3bd; border-left-color: #ff9f43; }
.content-wrapper .alert-info { border-color: #bfeef6; border-left-color: #00bad1; }
.content-wrapper .alert .nf-alert-icon { font-size: 1.15rem; vertical-align: -0.2em; margin-right: .4rem; }
.alert.nf-fade-out { transition: opacity .4s ease, transform .4s ease; opacity: 0; transform: translateY(-6px); }

.modal-content { border: none; border-radius: 1rem; box-shadow: 0 24px 60px -20px rgba(47, 43, 61, .45); }
.modal-header { border-bottom: 1px solid var(--nf-border); padding: 1rem 1.5rem; }
.modal-footer { border-top: 1px solid var(--nf-border); }

/* ---------------------------------------------------------------------------
 * Empty states (DataTables + plain tables)
 * ------------------------------------------------------------------------- */
.nf-empty { padding: 1.75rem 1rem; text-align: center; color: var(--nf-muted); }
.nf-empty i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: var(--nf-primary-soft);
  color: var(--nf-primary);
  font-size: 1.6rem;
  margin-bottom: .6rem;
}
.nf-empty-title { font-weight: 600; color: var(--nf-text); }
.nf-empty-hint { font-size: .8125rem; margin-top: .15rem; }
.dataTables_wrapper .dataTables_paginate .paginate_button i { font-size: 1rem; vertical-align: -0.15em; }
.dataTables_wrapper .dataTables_processing .nf-btn-loading { opacity: 1; }

/* Detail pages: label/value tables read better without heavy borders */
.content-wrapper .card-body > .table-bordered th { width: 28%; background: var(--nf-surface-alt); color: #5d596c; font-weight: 600; }
.content-wrapper .card-body > .table-bordered,
.content-wrapper .card-body > .table-bordered th,
.content-wrapper .card-body > .table-bordered td { border-color: var(--nf-border); }

/* Hero subtitle shouldn't stretch the header on long names */
.layout-page .module-hero-subtitle { max-width: 60ch; overflow: hidden; text-overflow: ellipsis; }

/* Leave balance cards & stat cards: gentle lift on hover */
.leave-type-card, .clr-stat { transition: transform .15s ease, box-shadow .15s ease; }
.leave-type-card:hover, .clr-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -16px rgba(96, 26, 233, .45); }

/* ---------------------------------------------------------------------------
 * Back to top
 * ------------------------------------------------------------------------- */
#nf-back-to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: none;
  background: var(--nf-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px -10px rgba(96, 26, 233, .8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 1080;
}
#nf-back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
body:has(#tsGlobalTimerBar:not(.d-none)) #nf-back-to-top { bottom: 5.75rem; }
@media (max-width: 575px) {
  body:has(#tsGlobalTimerBar:not(.d-none)) #nf-back-to-top { bottom: 8.5rem; }
}
#nf-back-to-top i { font-size: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
  #layout-menu, .layout-page, .nf-sidebar-toggle i, #nf-back-to-top { transition: none !important; }
}
