/* 
 * Style sheet cho ứng dụng ReconPay - Excel Spreadsheet Theme
 * Thiết kế tinh tế, trực quan, dễ sử dụng với hệ lưới kẻ ô và tông màu xanh lá Excel cổ điển.
 */

@import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;600;700&display=swap');

:root {
  --bg-gradient: #f3f4f6;
  /* Nền xám nhạt văn phòng */
  --panel-bg: #ffffff;
  --panel-border: #cbd5e1;
  --text-primary: #1f2937;
  --text-muted: #4b5563;
  --accent-color: #107c41;
  /* Màu xanh lục thương hiệu Excel */
  --accent-glow: rgba(16, 124, 65, 0.15);
  --success-color: #107c41;
  --success-glow: rgba(16, 124, 65, 0.1);
  --danger-color: #dc2626;
  --danger-glow: rgba(220, 38, 38, 0.1);
  --gold-color: #d97706;
  --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --transition-smooth: all 0.15s ease-in-out;

  /* Spreadsheet Colors */
  --bg-form-container: #f9fafb;
  --border-grid: #d1d5db;
  /* Đường viền ô lưới Excel */
  --border-grid-light: #e5e7eb;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
}

/* Ẩn các hình tròn mờ nền tối để giữ giao diện bảng tính sạch sẽ */
.position-absolute[style*="z-index: -1"] {
  display: none !important;
}

/* Khung Panel thiết kế hộp phẳng (Boxy) như Excel */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: #9ca3af;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

