/* THD UI Theme
   Keep changes class-based to avoid breaking existing page layouts. */

:root {
  --thd-primary: #003060;
  --thd-accent: #68BBE3;
  --thd-muted: #f2f2f2;
  --thd-bg: #eef7ff;
  --thd-border: rgba(0, 48, 96, 0.18);
  --thd-text-on-primary: #eaf2ff;
}

.bg-thd-primary {
  background: linear-gradient(90deg, #003060 0%, #0b3e7a 100%) !important;
}

/* Common header/title background used in multiple places */
.card-header.bg-thd-primary {
  background: linear-gradient(90deg, #003060 0%, #0b3e7a 100%) !important;
}

/* Global layout feel (no functional changes) */
body {
  background: var(--thd-bg) !important;
}

/* Menu (sidebar/topnav depending on layout) */
.app-menu.navbar-menu,
.navbar-menu {
  background: linear-gradient(180deg, #003060 0%, #02284f 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Vertical sidebar only — do not force full viewport height on horizontal top nav */
[data-layout=vertical] .app-menu.navbar-menu,
[data-layout=vertical] .navbar-menu {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Horizontal top nav: auto height so content is not hidden behind menu */
[data-layout=horizontal] .app-menu.navbar-menu,
[data-layout=horizontal] .navbar-menu {
  height: auto !important;
  min-height: 0 !important;
  display: block !important;
  flex-direction: unset !important;
}

[data-layout=horizontal] .page-content {
  position: relative;
  z-index: 1;
}

.navbar-menu #scrollbar,
#scrollbar {
  flex: 1 1 auto;
  min-height: 0; /* required for flex children scrolling */
}

.navbar-menu #scrollbar.h-100 {
  height: auto !important;
}

/* Ensure SimpleBar wrapper can scroll */
.navbar-menu .simplebar-wrapper,
.navbar-menu .simplebar-mask,
.navbar-menu .simplebar-offset,
.navbar-menu .simplebar-content-wrapper,
#scrollbar .simplebar-wrapper,
#scrollbar .simplebar-mask,
#scrollbar .simplebar-offset,
#scrollbar .simplebar-content-wrapper,
#navbar-nav.simplebar-wrapper,
#navbar-nav .simplebar-wrapper,
#navbar-nav .simplebar-mask,
#navbar-nav .simplebar-offset,
#navbar-nav .simplebar-content-wrapper {
  height: 100%;
}

.navbar-menu .simplebar-content-wrapper,
#scrollbar .simplebar-content-wrapper,
#navbar-nav .simplebar-content-wrapper {
  overflow: auto !important;
  min-height: 0;
}

/* Fallback if SimpleBar not active */
.navbar-menu #scrollbar,
#scrollbar {
  overflow: auto !important;
  overscroll-behavior: contain;
}

/* Reduce extra bottom space inside sidebar scroll */
#scrollbar .simplebar-content,
.navbar-menu #scrollbar .simplebar-content,
#navbar-nav {
  padding-bottom: 8px !important;
  margin-bottom: 0 !important;
}

.navbar-menu .navbar-brand-box,
.navbar-menu .navbar-brand-box a,
.navbar-menu .navbar-brand-box .logo-lg,
.navbar-menu .navbar-brand-box .logo-sm {
  color: var(--thd-text-on-primary) !important;
}

.navbar-menu .menu-title span,
.navbar-menu .nav-link,
.navbar-menu .nav-link i {
  color: rgba(234, 242, 255, 0.92) !important;
}

.navbar-menu .nav-link:hover,
.navbar-menu .nav-link:focus {
  color: #ffffff !important;
  background: rgba(104, 187, 227, 0.14) !important;
}

.navbar-menu .nav-link.active,
.navbar-menu .nav-link[aria-expanded="true"] {
  background: rgba(104, 187, 227, 0.22) !important;
  color: #ffffff !important;
}

.navbar-menu .menu-dropdown {
  background: transparent !important;
}

