/*----- Global Loader -----*/
.loader-bg {
  position: fixed;
  z-index: 50000;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.5);
}

.loader-icon {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  top: 45%;
  margin: 0 auto;
}

/*----- Global Loader -----*/

.dt-paging button.first,
.dt-paging button.previous,
.dt-paging button.next,
.dt-paging button.last {
  display: none !important;
}

div.dt-container div.dt-length,
div.dt-container div.dt-search {
  margin-block: 0.5rem;
}

.min-w-500 {
  min-width: 500px !important;
}

.min-w-400 {
  min-width: 400px !important;
}

.min-w-300 {
  min-width: 300px !important;
}

.min-w-200 {
  min-width: 200px !important;
}


@media (max-width: 767.98px) {
  .timeline.timeline-center .timeline-item {
    padding-inline: 2rem 1rem !important;
  }
}

.product-highlight {
  background-color: #fff3cd;
  /* vàng nhạt (Bootstrap warning bg) */
  border-left: 4px solid #ffc107;
  /* viền nhấn */
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/*----- Fix: DataTable scroll + fixedColumns border alignment -----*/
/*
  Nguyên nhân:
  1. datatables.bootstrap5.css có rule:
       .table-bordered > :not(caption) > * > * { border-width: 0; }
     Rule này xóa TOÀN BỘ border của th/td trong table-bordered.
  2. Khi scrollY=true, DataTables tách header và body thành 2 <table> riêng.
     Nếu border-width không đồng nhất giữa header và body → cột bị lệch.
  Fix: đảm bảo cả header lẫn body table đều dùng border-collapse: collapse
  và tất cả th/td đều có border-width đồng nhất.
*/

/* Ép border-collapse cho cả header và body table */
div.dt-scroll table.table-bordered {
  border-collapse: collapse !important;
}

/* Khôi phục border cho TẤT CẢ th/td trong cả header VÀ body */
div.dt-scroll table.table-bordered>thead>tr>th,
div.dt-scroll table.table-bordered>thead>tr>td,
div.dt-scroll table.table-bordered>tbody>tr>th,
div.dt-scroll table.table-bordered>tbody>tr>td {
  border-width: 1px !important;
  border-style: solid !important;
  border-color: var(--bs-border-color) !important;
}

/* Đảm bảo border trái cho cell đầu tiên luôn hiện */
div.dt-scroll table.table-bordered>thead>tr>th:first-child,
div.dt-scroll table.table-bordered>thead>tr>td:first-child,
div.dt-scroll table.table-bordered>tbody>tr>th:first-child,
div.dt-scroll table.table-bordered>tbody>tr>td:first-child {
  border-left-width: 1px !important;
}

/* Thêm border-top ngoài cùng cho header container.
   Dùng box-shadow thay border-top vì overflow:hidden có thể clip border. */
div.dt-scroll-head {
  box-shadow: 0 -1px 0 0 var(--bs-border-color);
}

/* Fix border-top cho thead row đầu tiên trong dt-scroll-head */
div.dt-scroll-head table.table-bordered>thead>tr:first-child>th,
div.dt-scroll-head table.table-bordered>thead>tr:first-child>td {
  border-top: 1px solid var(--bs-border-color) !important;
}

/* Đảm bảo dtfc-top-blocker không che border của header */
div.dt-scroll div.dtfc-top-blocker,
div.dtfh-floatingparent div.dtfc-top-blocker {
  height: 0 !important;
  display: none !important;
}

/* Fix border cho cột cố định (fixedColumns) khi scroll ngang/dọc.
   Vấn đề: border-collapse gộp border giữa 2 cell kề nhau.
   Khi cell bên cuộn đi → border chung biến mất.
   Giải pháp: dùng outline thay vì pseudo-element.
   outline không tham gia border-collapse, luôn vẽ đủ 4 cạnh.
   outline-offset: -1px đặt outline trùng vị trí border gốc:
   - Khi border gốc còn → outline chồng lên, không thấy khác biệt.
   - Khi border gốc mất (cell bên cuộn đi) → outline vẫn hiện. */
table.table-bordered th.dtfc-fixed-left,
table.table-bordered td.dtfc-fixed-left,
table.table-bordered th.dtfc-fixed-right,
table.table-bordered td.dtfc-fixed-right {
  border: 1px solid var(--bs-border-color) !important;
  outline: 1px solid var(--bs-border-color);
  outline-offset: -1px;
}

/*----- End Fix -----*/

/*----- FixedHeader mobile: border & z-index -----*/

/* Floating header inside a modal must sit above .modal (z-index:1055) */
.modal.show~.dtfh-floatingparent,
.dtfh-floatingparent-head {
  z-index: 1056 !important;
}

/* Keep borders on the floating header table */
.dtfh-floatingparent table.table-bordered {
  border-collapse: collapse !important;
}

.dtfh-floatingparent table.table-bordered>thead>tr>th,
.dtfh-floatingparent table.table-bordered>thead>tr>td {
  border-width: 1px !important;
  border-style: solid !important;
  border-color: var(--bs-border-color) !important;
  background-color: var(--bs-body-bg);
  vertical-align: middle;
}

/*----- End FixedHeader mobile -----*/

/*----- AI Chat Typing Indicator -----*/
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--bs-primary);
  opacity: 0.6;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-message-content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.85em;
}

.ai-message-content code {
  font-size: 0.9em;
}

.ai-message-content ul {
  margin-bottom: 0.5rem;
}

/* Chat layout: fill viewport height */
.app-chat.card {
  height: calc(100vh - 160px) !important;
  max-height: calc(100vh - 160px) !important;
  overflow: hidden !important;
}

.app-chat .row.g-0 {
  height: 100% !important;
}

.app-chat .col.app-chat-history {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.app-chat .chat-history-wrapper {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
}

/* Header and footer stay fixed */
.app-chat .chat-history-header {
  flex: 0 0 auto !important;
}

.app-chat .chat-history-footer {
  flex: 0 0 auto !important;
}

/* Chat body scrolls */
.app-chat .chat-history-body {
  flex: 1 1 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: 0 !important;
  max-height: none !important;
  height: auto !important;
}

/* Custom scrollbar */
.app-chat .chat-history-body::-webkit-scrollbar {
  width: 6px;
}

.app-chat .chat-history-body::-webkit-scrollbar-track {
  background: transparent;
}

.app-chat .chat-history-body::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.app-chat .chat-history-body::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.3);
}

/* Status indicator during thinking */
.ai-status-indicator {
  display: flex;
  align-items: center;
  padding: 4px 0;
  min-height: 32px;
}

.ai-status-indicator .spinner-border {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

/*----- End AI Chat -----*/

.opacity-90 {
  opacity: 0.90 !important;
}