/* ==========================================================================
   Page & Right-Side Scrollbar (Increased Width & Better Usability)
   ========================================================================== */
html,
body {
  scrollbar-width: auto;
  scrollbar-color: #cbd5e1 #f1f3f5;
}

/* Global / Right-side scrollbar for WebKit (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: #f1f3f5;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 8px;
  border: 2px solid #f1f3f5;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

::-webkit-scrollbar-thumb:active {
  background-color: #ff6600;
}

/* Explicit targeting for main wrapper & right-side page content */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.main-wrapper::-webkit-scrollbar,
.page-wrapper::-webkit-scrollbar,
.page-wrapper .content::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.main-wrapper::-webkit-scrollbar-track,
.page-wrapper::-webkit-scrollbar-track,
.page-wrapper .content::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: #f1f3f5;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.main-wrapper::-webkit-scrollbar-thumb,
.page-wrapper::-webkit-scrollbar-thumb,
.page-wrapper .content::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 8px;
  border: 2px solid #f1f3f5;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.main-wrapper::-webkit-scrollbar-thumb:hover,
.page-wrapper::-webkit-scrollbar-thumb:hover,
.page-wrapper .content::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}

html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
.main-wrapper::-webkit-scrollbar-thumb:active,
.page-wrapper::-webkit-scrollbar-thumb:active,
.page-wrapper .content::-webkit-scrollbar-thumb:active,
.table-responsive::-webkit-scrollbar-thumb:active {
  background-color: #ff6600;
}

