
/* =========================================================
   ERP Modern UI/UX Advance | Pass 14
   - professional global loading
   - auth screen refinement (login/create account)
   - dropdown/select2 size parity with inputs
   - robust sales report filter side sheet visibility
========================================================= */

:root {
  --erp-loader-z: 20000;
  --erp-filter-z: 17000;
  --erp-auth-field-h: 52px;
}

/* ---------- Professional loader ---------- */
body.erp-modern-v2 #loading-image,
body.erp-modern-v2 #loading-overlay {
  display: none !important;
}

body.erp-loading-active {
  cursor: progress;
}

body.erp-loading-active .wrapper,
body.erp-loading-active .content-wrapper,
body.erp-loading-active .container-fluid,
body.erp-loading-active .erp-auth-card {
  user-select: none;
}

#erp-global-loader {
  position: fixed;
  inset: 0;
  z-index: var(--erp-loader-z);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#erp-global-loader.is-visible {
  display: flex;
}

#erp-global-loader .erp-loader-visual {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 22px 44px rgba(15, 23, 42, .12));
}

#erp-global-loader .erp-loader-halo,
#erp-global-loader .erp-loader-ring,
#erp-global-loader .erp-loader-ring::before,
#erp-global-loader .erp-loader-ring::after,
#erp-global-loader .erp-loader-scan {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

#erp-global-loader .erp-loader-halo {
  inset: 16px;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--erp-primary, #2f7ef7) 24%, rgba(255,255,255,.32)) 0%, transparent 68%);
  filter: blur(12px);
  opacity: .95;
}

#erp-global-loader .erp-loader-ring {
  border: 1px solid rgba(255,255,255,.34);
  background: radial-gradient(circle at center, rgba(255,255,255,.18), transparent 64%);
}

#erp-global-loader .erp-loader-ring::before,
#erp-global-loader .erp-loader-ring::after {
  content: "";
}

#erp-global-loader .erp-loader-ring::before {
  inset: 7px;
  border: 3px solid transparent;
  border-top-color: var(--erp-primary, #2f7ef7);
  border-right-color: color-mix(in srgb, var(--erp-accent, #3ac086) 70%, #ffffff 30%);
  animation: erp-loader-spin 1s linear infinite;
}

#erp-global-loader .erp-loader-ring::after {
  inset: 22px;
  border: 1px solid color-mix(in srgb, var(--erp-primary, #2f7ef7) 22%, rgba(255,255,255,.3));
  opacity: .9;
}

#erp-global-loader .erp-loader-scan {
  inset: auto 17px 50%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--erp-primary, #2f7ef7) 82%, #ffffff 18%), transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--erp-primary, #2f7ef7) 38%, transparent);
  animation: erp-loader-scan 1.6s ease-in-out infinite;
}

@keyframes erp-loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes erp-loader-scan {
  0%, 100% {
    transform: translateY(-22px) scaleX(.78);
    opacity: .12;
  }
  45% {
    transform: translateY(22px) scaleX(1);
    opacity: .95;
  }
  55% {
    transform: translateY(22px) scaleX(1);
    opacity: .95;
  }
}

/* ---------- Auth screens ---------- */
body.erp-modern-v2.blank-login-body,
body.erp-modern-v2.config-login-body {
  min-height: 100vh;
}

body.erp-modern-v2.blank-login-body > .container-fluid,
body.erp-modern-v2.config-login-body > .container-fluid {
  width: min(1280px, calc(100% - 20px));
  max-width: 1280px;
  padding-inline: clamp(10px, 2vw, 24px) !important;
  padding-block: 10px 18px !important;
}

body.erp-modern-v2.blank-login-body #form-section,
body.erp-modern-v2.config-login-body #form-section {
  width: 100%;
}

body.erp-modern-v2.blank-login-body .erp-auth-card,
body.erp-modern-v2.config-login-body .erp-auth-card {
  width: min(1180px, 100%) !important;
  margin-inline: auto !important;
}

body.erp-modern-v2.blank-login-body .hero.erp-auth-layout {
  width: min(1180px, 100%) !important;
  margin: 14px auto 0 !important;
  display: grid !important;
  grid-template-columns: minmax(340px, 1fr) minmax(420px, .96fr) !important;
  gap: clamp(18px, 2vw, 30px) !important;
  align-items: stretch !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-side {
  min-width: 0;
}

body.erp-modern-v2.blank-login-body .erp-auth-side__surface {
  min-height: 100%;
  position: sticky;
  top: 16px;
}

body.erp-modern-v2.blank-login-body .main-box.erp-auth-main-box,
body.erp-modern-v2.config-login-body #form-section > *:first-child {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 30px !important;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--erp-primary, #2f7ef7) 8%, transparent), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,249,255,.96)) !important;
  border: 1px solid rgba(189,210,233,.7) !important;
  box-shadow: 0 22px 56px rgba(15, 23, 42, .09) !important;
  overflow: hidden !important;
}

body.erp-modern-v2.blank-login-body .main-box.erp-auth-main-box::before,
body.erp-modern-v2.config-login-body #form-section > *:first-child::before {
  display: none !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-main-box .form-box,
body.erp-modern-v2.config-login-body #form-section > *:first-child {
  padding: 22px !important;
}

