/* HAHA OPERATING SYSTEM V1.0 - HAHA ECO TRAVEL CRM & ERP STYLES */

/* Tối ưu cuộn trang */
html {
  scroll-behavior: smooth;
}

/* Tùy chỉnh thanh cuộn cho bảng */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Hiệu ứng mượt mà khi hover dòng dữ liệu */
tbody tr {
  transition: all 0.15s ease-in-out;
}

tbody tr:hover {
  background-color: #f8fafc;
}

/* Badge trạng thái chăm sóc */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.status-badge-new {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.status-badge-advising {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.status-badge-won {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.status-badge-lost {
  background-color: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Nút thao tác nhanh Sửa / Xóa */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.15s;
}

.action-btn-edit {
  color: #0369a1;
  background-color: #f0f9ff;
  border: 1px solid #e0f2fe;
}
.action-btn-edit:hover {
  background-color: #0284c7;
  color: #ffffff;
}

.action-btn-delete {
  color: #be123c;
  background-color: #fff1f2;
  border: 1px solid #ffe4e6;
}
.action-btn-delete:hover {
  background-color: #e11d48;
  color: #ffffff;
}

/* Hiệu ứng khi cảnh báo trùng số điện thoại */
.input-error {
  border-color: #f43f5e !important;
  background-color: #fff1f2 !important;
  color: #881337 !important;
}

/* Nút lọc trạng thái */
.filter-btn.active {
  background-color: #047857 !important;
  color: #ffffff !important;
  border-color: #047857 !important;
}

/* Sidebar navigation */
.nav-item {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: #475569;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background-color: #f1f5f9;
  color: #047857;
}

.nav-item.active {
  background-color: #ecfdf5;
  color: #047857;
  border-left: 3px solid #059669;
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav-item.disabled:hover {
  background-color: transparent;
  color: #94a3b8;
}

/* Role badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-ceo {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.role-sale {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.role-ops {
  background-color: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.role-acc {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.role-ctv {
  background-color: #fdf4ff;
  color: #a21caf;
  border: 1px solid #f0abfc;
}

/* Trạng thái tài khoản: Active / Locked */
.account-badge-active {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.account-badge-locked {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  background-color: #ffe4e6;
  color: #be123c;
  border: 1px solid #fda4af;
}

/* Thanh quy trình tiến độ tour 4 bước cho CTV (Customer Journey Pipeline) */
.pipeline-container {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pipeline-step {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.pipeline-done {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.pipeline-current {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  box-shadow: 0 0 0 1px #f59e0b;
}

.pipeline-future {
  background-color: #f8fafc;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
}

/* Tab chuyển đổi trong cổng CTV */
.ctv-tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 0.75rem;
  transition: all 0.15s;
}

.ctv-tab-btn.active {
  background-color: #047857;
  color: #ffffff;
}

.ctv-tab-btn:not(.active) {
  background-color: #ffffff;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.ctv-tab-btn:not(.active):hover {
  background-color: #f8fafc;
  color: #1e293b;
}

/* ========================================== */
/* CÁC LỚP BỔ SUNG CHO TOÀN BỘ CÁC PHÂN HỆ HAHA OS V1.0 */
/* ========================================== */

/* 1. BADGE TRẠNG THÁI ĐƠN TOUR (8 TRẠNG THÁI CHUẨN) */
.booking-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.booking-badge-new {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.booking-badge-pending {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.booking-badge-deposit {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.booking-badge-paid {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.booking-badge-in-progress {
  background-color: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.booking-badge-completed {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.booking-badge-cancelled {
  background-color: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

.booking-badge-refunded {
  background-color: #ffe4e6;
  color: #be123c;
  border: 1px solid #fda4af;
}

/* 2. TRẠNG THÁI VẬN HÀNH TOUR & TÀI CHÍNH */
.tour-op-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.tour-op-not-started { background-color: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.tour-op-running { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.tour-op-finished { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.tour-op-incident { background-color: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }

/* 3. TRẠNG THÁI HOA HỒNG (6 BƯỚC) */
.comm-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}

.comm-badge-pending { background-color: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }
.comm-badge-eligible { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.comm-badge-approved { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.comm-badge-paid { background-color: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.comm-badge-adjusted { background-color: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.comm-badge-cancelled { background-color: #ffe4e6; color: #be123c; border: 1px solid #fda4af; }

/* 4. TRẠNG THÁI MỞ BÁN SẢN PHẨM TOUR */
.tour-sale-selling { background-color: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.tour-sale-paused { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.tour-sale-closed { background-color: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }

/* 5. THANH TIẾN TRÌNH THANH TOÁN (PAYMENT PROGRESS BAR) */
.payment-progress-bar {
  width: 100%;
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.payment-progress-fill {
  height: 100%;
  background-color: #10b981;
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* 6. NÚT THAO TÁC BỔ SUNG */
.action-btn-pay {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #d1fae5;
}
.action-btn-pay:hover {
  background-color: #059669;
  color: #ffffff;
}

.action-btn-detail {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.action-btn-detail:hover {
  background-color: #334155;
  color: #ffffff;
}

.action-btn-ops {
  background-color: #faf5ff;
  color: #7e22ce;
  border: 1px solid #f3e8ff;
}
.action-btn-ops:hover {
  background-color: #7e22ce;
  color: #ffffff;
}

/* 7. PHÂN TRANG (PAGINATION FOR 1,000+ RECORDS) */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  border-top: 1px solid #f1f5f9;
  font-size: 0.75rem;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background-color: #ffffff;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.pagination-btn.active {
  background-color: #047857;
  border-color: #047857;
  color: #ffffff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 8. HIỆU ỨNG TẢI & CHỐNG GỬI LẶP (IDEMPOTENCY / DEBOUNCE SPINNER) */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

/* 9. THẺ CHỈ SỐ TÀI CHÍNH (FINANCIAL STAT CARDS) */
.fin-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fin-indicator-positive {
  color: #15803d;
  background-color: #dcfce7;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 700;
}

.fin-indicator-negative {
  color: #be123c;
  background-color: #ffe4e6;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 700;
}

/* 10. TRẠNG THÁI BÁO GIÁ TOUR */
.quote-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.quote-badge-draft { background-color: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.quote-badge-pending { background-color: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.quote-badge-confirmed { background-color: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.quote-badge-converted { background-color: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }
.quote-badge-rejected { background-color: #ffe4e6; color: #be123c; border: 1px solid #fda4af; }

/* 11. MODAL & CONTAINER TOUCH SCROLL ENHANCEMENTS */
.overscroll-contain {
  overscroll-behavior: contain;
}
.touch-pan-y {
  touch-action: pan-y;
}
.overflow-y-auto {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.overflow-y-auto::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.overflow-y-auto::-webkit-scrollbar-track {
  background: transparent;
}
.overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background-color: #94a3b8;
}


/* ============================================================ */
/* TOI UU GIAO DIEN DI DONG & MAY TINH TOAN DIEN                */
/* CUON TRANG MUOT MA LEN XUONG - KHONG KET MOUSE WHEEL & TOUCH  */
/* ============================================================ */

html {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  overflow-x: hidden !important;
  overflow-y: visible !important;
  min-height: 100%;
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative;
  -webkit-overflow-scrolling: touch;
  touch-action: auto !important;
}

#main-app, #login-screen {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
  min-height: 100%;
}

/* Dam bao toan bo bang du lieu cuon ngang ben trong, nhung KHONG CHAN cuon doc cua chuot/tay */
.overflow-x-auto {
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100% !important;
  width: 100% !important;
  display: block;
  overscroll-behavior-x: contain !important;
  overscroll-behavior-y: auto !important;
  overscroll-behavior: auto !important;
  touch-action: pan-y pan-x !important;
}

/* Cho phep luot ca 2 chieu tren bang: cuon doc trang & vuot ngang cot bang */
table {
  touch-action: pan-y pan-x !important;
}

tbody, tr, td, th {
  touch-action: auto !important;
}

@media (max-width: 768px) {
  /* Container gon cho man hinh dien thoai 360px - 412px */
  .max-w-7xl {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  /* Khac phuc thanh tab khong bao gio tran ngang */
  .ctv-tab-btn, .filter-btn, .fin-tab-btn {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.725rem !important;
    white-space: nowrap;
  }

  /* Tu dong ngat dong cac cum nut tren mobile */
  .flex.items-center.space-x-2,
  .flex.items-center.space-x-3 {
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  /* Bang khong duoc vuot qua chieu rong container */
  table {
    min-width: 100%;
  }

  /* Modal vua khit man hinh di dong */
  .fixed.inset-0 > div {
    max-width: 95vw !important;
  }

  /* Tranh tran chu */
  h1, h2, h3, h4, p, span {
    word-break: break-word;
  }
}
/* V2.13: cong dang nhap rieng (/ctv, /ncc, /nhan-vien): an nut doi cong, moi nhom chi thay cong cua minh */
body.portal-locked [onclick="showPortalGateway()"], body.portal-locked [onclick^="copyPortalLink"] { display: none !important; }