/* Main sidebar scroll */
.sidebar .sidebar-inner {
  max-height: calc(100vh - 65px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #c5c5c5 transparent;
}

.sidebar .sidebar-inner::-webkit-scrollbar {
  width: 6px;
}

.sidebar .sidebar-inner::-webkit-scrollbar-thumb {
  background: #c5c5c5;
  border-radius: 4px;
}

/* Settings sidebar scroll */
.settings-wrapper .settings-sidebar .sidebar-inner {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.settings-wrapper .settings-sidebar .sidebar-inner::-webkit-scrollbar {
  width: 6px;
}

.settings-wrapper .settings-sidebar .sidebar-inner::-webkit-scrollbar-thumb {
  background: #c5c5c5;
  border-radius: 4px;
}

/* Header: push user info to the right */
.header .main-header {
  display: flex;
  align-items: center;
  width: 100%;
}

.header .main-header .header-left {
  float: none;
  flex-shrink: 0;
}

.header .main-header .mobile_btn {
  float: none;
  flex-shrink: 0;
}

.header .main-header .user-menu {
  display: flex;
  margin-left: auto;
  justify-content: flex-end;
  flex: 1;
}

/* Modal close (X): theme styles empty btn-close as a colored circle without the Bootstrap SVG */
.modal .btn-close {
  box-sizing: content-box !important;
  display: block !important;
  flex: 0 0 auto;
  width: 1em !important;
  height: 1em !important;
  padding: 0.25em !important;
  margin: 0 0 0 auto;
  color: transparent !important;
  background-color: transparent !important;
  background-image: var(--bs-btn-close-bg) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 1em auto !important;
  border: 0 !important;
  border-radius: 0.375rem !important;
  font-weight: normal !important;
  opacity: var(--bs-btn-close-opacity, 0.5) !important;
}

.modal .btn-close:hover,
.modal .btn-close:focus {
  color: transparent !important;
  background-color: transparent !important;
  opacity: var(--bs-btn-close-hover-opacity, 0.75) !important;
}

.modal .btn-close.btn-close-white,
.modal-header.text-white .btn-close,
.modal-header.bg-primary .btn-close,
.modal-header.bg-dark .btn-close {
  filter: var(--bs-btn-close-white-filter, invert(1) grayscale(100%) brightness(200%));
  opacity: var(--bs-btn-close-opacity, 1) !important;
}

.modal-header.text-white .btn-close:hover,
.modal .btn-close.btn-close-white:hover,
.modal-header.bg-primary .btn-close:hover,
.modal-header.bg-dark .btn-close:hover {
  opacity: var(--bs-btn-close-hover-opacity, 0.75) !important;
}

/* ==========================================================================
   Clean Modern Design System (Inherited from Item Form Aesthetic)
   Applies to textboxes, labels, selects, input groups, cards, buttons, modals
   ========================================================================== */

/* ─── 1. Form Labels ─── */
.form-label,
label.form-label,
.compact-label,
/* Composite POS controls use labels as flex containers for icon/input/shortcut.
   They own their layout and must not receive standalone form-label styling. */
label:not(.btn):not(.form-check-label):not(.badge):not(.dropdown-item):not(.btn-group > label):not(.lp-search):not(.lp-context-field) {
  font-size: 0.8125rem !important; /* ~13px */
  font-weight: 600 !important;
  color: #334155 !important; /* Slate-700: sharp, crisp, high contrast */
  margin-bottom: 0.35rem !important;
  line-height: 1.35 !important;
  letter-spacing: -0.01em !important;
  display: inline-block;
}

/* Required asterisk formatting */
.form-label .text-danger,
label .text-danger,
.compact-label .text-danger {
  color: #ef4444 !important;
  font-weight: 700 !important;
  margin-left: 2px !important;
}

/* ─── 2. Textboxes & Form Controls ─── */
.form-control,
input.form-control,
input[type="text"].form-control,
input[type="number"].form-control,
input[type="email"].form-control,
input[type="password"].form-control,
input[type="search"].form-control,
input[type="tel"].form-control,
input[type="url"].form-control {
  min-height: 38px !important;
  height: 38px;
  padding: 0.42rem 0.75rem !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #1e293b !important; /* Slate-800 */
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important; /* Clean neutral border */
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

/* Textarea exception: allow dynamic height */
textarea.form-control {
  min-height: 76px !important;
  height: auto !important;
  padding: 0.5rem 0.75rem !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #1e293b !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
}

/* Placeholder styling */
.form-control::placeholder,
textarea.form-control::placeholder {
  color: #94a3b8 !important; /* Slate-400 */
  font-weight: 400 !important;
  opacity: 1 !important;
}

/* Focus state */
.form-control:focus,
textarea.form-control:focus {
  border-color: #6366f1 !important; /* Indigo accent */
  background-color: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14) !important;
  outline: none !important;
}

/* Disabled & Readonly states */
.form-control:disabled,
textarea.form-control:disabled,
.form-control[readonly]:not(.cursor-pointer):not(.nepali-date-picker input) {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Validated invalid */
.form-control.is-invalid,
.is-invalid .form-control {
  border-color: #ef4444 !important;
}
.form-control.is-invalid:focus,
.is-invalid .form-control:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* ─── 3. Select Dropdowns ─── */
.form-select,
select.form-control {
  min-height: 38px !important;
  height: 38px;
  padding: 0.42rem 2.25rem 0.42rem 0.75rem !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #1e293b !important;
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 13px 9px !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
  cursor: pointer;
}

.form-select:focus,
select.form-control:focus {
  border-color: #6366f1 !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14) !important;
  outline: none !important;
}

.form-select:disabled,
select.form-control:disabled {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

.form-select.is-invalid,
.is-invalid .form-select {
  border-color: #ef4444 !important;
}

/* ─── 4. Compact / Small Form Controls (for Line Items / Tables) ─── */
.form-control-sm,
.form-select-sm,
.table input.form-control,
.table select.form-select,
.table select.form-control {
  min-height: 32px !important;
  height: 32px !important;
  font-size: 0.8125rem !important;
  padding: 0.25rem 0.55rem !important;
  border-radius: 6px !important;
}

/* ─── 5. Input Groups & Quick Action Add Buttons ─── */
.input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  border-radius: 8px !important;
  align-items: stretch !important;
}

.input-group > :first-child:not(:last-child) {
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.input-group > :last-child:not(:first-child) {
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.input-group > :not(:first-child):not(:last-child) {
  border-radius: 0 !important;
}

.input-group-text,
.compact-prefix {
  background-color: #f8fafc !important;
  border: 1px solid #d1d5db !important;
  color: #64748b !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  padding: 0.42rem 0.65rem !important;
  min-height: 38px !important;
  height: 38px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Quick-add buttons (+ / refresh / barcode) inside input-group */
.input-group > .btn,
.input-group > .btn-outline-primary,
.input-group > .btn-outline-secondary {
  min-height: 38px !important;
  height: 38px !important;
  border: 1px solid #d1d5db !important;
  color: #6366f1 !important;
  background-color: #ffffff !important;
  padding: 0 0.85rem !important;
  font-size: 0.875rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease-in-out !important;
  box-shadow: none !important;
}

.input-group > .btn:hover,
.input-group > .btn-outline-primary:hover,
.input-group > .btn-outline-secondary:hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #4f46e5 !important;
}

/* Focus order in input group: bring focused element to front */
.input-group > .form-control:focus,
.input-group > .form-select:focus,
.input-group > .btn:focus {
  z-index: 3 !important;
}

/* ─── 6. Date Inputs (CompanyDateInput / NepaliDatePicker) ─── */
.nepali-date-picker {
  width: 100%;
}
.nepali-date-picker__input-wrap {
  display: flex !important;
  width: 100%;
  align-items: stretch !important;
}
.nepali-date-picker__input-wrap input.form-control {
  flex: 1 1 auto;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
  cursor: pointer;
  background-color: #ffffff !important;
}
.nepali-date-picker__toggle {
  border: 1px solid #d1d5db !important;
  border-left: 0 !important;
  background-color: #ffffff !important;
  color: #10b981 !important;
  padding: 0 0.75rem !important;
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.1rem !important;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nepali-date-picker__toggle:hover {
  background-color: #f8fafc !important;
  color: #059669 !important;
}

/* ─── 7. Cards & Containers (Item Form Card Look) ─── */
.card,
.form-compact-card,
.voucher-container,
.sidebar-compact-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.04) !important;
}

.card-header,
.card-compact-header,
.sidebar-compact-header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 0.85rem 1.25rem !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
  display: flex;
  align-items: center;
}

.card-body,
.card-compact-body,
.sidebar-compact-body {
  padding: 1.15rem 1.25rem !important;
}

/* ─── 8. Buttons (Clean, Modern, Rounded) ─── */
.btn {
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease-in-out;
}

.btn-sm {
  min-height: 34px !important;
  height: 34px !important;
  font-size: 0.8125rem !important;
  padding: 0.35rem 0.85rem !important;
  border-radius: 7px !important;
}

.btn-xs {
  min-height: 26px !important;
  height: 26px !important;
  font-size: 0.75rem !important;
  padding: 0.2rem 0.55rem !important;
  border-radius: 6px !important;
}

.btn-outline-secondary,
.btn.btn-outline-secondary {
  background-color: #ffffff !important;
  border: 1px solid #d1d5db !important;
  color: #334155 !important;
}
.btn-outline-secondary:hover,
.btn.btn-outline-secondary:hover,
.btn.btn-outline-secondary:focus,
.btn.btn-outline-secondary:active {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/*
  Theme uses navy #092C4C for .btn.btn-secondary. An earlier layout-fixes rule set
  dark gray text (!important) with lower specificity, so Cancel labels became invisible
  (navy bg + slate text). Keep navy buttons and force white text everywhere.
*/
.btn.btn-secondary,
a.btn.btn-secondary,
button.btn-secondary {
  background-color: #092C4C !important;
  border: 1px solid #092C4C !important;
  color: #ffffff !important;
  box-shadow: 0 4px 20px rgba(9, 44, 76, 0.15);
}
.btn.btn-secondary:hover,
.btn.btn-secondary:focus,
.btn.btn-secondary:active,
.btn.btn-secondary.active,
a.btn.btn-secondary:hover,
button.btn-secondary:hover {
  background-color: #051a2c !important;
  border-color: #051a2c !important;
  color: #ffffff !important;
}
.btn.btn-secondary:disabled,
.btn.btn-secondary.disabled {
  color: #ffffff !important;
  opacity: 0.65;
}

.btn-light {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}
.btn-light:hover {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

.btn-outline-primary {
  background-color: #ffffff !important;
  border: 1px solid #6366f1 !important;
  color: #6366f1 !important;
}
.btn-outline-primary:hover {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #ffffff !important;
}

.btn-primary {
  background: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2) !important;
}
.btn-primary:hover {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
}

.back-btn {
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #ffffff !important;
  color: #475569 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.back-btn:hover {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

/* ─── 9. Switches & Checkboxes ─── */
.form-check-input {
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 5px !important;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.form-check-input:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}
.form-check-input:checked {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
}

/* Switch */
.form-switch .form-check-input {
  width: 2.25rem !important;
  height: 1.25rem !important;
  border-radius: 1.5rem !important;
  background-color: #e2e8f0 !important;
  border: 1px solid #cbd5e1 !important;
  cursor: pointer;
}
.form-switch .form-check-input:checked {
  background-color: #6366f1 !important;
  border-color: #6366f1 !important;
}

.form-check-label {
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
  color: #334155 !important;
  cursor: pointer;
  user-select: none;
  margin-left: 0.35rem;
}

/* ─── 10. Modals ─── */
.modal-content {
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
  overflow: hidden !important;
}
.modal-header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 1rem 1.25rem !important;
}
.modal-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
}
.modal-body {
  padding: 1.25rem !important;
}
.modal-footer {
  background-color: #ffffff !important;
  border-top: 1px solid #f1f5f9 !important;
  padding: 0.85rem 1.25rem !important;
}
/* Modal Cancel / secondary actions: same navy + white text as form footers */
.modal .modal-footer .btn.btn-secondary,
.modal .modal-footer .btn.btn-secondary:focus,
.modal .modal-footer .btn.btn-secondary:hover,
.modal .modal-footer .btn.btn-secondary:active {
  background-color: #092C4C !important;
  border: 1px solid #092C4C !important;
  color: #ffffff !important;
  font-weight: 500 !important;
}

/* ─── 11. Tables in Forms & Transactions ─── */
.table {
  border-color: #e2e8f0 !important;
}
.table thead th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  font-size: 0.775rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-color: #e2e8f0 !important;
  padding: 0.65rem 0.75rem !important;
}
.table tbody td {
  border-color: #e2e8f0 !important;
  padding: 0.5rem 0.65rem !important;
  vertical-align: middle !important;
}
.table tbody tr:hover {
  background-color: #fbfcfe !important;
}

/* ─── 12. Searchable Select & Party Picker Dropdown Panels ─── */
.searchable-dropdown-panel,
.party-dropdown-panel {
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05) !important;
  background-color: #ffffff !important;
  overflow-y: auto;
}
.searchable-dropdown-item,
.party-dropdown-item {
  padding: 0.55rem 0.85rem !important;
  font-size: 0.85rem !important;
  color: #1e293b !important;
  border-bottom: 1px solid #f1f5f9 !important;
  transition: background-color 0.1s ease !important;
}
.searchable-dropdown-item:hover,
.searchable-dropdown-item.is-active,
.party-dropdown-item:hover,
.party-dropdown-item.is-active {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

/* ─── 13. Search Textboxes: Remove Left Overlapping Search Icon ─── */
.search-set .search-input .btn-searchset,
.search-input .btn-searchset,
.search-input .search-icon,
.search-set .feather-search,
.search-input .feather-search {
  display: none !important;
}

.search-set .search-input input[type="search"],
.search-set .search-input .form-control,
.search-input input[type="search"],
.search-input .form-control {
  padding-left: 0.75rem !important;
}