body.erp-modern-v2.blank-login-body .logo-box_main,
body.erp-modern-v2.blank-login-body .logo-box_old,
body.erp-modern-v2.blank-login-body .logo-frame,
body.erp-modern-v2.config-login-body .logo-box_main,
body.erp-modern-v2.config-login-body .logo-box_old,
body.erp-modern-v2.config-login-body .logo-frame,
body.erp-modern-v2.blank-login-body .erp-auth-header,
body.erp-modern-v2.blank-login-body .erp-auth-injected-badge,
body.erp-modern-v2.blank-login-body .sp,
body.erp-modern-v2.config-login-body .sp {
  display: none !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-form-intro,
body.erp-modern-v2.blank-login-body .erp-auth-panel-copy,
body.erp-modern-v2.blank-login-body .erp-auth-inline-note {
  text-align: start;
}

body.erp-modern-v2.blank-login-body .button-box.erp-auth-switch {
  margin: 14px 0 16px !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-panel,
body.erp-modern-v2.config-login-body #auth-form1,
body.erp-modern-v2.config-login-body #auth-form11 {
  margin: 0 !important;
  padding: 0 !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-panel .form-group,
body.erp-modern-v2.blank-login-body .erp-auth-panel .form-group111,
body.erp-modern-v2.blank-login-body .erp-auth-action-row,
body.erp-modern-v2.config-login-body .form-group,
body.erp-modern-v2.config-login-body .form-group111 {
  margin-bottom: 0 !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-panel > [class*="col-"],
body.erp-modern-v2.blank-login-body .erp-auth-action-row > [class*="col-"],
body.erp-modern-v2.config-login-body #auth-form1 > [class*="col-"],
body.erp-modern-v2.config-login-body #auth-form11 > [class*="col-"] {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  padding-inline: 0 !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-panel {
  display: grid !important;
  gap: 10px !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-actions .erp-u-display-flex {
  display: grid !important;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 10px;
  width: 100%;
}

body.erp-modern-v2.blank-login-body .erp-auth-actions .btn,
body.erp-modern-v2.blank-login-body .erp-auth-action-row .btn,
body.erp-modern-v2.config-login-body .btn {
  min-height: 46px !important;
  height: 46px !important;
  border-radius: 16px !important;
  font-weight: 900 !important;
  box-shadow: none !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-switch__btn,
body.erp-modern-v2.blank-login-body .button-box.erp-auth-switch .btn {
  min-height: 46px !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-password-toggle {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 12px !important;
}

body.erp-modern-v2.blank-login-body .erp-auth-status-block {
  width: min(1180px, 100%);
  margin: 12px auto 0;
}

/* ---------- Input / dropdown parity ---------- */
body.erp-modern-v2 .erp-field-shell {
  min-width: 0;
}

body.erp-modern-v2 .erp-field-shell > .form-control,
body.erp-modern-v2 .erp-field-shell > select.form-control,
body.erp-modern-v2 .select2-container .select2-selection--single,
body.erp-modern-v2 .select2-container .select2-selection--multiple,
body.erp-modern-v2 .select2-container--default .select2-selection--single,
body.erp-modern-v2 .select2-container--default .select2-selection--multiple {
  min-height: var(--erp-auth-field-h) !important;
  height: var(--erp-auth-field-h) !important;
  border-radius: 16px !important;
}

body.erp-modern-v2 textarea.form-control,
body.erp-modern-v2 .select2-container .select2-selection--multiple {
  min-height: calc(var(--erp-auth-field-h) + 10px) !important;
  height: auto !important;
}

body.erp-modern-v2 .select2-container,
body.erp-modern-v2 .select2,
body.erp-modern-v2 .select2-container--default {
  width: 100% !important;
  max-width: 100% !important;
}

body.erp-modern-v2 .select2-container .select2-selection--single .select2-selection__rendered,
body.erp-modern-v2 .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: calc(var(--erp-auth-field-h) - 2px) !important;
  min-height: calc(var(--erp-auth-field-h) - 2px) !important;
  padding-inline-start: 16px !important;
  padding-inline-end: 40px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.erp-modern-v2 .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(var(--erp-auth-field-h) - 2px) !important;
  width: 32px !important;
  inset-inline-end: 8px !important;
}

body.erp-modern-v2 select.form-control,
body.erp-modern-v2 .erp-field-shell > select.form-control {
  padding-inline-end: 36px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  appearance: none;
  background-position: calc(100% - 14px) 50%;
}

body.erp-modern-v2 .select2-container--open .select2-dropdown {
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(15, 23, 42, .14) !important;
}

body.erp-modern-v2 .select2-results__option {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Floating labels RTL/LTR ---------- */
body.erp-modern-v2 .erp-field-shell > .form-label,
body.erp-modern-v2 .erp-field-shell .form-label,
body.erp-modern-v2 .form-group .form-label {
  background: transparent !important;
  box-shadow: none !important;
  padding-inline: 2px !important;
}

html[dir='rtl'] body.erp-modern-v2 .erp-field-shell > .form-label,
html[dir='rtl'] body.erp-modern-v2 .erp-field-shell .form-label,
html[dir='rtl'] body.erp-modern-v2 .form-group .form-label {
  inset-inline-start: 16px !important;
  inset-inline-end: auto !important;
  text-align: right !important;
}

html[dir='ltr'] body.erp-modern-v2 .erp-field-shell > .form-label,
html[dir='ltr'] body.erp-modern-v2 .erp-field-shell .form-label,
html[dir='ltr'] body.erp-modern-v2 .form-group .form-label {
  inset-inline-start: 16px !important;
  inset-inline-end: auto !important;
  text-align: left !important;
}

/* ---------- Filter sheets / report filter visibility ---------- */
body.erp-modern-v2 .filter-overlay,
body.erp-modern-v2 .erp-filter-overlay,
body.erp-modern-v2 .erp-filter-overlay-print,
body.erp-modern-v2 .erp-filter-overlay-invoice,
body.erp-modern-v2 .filter-overlay_center,
body.erp-modern-v2 .filter-overlay_center_print,
body.erp-modern-v2 .filter-overlay_center_InvoiceEdafat {
  position: fixed !important;
  inset: 0 !important;
  z-index: var(--erp-filter-z) !important;
  display: block !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, .26) !important;
  backdrop-filter: blur(4px);
}

body.erp-modern-v2 .filter-overlay.open,
body.erp-modern-v2 .erp-filter-overlay.open,
body.erp-modern-v2 .erp-filter-overlay-print.open,
body.erp-modern-v2 .erp-filter-overlay-invoice.open,
body.erp-modern-v2 .filter-overlay_center.open,
body.erp-modern-v2 .filter-overlay_center_print.open,
body.erp-modern-v2 .filter-overlay_center_InvoiceEdafat.open {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.erp-modern-v2 .erp-filter-panel,
body.erp-modern-v2 .erp-filter-panel-center,
body.erp-modern-v2 .filter-sidebar_center {
  position: fixed !important;
  top: max(18px, 2.5vh) !important;
  bottom: max(18px, 2.5vh) !important;
  width: min(440px, calc(100vw - 28px)) !important;
  max-width: 440px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: calc(var(--erp-filter-z) + 1) !important;
  border-radius: 28px !important;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,250,255,.96)) !important;
  border: 1px solid rgba(189,210,233,.82) !important;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .18) !important;
  opacity: 0;
  pointer-events: none;
}

html[dir='rtl'] body.erp-modern-v2 .erp-filter-panel,
html[dir='rtl'] body.erp-modern-v2 .erp-filter-panel-center,
html[dir='rtl'] body.erp-modern-v2 .filter-sidebar_center {
  left: 14px !important;
  right: auto !important;
  transform: translate3d(-18px, 0, 0);
}

html[dir='ltr'] body.erp-modern-v2 .erp-filter-panel,
html[dir='ltr'] body.erp-modern-v2 .erp-filter-panel-center,
html[dir='ltr'] body.erp-modern-v2 .filter-sidebar_center {
  right: 14px !important;
  left: auto !important;
  transform: translate3d(18px, 0, 0);
}

body.erp-modern-v2 .erp-filter-panel.open,
body.erp-modern-v2 .erp-filter-panel-center.open,
body.erp-modern-v2 .filter-overlay_center.open .filter-sidebar_center,
body.erp-modern-v2 .erp-filter-overlay.open .erp-filter-panel-center,
body.erp-modern-v2 .erp-filter-overlay-print.open .erp-filter-panel-center,
body.erp-modern-v2 .erp-filter-overlay-invoice.open .erp-filter-panel-center,
body.erp-modern-v2 .filter-overlay_center_print.open .filter-sidebar_center,
body.erp-modern-v2 .filter-overlay_center_InvoiceEdafat.open .filter-sidebar_center {
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translate3d(0, 0, 0) !important;
}

body.erp-modern-v2 .erp-filter-panel__header,
body.erp-modern-v2 .erp-filter-panel-center .filter-header {
  flex: 0 0 auto;
}

body.erp-modern-v2 .erp-filter-panel .filter-body,
body.erp-modern-v2 .erp-filter-panel-center .filter-body,
body.erp-modern-v2 .filter-sidebar_center .filter-body {
  flex: 1 1 auto;
  overflow: auto !important;
  padding: 12px 12px 16px !important;
}

body.erp-modern-v2 .erp-filter-panel .filter-body .row,
body.erp-modern-v2 .erp-filter-panel-center .filter-body .row {
  margin-inline: 0 !important;
}

body.erp-modern-v2 .erp-filter-panel .filter-body [class*='col-'],
body.erp-modern-v2 .erp-filter-panel-center .filter-body [class*='col-'] {
  padding-inline: 0 !important;
}

body.erp-modern-v2 .filter-close,
body.erp-modern-v2 .filter-close_center,
body.erp-modern-v2 .filter-close_center_print,
body.erp-modern-v2 .filter-close_center_InvoiceEdafat {
  cursor: pointer;
}

@media (max-width: 991.98px) {
  body.erp-modern-v2.blank-login-body .hero.erp-auth-layout {
    grid-template-columns: 1fr !important;
  }

  body.erp-modern-v2.blank-login-body .erp-auth-side {
    order: 2;
  }

  body.erp-modern-v2.blank-login-body .erp-auth-main-box {
    order: 1;
  }

  body.erp-modern-v2.blank-login-body .erp-auth-side__surface {
    position: relative;
    top: auto;
  }
}

@media (max-width: 575.98px) {
  body.erp-modern-v2.blank-login-body > .container-fluid,
  body.erp-modern-v2.config-login-body > .container-fluid {
    width: calc(100% - 10px);
    padding-inline: 8px !important;
  }

  body.erp-modern-v2.blank-login-body .erp-auth-main-box .form-box,
  body.erp-modern-v2.config-login-body #form-section > *:first-child {
    padding: 16px !important;
  }

  body.erp-modern-v2.blank-login-body .erp-auth-actions .erp-u-display-flex {
    grid-template-columns: 1fr !important;
  }

  body.erp-modern-v2 .erp-filter-panel,
  body.erp-modern-v2 .erp-filter-panel-center,
  body.erp-modern-v2 .filter-sidebar_center {
    width: calc(100vw - 14px) !important;
    max-width: calc(100vw - 14px) !important;
    top: 7px !important;
    bottom: 7px !important;
  }

  html[dir='rtl'] body.erp-modern-v2 .erp-filter-panel,
  html[dir='rtl'] body.erp-modern-v2 .erp-filter-panel-center,
  html[dir='rtl'] body.erp-modern-v2 .filter-sidebar_center {
    left: 7px !important;
  }

  html[dir='ltr'] body.erp-modern-v2 .erp-filter-panel,
  html[dir='ltr'] body.erp-modern-v2 .erp-filter-panel-center,
  html[dir='ltr'] body.erp-modern-v2 .filter-sidebar_center {
    right: 7px !important;
  }
}
