/* ==========================================================
   Luno Theme-Blue — CSS variable definitions
   (Bootstrap 5 provided via CDN in base.html)
   ========================================================== */

[data-luno="theme-blue"] {
  --primary-color: #e65100;
  --secondary-color: #02638e;
  --primary-rgb: 230, 81, 0;
  --chart-color1: #e65100;
  --chart-color2: #6382D8;
  --chart-color3: #8D61A5;
  --chart-color4: #90476F;
  --chart-color5: #02638e;
  --chart-color6: #28AA6E;
  --chart-color7: #f9e93f;
  --chart-color8: #C62828;
  --chart-color9: #4b5eaa;
  --chart-color10: #e7a160;
  --primary-gradient: linear-gradient(145deg, var(--primary-color), var(--secondary-color));
  --secondary-gradient: linear-gradient(145deg, var(--secondary-color), var(--primary-color));
  --border-color: #e2e8f0;
  --card-color: #ffffff;
  --color-900: #1a1a2e;
  --color-800: #2d2d3a;
  --color-700: #444455;
  --color-600: #6c6c7e;
  --white-color: #ffffff;
  --bg-color: #f9f9f9;
}

[data-theme="dark"] [data-luno="theme-blue"] {
  --border-color: #353535;
  --card-color: #212324;
  --color-900: #f5f5f5;
  --color-800: #e0e0e0;
  --color-700: #bdbdbd;
  --color-600: #9e9e9e;
  --bg-color: #1d1f20;
}

/* ==========================================================
   Base
   ========================================================== */

* { box-sizing: border-box; }

body {
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  margin: 0;
}

[data-luno="theme-blue"] {
  background-color: var(--bg-color) !important;
}

[data-theme="dark"] [data-luno="theme-blue"] {
  background-color: var(--bg-color) !important;
}

/* ==========================================================
   Layout — body.layout-2 (fixed sidebar + wrapper)
   ========================================================== */