/* Footer */
.footer {
  background: linear-gradient(90deg, #003060 0%, #0b3e7a 100%) !important;
  color: rgba(234, 242, 255, 0.92) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.footer a,
.footer .text-muted {
  color: rgba(234, 242, 255, 0.92) !important;
}

/* Cards: radius + shadow like modern ERP */
.card {
  border: 1px solid var(--thd-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12) !important;
}

.card-header {
  border-bottom: 2px solid rgba(0, 48, 96, 0.18) !important;
  border-top-left-radius: 16px !important;
  border-top-right-radius: 16px !important;
}

/* Buttons: unify primary look */
.btn-primary {
  background: var(--thd-primary) !important;
  border-color: var(--thd-primary) !important;
  box-shadow: 0 8px 18px rgba(0, 48, 96, 0.18) !important;
  border-radius: 10px !important;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

/* Table header subtle theme improvement */
.table thead th {
  background-color: var(--thd-muted);
}

/* DataTables export buttons (Copy/Excel/PDF/Print) */
.dt-buttons .dt-button,
.dt-buttons .buttons-copy,
.dt-buttons .buttons-excel,
.dt-buttons .buttons-csv,
.dt-buttons .buttons-pdf,
.dt-buttons .buttons-print {
  background: var(--thd-primary) !important;
  border: 1px solid rgba(0, 48, 96, 0.35) !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  padding: 6px 10px !important;
  box-shadow: 0 8px 18px rgba(0, 48, 96, 0.12) !important;
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dt-buttons.icon-only .dt-button,
.dt-buttons.icon-only .buttons-copy,
.dt-buttons.icon-only .buttons-excel,
.dt-buttons.icon-only .buttons-csv,
.dt-buttons.icon-only .buttons-pdf,
.dt-buttons.icon-only .buttons-print {
  width: 38px;
  height: 34px;
  padding: 0 !important;
}

/* Icon-only mode: hide label but keep button */
.dt-buttons.icon-only .dt-button,
.dt-buttons.icon-only .dt-button span {
  font-size: 0 !important;
  line-height: 0 !important;
}

.dt-buttons.icon-only .dt-button::before {
  content: "";
  width: 16px;
  height: 16px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

/* Inline SVG icons so no font dependency */
.dt-buttons.icon-only .buttons-excel::before,
.dt-buttons.icon-only .buttons-csv::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M8 13h8'/%3E%3Cpath d='M8 17h8'/%3E%3Cpath d='M9 9h1'/%3E%3C/svg%3E");
}

.dt-buttons.icon-only .buttons-copy::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}

.dt-buttons.icon-only .buttons-print::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9V2h12v7'/%3E%3Cpath d='M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'/%3E%3Cpath d='M6 14h12v8H6z'/%3E%3C/svg%3E");
}

.dt-buttons .dt-button:hover,
.dt-buttons .dt-button:focus {
  filter: brightness(1.08);
  color: #ffffff !important;
}

.dt-buttons .dt-button span {
  color: #ffffff !important;
}

/* Action column icon buttons (Edit/Delete) - works across modules */
button.edit_btn,
button.del_btn {
  width: 34px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px !important;
}

button.mail_btn,
button.whatsapp_btn {
  width: 34px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px !important;
}

button.edit_btn i,
button.del_btn i {
  font-size: 16px;
  line-height: 1;
}

button.mail_btn i,
button.whatsapp_btn i {
  font-size: 16px;
  line-height: 1;
}

/* Hide internal DT custom excel button when externalized */
.dt-buttons .thd-hidden-excel-btn {
  display: none !important;
}

/* DataTables controls spacing (buttons vs length dropdown) */
.dt-buttons {
  margin-right: 10px !important;
}

.dt-buttons + .dataTables_length,
.dt-buttons + .thd-forced-length,
.dt-buttons + div .dataTables_length,
.dt-buttons + div .thd-forced-length {
  margin-left: 10px !important;
}