/* Custom Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  color: #111827;
}

/* Gradient chữ chuyển thành màu xanh lá Excel sang trọng */
.gradient-text {
  background: #107c41;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

.gradient-text-success {
  background: #107c41;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Ô nhập liệu góc vuông/bo tròn rất nhẹ giống Excel */
.form-control-custom {
  background: #ffffff;
  border: 1px solid var(--border-grid);
  color: var(--text-primary) !important;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.form-control-custom:focus {
  background: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.form-control-custom::placeholder {
  color: #9ca3af;
}

/* Nhãn đầu vào (Input group icons) dạng phẳng */
.input-group-text-custom {
  background: #f3f4f6;
  border: 1px solid var(--border-grid);
  border-right: none;
  color: var(--text-muted);
  border-radius: 4px 0 0 4px;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 0.85rem;
}

.input-group-text-custom+.form-control-custom {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Preset Buttons */
.btn-preset {
  background: #ffffff;
  border: 1px solid var(--border-grid);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.775rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.btn-preset:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

/* Nút bấm phẳng kiểu Excel */
.btn-primary-custom {
  background: #107c41;
  border: 1px solid #0f703a;
  color: white !important;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.btn-primary-custom:hover {
  background: #0f703a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary-custom:active {
  background: #0a4d28;
}

/* Nút Submit chính */
.btn-success-custom {
  background: #107c41;
  border: 1px solid #0f703a;
  color: white !important;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  width: 100%;
  transition: var(--transition-smooth);
}

.btn-success-custom:hover {
  background: #0f703a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Outline Buttons */
.btn-outline-custom {
  background: #ffffff;
  border: 1px solid var(--border-grid);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.btn-outline-custom:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}

/* Khung chứa form chuyển thành dạng toolbar của Excel */
.card.bg-dark.bg-opacity-20 {
  background: var(--bg-form-container) !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 10px !important;
}

.card.bg-dark.bg-opacity-20 h6 {
  margin-bottom: 8px !important;
  font-size: 0.75rem !important;
  color: #4b5563 !important;
}

/* Khung cuộn bảng biểu */
.employee-list-container {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Thanh cuộn vuông vắn kiểu truyền thống */
.employee-list-container::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.employee-list-container::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.employee-list-container::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1 !important;
  border-radius: 0px;
}

.employee-list-container::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8 !important;
}

/* Nút xóa bản ghi dạng gọn gàng */
.btn-delete-employee {
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 0.9rem;
  padding: 2px 6px;
  border-radius: 3px;
  transition: var(--transition-smooth);
}

.btn-delete-employee:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* Huy hiệu bộ đếm */
.counter-badge {
  background: #107c41;
  color: white !important;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
}

/* --- HỆ THỐNG BẢNG LƯỚI KIỂU EXCEL (CRITICAL FOR GRIDLINES) --- */
.table-custom {
  margin-bottom: 0;
  color: var(--text-primary);
  border-collapse: collapse !important;
  width: 100%;
}

.table-custom th {
  background: #eaeaea !important;
  /* Xám nhạt Excel */
  border: 1px solid var(--border-grid) !important;
  color: #374151 !important;
  font-weight: 600;
  text-transform: none;
  /* Giữ nguyên hoa thường */
  font-size: 0.75rem;
  letter-spacing: 0;
  padding: 6px 10px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 5;
}

.table-custom td {
  background: #ffffff;
  border: 1px solid var(--border-grid-light) !important;
  padding: 6px 10px;
  vertical-align: middle;
  font-size: 0.8rem;
}

/* Kẻ sọc xen kẽ như Excel */
.table-custom tr:nth-child(even) td {
  background: #f9fafb;
}

/* Hiệu ứng chọn dòng hover màu xanh lá nhạt */
.table-custom tr:hover td {
  background: #f0fdf4 !important;
}

/* Result header card */
.result-header-card {
  background: #f0fdf4;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

/* Hộp Toast thông báo */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1060;
}

.toast-custom {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: var(--text-primary) !important;
}

.toast-custom .toast-header {
  color: var(--text-primary) !important;
  border-bottom: 1px solid #e5e7eb;
}

.toast-custom .btn-close {
  filter: none !important;
}

/* Empty State Styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.7;
  color: var(--accent-color);
}

/* Footer style */
footer {
  border-top: 1px solid var(--panel-border);
  padding: 12px 0;
  margin-top: 24px;
  background: #eaeaea;
}

footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Thẻ chỉ thị viền dọc Dashboard kiểu Excel */
.border-success-custom {
  border-left: 4px solid #107c41 !important;
}

.border-warning-custom {
  border-left: 4px solid #d97706 !important;
}

.border-danger-custom {
  border-left: 4px solid #dc2626 !important;
}

.border-info-custom {
  border-left: 4px solid #2563eb !important;
}

/* Trực quan hóa màu chữ thương hiệu Excel */
.text-indigo-custom {
  color: #107c41 !important;
}

.text-success-custom {
  color: #107c41 !important;
}

.text-warning-custom {
  color: #d97706 !important;
}

.text-danger-custom {
  color: #dc2626 !important;
}

.text-info-custom {
  color: #2563eb !important;
}

.bg-indigo-glow {
  background: rgba(16, 124, 65, 0.08) !important;
}

/* Custom styles cho Tabs */
.nav-tabs {
  border-bottom: 1px solid #cbd5e1;
}

.nav-tabs .nav-link {
  border: 1px solid transparent !important;
  border-bottom: none !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 4px 4px 0 0;
  transition: var(--transition-smooth);
}

.nav-tabs .nav-link.active {
  background: #ffffff !important;
  border-color: #cbd5e1 #cbd5e1 transparent !important;
  color: #107c41 !important;
  border-bottom: 2px solid #107c41 !important;
  /* Dòng gạch xanh lá dưới tab đang chọn */
}

.nav-tabs .nav-link:hover:not(.active) {
  background: #eaeaea !important;
  color: var(--text-primary) !important;
}

/* Hộp lỗi cảnh báo báo cáo (Spreadsheet error block style) */
.row-error-danger {
  background: #fef2f2 !important;
  /* Đỏ nhạt */
}

.row-error-danger td {
  border-color: #fca5a5 !important;
}

.row-error-danger:hover td {
  background: #fee2e2 !important;
}

.row-error-warning {
  background: #fffbeb !important;
  /* Vàng nhạt */
}

.row-error-warning td {
  border-color: #fde047 !important;
}

.row-error-warning:hover td {
  background: #fef3c7 !important;
}

.row-error-info {
  background: #eff6ff !important;
  /* Xanh lam nhạt */
}

.row-error-info td {
  border-color: #bfdbfe !important;
}

.row-error-info:hover td {
  background: #dbeafe !important;
}

/* Code highlight badge style */
.badge-code {
  font-family: monospace;
  letter-spacing: 0.5px;
  font-size: 0.75rem;
  padding: 2px 4px;
}

/* --- LIGHT THEME BOOTSTRAP OVERRIDES --- */
body .text-white-50 {
  color: var(--text-muted) !important;
}

body .text-white {
  color: var(--text-primary) !important;
}

body .bg-dark {
  background-color: var(--bg-form-container) !important;
}

body .bg-opacity-20 {
  --bs-bg-opacity: 1 !important;
}

.border-secondary {
  border-color: #cbd5e1 !important;
}

.border-opacity-10 {
  border-opacity: 1 !important;
}

.btn-close-white {
  filter: none !important;
}

/* Tránh chữ bị nhảy lấn hoặc vỡ khung trên các thẻ Dashboard */
/* Màu dòng đối soát hoàn tiền */
.row-error-refunded {
  background: #faf5ff !important;
}

.row-error-refunded td {
  border-color: #e9d5ff !important;
}

.row-error-refunded:hover td {
  background: #f3e8ff !important;
}

/* Thống kê hoàn tiền màu tím */
.border-refunded-custom {
  border-left: 4px solid #a855f7 !important;
}

.text-refunded-custom {
  color: #a855f7 !important;
}

.bg-refunded-glow {
  background: rgba(168, 85, 247, 0.08) !important;
}

/* Hộp chỉ thị cột 5 và 6 */
.row-cols-xl-5 .card,
.row-cols-xl-6 .card {
  padding: 10px 12px !important;
  /* Thu nhỏ padding trong card */
}

.row-cols-xl-5 .card h3,
.row-cols-xl-6 .card h3 {
  font-size: 1.25rem !important;
  /* Giảm nhẹ size h3 */
  font-weight: 700;
  margin-top: 2px !important;
  margin-bottom: 2px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-cols-xl-5 .card span.text-uppercase,
.row-cols-xl-6 .card span.text-uppercase {
  font-size: 0.65rem !important;
  /* Đảm bảo tiêu đề hoa không xuống dòng */
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.row-cols-xl-5 .card div.mt-2,
.row-cols-xl-6 .card div.mt-2 {
  font-size: 0.7rem !important;
  /* Dòng chữ nhỏ thống kê ở chân card */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-cols-xl-5 .card .bi,
.row-cols-xl-6 .card .bi {
  font-size: 1.35rem !important;
  /* Thu nhỏ icon để nhường chỗ cho chữ */
}

.row-cols-xl-5 .card div.p-3,
.row-cols-xl-6 .card div.p-3 {
  padding: 8px !important;
  /* Thu nhỏ padding bọc quanh icon */
}

/* Màu dòng đối soát thành công (Xanh lá) */
.row-success-matched {
  background: #f0fdf4 !important;
}

.row-success-matched td {
  border-color: #bbf7d0 !important;
}

.row-success-matched:hover td {
  background: #dcfce7 !important;
}

/* Drag and drop zone custom styling */
.drag-drop-zone {
  border: 2px dashed var(--panel-border) !important;
  background-color: #f8fafc !important;
  color: var(--text-muted) !important;
  border-radius: 8px !important;
  padding: 24px 16px !important;
  transition: all 0.2s ease-in-out !important;
}

.drag-drop-zone:hover {
  border-color: var(--accent-color) !important;
  background-color: var(--accent-glow) !important;
}

.drag-drop-zone.dragover {
  background: var(--success-glow) !important;
  border-color: var(--success-color) !important;
  border-style: solid !important;
  transform: scale(0.99);
}

.drag-drop-zone.dragover span {
  color: var(--success-color) !important;
}

/* Excel toolbar custom button styles */
.btn-toolbar-custom {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--text-primary);
  font-size: 0.775rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-toolbar-custom:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-toolbar-custom.btn-active-toggle {
  background: var(--accent-glow);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.btn-toolbar-success {
  background: #107c41 !important;
  border-color: #0f703a !important;
  color: #ffffff !important;
}

.btn-toolbar-success:hover {
  background: #0d6b38 !important;
  border-color: #0b5b2f !important;
}

.btn-toolbar-danger {
  color: #dc2626 !important;
}

.btn-toolbar-danger:hover {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
}

/* Table Header Sorting States */
.sort-header-internal:hover,
.sort-header-bank:hover {
  background-color: #d1d5db !important;
  color: #111827 !important;
}

.sort-header-internal i,
.sort-header-bank i {
  transition: transform 0.2s ease;
}

/* Toolbar horizontal scroll hide on premium theme */
.d-flex[style*="overflow-x: auto"]::-webkit-scrollbar {
  height: 4px;
}

.d-flex[style*="overflow-x: auto"]::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* Custom Resize Handle styling */
.custom-resize-handle {
  height: 8px;
  background: rgba(0, 0, 0, 0.03);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
  user-select: none;
  margin-top: 2px;
  margin-bottom: 8px;
  border-radius: 2px;
}

.custom-resize-handle:hover,
.custom-resize-handle.resizing {
  background: rgba(16, 124, 65, 0.15) !important;
  border-top-color: rgba(16, 124, 65, 0.3) !important;
  border-bottom-color: rgba(16, 124, 65, 0.3) !important;
}

.custom-resize-handle::after {
  content: "";
  width: 24px;
  height: 3px;
  border-top: 1px solid rgba(16, 124, 65, 0.4);
  border-bottom: 1px solid rgba(16, 124, 65, 0.4);
  opacity: 0.7;
}

/* Universal Bank Parser Modal & Preview Custom Styles */
#mapping-preview-table th {
  background: #eaeaea !important;
  color: #374151 !important;
  font-size: 0.7rem;
  padding: 4px 6px;
  border: 1px solid var(--border-grid) !important;
}

#mapping-preview-table td {
  font-size: 0.7rem;
  padding: 4px 6px;
  background: #ffffff;
  border: 1px solid var(--border-grid-light) !important;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.animate-modal {
  transition: transform 0.3s ease-out;
}