#mainBody {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 190px;
  min-height: 100vh;
  background: var(--card-color);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-title {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar .menu-list {
  padding: 0.75rem 0.75rem;
  margin: 0;
  list-style: none;
}

.sidebar .menu-list li {
  margin-bottom: 2px;
}

.sidebar .menu-list .m-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  color: var(--color-700);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.sidebar .menu-list .m-link i {
  font-size: 1rem;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
}

.sidebar .menu-list .m-link span.ms-2 {
  margin-left: 0.6rem;
}

.sidebar .menu-list .m-link:hover {
  background: rgba(2, 99, 142, 0.08);
  color: var(--secondary-color);
}

.sidebar .menu-list .m-link.active {
  background: var(--secondary-color);
  color: #fff;
}

.sidebar .menu-list .m-link.active i {
  color: #fff;
}

body.layout-2 .sidebar {
  box-shadow: 0px 0px 0px 0px !important;
}

body.layout-2 .sidebar.sidebar-mini .menu-list > li > .m-link {
  font-size: 13px !important;
}

/* ---- Wrapper ---- */
.wrapper {
  margin-left: 190px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

body.layout-2 .wrapper {
  box-shadow: 0px 0px 0px 0px !important;
}

/* ---- Page header ---- */
.page-header {
  height: 60px;
  background: var(--card-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 99 !important;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

body.layout-2 .wrapper .page-header {
  z-index: 99 !important;
}

body.layout-2 .wrapper .page-header .header-right > li .nav-link:hover {
  background: none !important;
  color: none !important;
}

/* ---- Page body ---- */
.page-body {
  flex: 1;
  padding: 1.5rem 0;
  margin-bottom: 3vh;
}

/* ---- Mini sidebar ---- */
body.sidebar-mini .sidebar {
  width: 56px;
}

body.sidebar-mini .sidebar .nav-label,
body.sidebar-mini .sidebar .brand-name {
  display: none;
}

body.sidebar-mini .wrapper {
  margin-left: 56px;
}

body.sidebar-mini .sidebar .m-link span.ms-2 {
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1021 !important;
    width: 190px !important;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .wrapper {
    margin-left: 0 !important;
  }
  body.sidebar-mini .sidebar {
    width: 190px !important;
  }
}

@media (max-width: 578px) {
  .sidebar {
    width: 90% !important;
  }
}

/* Overlay for mobile sidebar */
.sidebar-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(25, 26, 28, 0.45);
  z-index: 1020;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ==========================================================
   Dark mode base overrides
   ========================================================== */

[data-theme="dark"] [data-luno="theme-blue"] .card {
  background-color: #212324 !important;
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .accordion-item {
  background-color: #212324 !important;
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .accordion-button {
  background-color: #2a2c2d !important;
  color: var(--color-900) !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .accordion-button:not(.collapsed) {
  background-color: #2a2c2d !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .page-header,
[data-theme="dark"] [data-luno="theme-blue"] .sidebar {
  background-color: #212324 !important;
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .sidebar-title {
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .sidebar .menu-list .m-link {
  color: #bdbdbd !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .sidebar .menu-list .m-link:hover {
  background: rgba(2, 99, 142, 0.2);
  color: #5bc8f5 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .sidebar .menu-list .m-link.active {
  background: var(--secondary-color);
  color: #fff !important;
}

[data-theme="dark"] [data-luno="theme-blue"] input[type="text"]:read-only,
[data-theme="dark"] [data-luno="theme-blue"] select:read-only,
[data-theme="dark"] [data-luno="theme-blue"] .ypad {
  background-color: #212324 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .breadcrumb-item.active,
[data-theme="dark"] [data-luno="theme-blue"] .breadcrumb-item {
  color: #bdbdbd;
}

[data-theme="dark"] [data-luno="theme-blue"] .text-muted {
  color: #8f8f8f !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .table tr th {
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .table tr td {
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .white-logo {
  display: block;
}

[data-theme="dark"] [data-luno="theme-blue"] .dark-logo {
  display: none;
}

[data-theme="dark"] [data-luno="theme-blue"] .alert-success { color: #28aa6e; }
[data-theme="dark"] [data-luno="theme-blue"] .alert-danger  { color: #e16060; }
[data-theme="dark"] [data-luno="theme-blue"] .alert-warning { color: #F9973F; }
[data-theme="dark"] [data-luno="theme-blue"] .alert-info    { color: #4fb8c9; }

[data-theme="dark"] [data-luno="theme-blue"] .form-control::placeholder,
[data-theme="dark"] [data-luno="theme-blue"] .form-control,
[data-theme="dark"] [data-luno="theme-blue"] select {
  color: #bdbdbd !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .form-control,
[data-theme="dark"] [data-luno="theme-blue"] .form-select {
  background-color: #2a2c2d !important;
  border-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .form-control:disabled,
[data-theme="dark"] [data-luno="theme-blue"] .form-control[readonly] {
  background-color: #353535 !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .dropdown-menu {
  background-color: #212324;
  border: 1px solid #444;
  color: #fff;
}

[data-theme="dark"] [data-luno="theme-blue"] .dropdown-menu .dropdown-item {
  background-color: transparent;
  color: #f0f0f0;
}

[data-theme="dark"] [data-luno="theme-blue"] .dropdown-menu .dropdown-item:hover {
  background-color: #295bac;
  color: #fff;
}

[data-theme="dark"] [data-luno="theme-blue"] .list-group-item-action:hover,
[data-theme="dark"] [data-luno="theme-blue"] .list-group-item-action:focus {
  color: #cbcbcb;
  background-color: #0f0f0f;
}

[data-theme="dark"] [data-luno="theme-blue"] .form-label {
  color: whitesmoke !important;
}

[data-theme="dark"] [data-luno="theme-blue"] th {
  color: whitesmoke !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .pagination {
  margin-bottom: 1rem !important;
}

[data-theme="dark"] [data-luno="theme-blue"] .footer-logo-light { display: none !important; }
[data-theme="dark"] [data-luno="theme-blue"] .footer-logo-dark  { display: block !important; }

[data-theme="dark"] [data-luno="theme-blue"] .css1 { color: #bdbdbd !important; }
[data-theme="dark"] [data-luno="theme-blue"] .bg-info { color: #37bfd5 !important; }

/* ==========================================================
   Custom overrides (from project design system)
   ========================================================== */

body.layout-2 .sidebar .menu-list .m-link:hover .fill-primary,
body.layout-2 .sidebar .menu-list .m-link.active .fill-primary {
  fill: var(--white-color) !important;
}

.offcanvas { z-index: 999999 !important; }
.offcanvas-backdrop.show { z-index: 99999 !important; }

img { filter: none !important; }
img:hover { filter: saturate(0.5) !important; }

.shadow {
  box-shadow: 0 0.3rem 0.55rem rgb(25 26 28 / 15%) !important;
}

.table.card-table tr td,
.table.card-table tr th {
  border-bottom: 0.01px dashed var(--border-color) !important;
  white-space: normal;
}

.table tr td {
  padding: 0.6rem 0.5rem;
}

.text-muted { font-size: 12px; }

.chart-text-color6  { color: var(--chart-color6)  !important; }
.chart-text-color7  { color: var(--chart-color7)  !important; }
.chart-text-color8  { color: var(--chart-color8)  !important; }
.chart-text-color10 { color: var(--chart-color10) !important; }

.w310 { width: 310px; }

.bg-success { font-weight: 800 !important; }
.bg-danger  { font-weight: 800 !important; }
.bg-warning { font-weight: 800 !important; }
.bg-info    { color: #237e8d !important; font-weight: 800 !important; }
.bg-cancel  { background-color: #eb16164f !important; color: #ed3030 !important; }
.bg-purple  { background-color: #580b7f1a; color: #590b81; }

.text-warning { color: #F9973F !important; }

.customcssforprofilepic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
}

.btn {
  font-size: 0.875rem;
  padding: .1rem .5rem;
  border-radius: 0.2rem !important;
}

.button {
  background-color: #02638e !important;
  border: 1px solid #02638e !important;
  text-transform: uppercase;
  font-size: 0.875rem;
  padding: .1rem .5rem;
}

.btn.btn-lg,
.btn-group-lg > .btn {
  padding: .3rem;
  font-size: 1rem;
}

.borad { border-radius: 0.25rem !important; }

.rmargin {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 0.7rem !important;
}

[data-luno="theme-blue"] .rmargin {
  background: #fff;
  border-radius: 0.75rem;
}

[data-theme="dark"] [data-luno="theme-blue"] .rmargin { background: #212324; }

.fprop {
  font-size: 18px !important;
  font-weight: 700 !important;
}

.bpad { padding-bottom: 0.1rem !important; }
.wid  { width: 97.9% !important; }

.nav-item a svg { width: 1.4rem !important; }

.mt-custom { margin-top: 2.2rem !important; }

.g-custom { --bs-gutter-x: 0rem !important; }

.sticky-top {
  position: sticky !important;
  top: 0 !important;
}

.cntrl { width: 95% !important; }

.avtar_md { width: 120px !important; height: 120px !important; }

input[type="text"]:read-only,
select:read-only {
  padding-left: 7px;
  color: #181818;
}

a { text-decoration: none; }

input:focus { box-shadow: none !important; }

.nav-tabs.tab-card .nav-link {
  border-bottom: 3px solid transparent;
}

.form-control,
.form-select {
  border-radius: 0.2rem;
}

textarea.form-control { border-radius: 0.2rem; }

input::placeholder { opacity: 1; }
textarea::placeholder { opacity: 1; }

.offcanvas .form-control[disabled],
.offcanvas .form-control[readonly],
.offcanvas fieldset[disabled] .form-control {
  background: none !important;
}

.subtxt { text-transform: none !important; }

.btn-check:focus + .btn-primary,
.btn-primary:focus {
  box-shadow: none !important;
}

.btn-check:focus + .btn-outline-primary,
.btn-outline-primary:focus {
  box-shadow: none !important;
}

.btn-outline-primary.dropdown-toggle.show:focus {
  box-shadow: 0 0 0 0rem !important;
}

.page-item.disabled .page-link {
  background-color: transparent !important;
  border-color: transparent !important;
  font-size: 24px;
  padding: 0px 9px 0px 0px;
}

.page-item.active .page-link,
.page-item:hover .page-link {
  border-radius: 50%;
}

.page-item.next.disabled .page-link {
  padding: 0px 0px 0px 9px;
}

form sup.mandatory {
  top: -0.1em;
  font-size: 14px;
  color: #f52a2a !important;
}

.modal {
  z-index: 1050;
  background-color: rgb(25 26 28 / 30%);
}

.modal-backdrop.show { display: none; }

.identity-value {
  border: 0;
  padding: 0;
  font-weight: 700;
}

.field-icon { cursor: pointer; }

.identity-value:focus-visible { outline: none !important; }

input[type="text"].identity-value:read-only { color: #464545; }

body.option2 .wrapper .page-toolbar .text-warning { color: #F9973F !important; }

.border-left { border-left: 1px dashed #007185 !important; }

.border-orange-right { border-right: 1px dashed #e65100; }

.border-orange-right-with-pipe {
  border-right: 2px solid #e65100;
  padding-right: 12px;
}

/* ---- Tabs (custom tab-header style) ---- */
.tab-header {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid #eceff3;
  margin-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: 0;
  color: #7a8088;
  padding: 0 2px 11px;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  cursor: pointer;
}

.tab-btn.active { color: #02638e; }

.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background-color: #02638e;
}

[data-theme="dark"] [data-luno="theme-blue"] .tab-header {
  border-color: #353535;
}

[data-theme="dark"] [data-luno="theme-blue"] .tab-btn {
  color: #8f8f8f;
}

/* ---- Spinner ---- */
#flexbox {
  width: 100%;
  height: 100%;
  flex: 0 0 25%;
  box-sizing: border-box;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: fixed;
  z-index: 99999;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background-color: #9595956e;
}

.nb-spinner {
  width: 75px;
  height: 75px;
  margin: 0;
  background: transparent;
  border-top: 4px solid #e65100;
  border-right: 4px solid transparent;
  border-radius: 50%;
  animation: 1s nbspin linear infinite;
}

@keyframes nbspin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Scrollbar ---- */
.scrollbar {
  float: left;
  overflow-x: scroll;
}

.scrollbar::-webkit-scrollbar-track {
  border-radius: 10px;
  background-color: transparent;
}

.scrollbar::-webkit-scrollbar {
  height: 4px;
  background-color: transparent;
}

.scrollbar::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background-color: #e65100;
}

/* ---- Toggle switch ---- */
.input-switch { display: none; }

.label-switch { display: inline-block; position: relative; }

.label-switch::before,
.label-switch::after {
  content: "";
  display: inline-block;
  cursor: pointer;
  transition: all 0.5s;
}

.label-switch::before {
  width: 2rem;
  height: 1rem;
  border: 1px solid #afafaf;
  border-radius: 4em;
  background: #cccccc;
}

.label-switch::after {
  position: absolute;
  left: 3px;
  top: 13%;
  width: 10px;
  height: 10px;
  border: 1px solid #afafaf;
  border-radius: 4em;
  background: #ffffff;
}

.input-switch:checked ~ .label-switch::before {
  background: #e65100;
  border-color: #e65100;
}

.input-switch:checked ~ .label-switch::after {
  left: unset;
  right: 3px;
  background: #ffffff;
  border-color: #e65100;
}

.info-text {
  display: inline-block;
  font-size: 12px;
  width: 57px;
}

.info-text::before { content: "Inactive"; }
.input-switch:checked ~ .info-text::before { content: "Active"; }

/* ---- Switches container ---- */
.switches-container {
  width: 8rem;
  height: 1.8rem;
  position: relative;
  display: flex;
  padding: 0;
  background: #e9ecef;
  line-height: 2.3rem;
  border-radius: 2rem;
  margin-left: auto;
  margin-right: auto;
}

.switches-container input {
  visibility: hidden;
  position: absolute;
  top: 0;
}

.switches-container label {
  width: 50%;
  padding: 0;
  margin-top: -3px;
  text-align: center;
  cursor: pointer;
  color: #939393;
}

.switch-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  padding: 0.15rem;
  z-index: 3;
  transition: transform .5s cubic-bezier(.77, 0, .175, 1);
}

.switch {
  border-radius: 3rem;
  background: #02638e;
  height: 105%;
  cursor: context-menu;
}

.switch div {
  width: 100%;
  text-align: center;
  opacity: 0;
  display: block;
  color: #fff;
  transition: opacity .2s cubic-bezier(.77, 0, .175, 1) .125s;
  will-change: opacity;
  position: absolute;
  top: -3px;
  left: 0;
}

.switches-container input:nth-of-type(1):checked ~ .switch-wrapper { transform: translateX(0%); }
.switches-container input:nth-of-type(2):checked ~ .switch-wrapper { transform: translateX(100%); }
.switches-container input:nth-of-type(1):checked ~ .switch-wrapper .switch div:nth-of-type(1) { opacity: 1; }
.switches-container input:nth-of-type(2):checked ~ .switch-wrapper .switch div:nth-of-type(2) { opacity: 1; }

/* ---- Anchor ---- */
.anchor { color: var(--secondary-color); }
.clickable { cursor: pointer; color: #02638E; }

/* ---- Card table ---- */
[data-luno="theme-blue"] .rmargin { background: #fff; border-radius: 0.75rem; }
[data-theme="dark"] [data-luno="theme-blue"] .rmargin { background: #212324; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .cards-buttons { display: grid !important; }
  .buttons-list { justify-content: start !important; margin-top: 15px; }
}

@media (max-width: 768px) {
  .border-orange-right {
    border-right: 0;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e65100;
  }

  .cards-list { display: grid !important; grid-template: "a a a a"; }
  .cards-buttons { justify-content: normal !important; }
}

@media (max-width: 480px) {
  .cards-list { grid-template: "a a"; }
  .buttons-list { display: grid; grid-template: "a a"; }
  .buttons-list.d-sm-grid .btn:last-child { margin-top: 10px; }
}

@media (max-width: 500px) {
  .switches-container.switches-container-mobile {
    margin-left: 0;
    margin-bottom: 3px;
  }
}

/* ---- White / dark logo helpers ---- */
.white-logo { display: none; }
[data-theme="dark"] [data-luno="theme-blue"] .white-logo { display: block; }
[data-theme="dark"] [data-luno="theme-blue"] .dark-logo  { display: none; }
