/* FILE: /assets/css/style.css */
/* ========================================================================= */
/* 1. LAYOUT & TIỆN ÍCH CHUNG (CORE UTILITIES)                               */
/* ========================================================================= */
.mb-0 {
    margin-bottom: 0 !important;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.bg-input {
    background-color: var(--input-bg);
}

.tab-content {
    transition: opacity 0.2s ease;
}

/* ========================================================================= */
/* 2. MODULE TÀI CHÍNH (FINANCE UI)                                          */
/* ========================================================================= */
/* Bố cục lưới 60/40 */
.finance-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 1024px) {
    .finance-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Header & Title */
.f-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 12px;
}

.f-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    margin: 0;
}

/* Nút bấm Tài chính */
.btn-f-outline {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #4b5563;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-f-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* Bảng Phí Dịch Vụ */
.table-fees {
    width: 100%;
    border-collapse: collapse;
}

.table-fees th {
    padding: 8px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 2px solid #e5e7eb;
}

.table-fees td {
    padding: 12px 0;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px dashed #f3f4f6;
}

.table-fees tr:last-child td {
    border-bottom: none;
}

/* Tổng Thanh Toán (Blue Box) */
.summary-blue-box {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 16px 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.summary-row:last-child {
    margin-bottom: 0;
}

.summary-row .s-label, .summary-row .s-val {
    font-size: 13px;
    color: #1f2937;
}

.summary-row .s-val {
    text-align: right;
}

.s-divider {
    height: 1px;
    background-color: #bae6fd;
    margin: 12px 0;
}

.total-row .s-label {
    font-weight: 800;
    font-size: 14px;
    color: #000;
}

.total-row .s-val {
    font-weight: 800;
    font-size: 15px;
    color: #000;
}

/* Bảng Lịch Sử Giao Dịch */
.f-history-wrap {
    border-top: 1px solid #e5e7eb;
}

.table-history {
    width: 100%;
    border-collapse: collapse;
}

.table-history th {
    background: transparent;
    color: var(--text-main);
    font-weight: 700;
    font-size: 13px;
    padding: 12px 0;
    border-bottom: 2px solid #e5e7eb;
}

.table-history td {
    padding: 16px 0;
    font-size: 13px;
    color: #4b5563;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

/* ========================================================================= */
/* 3. COMPONENT NÂNG CAO (INPUTS, BUTTONS, UPLOAD, CHAT)                     */
/* ========================================================================= */

/* Input nâng cao: Nút lọt lòng (Đã gộp trùng lặp) */
.input-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.input-pr {
    padding-right: 42px !important;
}

.input-readonly {
    background: rgba(0, 0, 0, 0.04) !important;
    cursor: not-allowed !important;
    border-color: var(--glass-border) !important;
}

.btn-inside-input {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    width: 34px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    font-size: 11px;
    text-decoration: none;
    font-weight: 600;
}

.btn-inside-input:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 5px rgba(50, 150, 250, 0.3);
}

/* Vùng Upload Kế toán */
.upload-dropzone {
    border: 2px dashed var(--table-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.5);
    transition: 0.2s;
    cursor: pointer;
    text-align: center;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: rgba(50, 150, 250, 0.05);
}

.file-input-sm {
    padding: 5px;
}

.receipt-preview-img {
    max-height: 180px;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

/* Box Khách Hàng (Customer CRM) */
.c-info-box.box-primary {
    border: 1px solid #93c5fd;
}

.c-info-box.box-default {
    border: 1px solid #e5e7eb;
}

.c-info-box.box-danger {
    border: 1px solid #fecdd3;
    background-color: #fff1f2;
}

.c-info-box.box-warning {
    border: 1px solid #fde68a;
    background-color: #fefce8;
}

.branch-tag {
    background: #eff6ff;
    color: #3b82f6;
    border: 1px solid #bfdbfe;
}

/* Buttons Custom */
.btn-pill {
    border-radius: 50px !important;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Chat Module */
.chat-public {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.chat-public .chat-header {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.btn-send-success {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-send-success:hover {
    background: #059669;
}

/* ========================================================================= */
/* 4. ĐỒNG BỘ DARK MODE (LIQUID GLASS 2.0 ADAPTIVE)                          */
/* Đã gom toàn bộ các khối html[data-theme="dark"] về đây để dễ bảo trì      */
/* ========================================================================= */

/* Giao diện khối Tóm tắt Tài chính */
html[data-theme="dark"] .summary-blue-box {
    background-color: rgba(50, 150, 250, 0.05);
    border-color: rgba(50, 150, 250, 0.2);
}

html[data-theme="dark"] .summary-row .s-label,
html[data-theme="dark"] .summary-row .s-val,
html[data-theme="dark"] .total-row .s-label,
html[data-theme="dark"] .total-row .s-val {
    color: var(--text-main) !important;
}

html[data-theme="dark"] .s-divider {
    background-color: rgba(50, 150, 250, 0.2);
}

/* Nút bấm và Bảng biểu */
html[data-theme="dark"] .btn-f-outline {
    background: var(--input-bg) !important;
    border-color: var(--glass-border) !important;
    color: var(--text-main) !important;
}

html[data-theme="dark"] .btn-f-outline:hover {
    background: rgba(50, 150, 250, 0.15) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

html[data-theme="dark"] .table-fees th, html[data-theme="dark"] .table-history th {
    border-bottom-color: var(--glass-border);
    color: var(--text-main);
}

html[data-theme="dark"] .table-fees td, html[data-theme="dark"] .table-history td {
    border-bottom-color: var(--table-border);
    color: var(--text-muted);
}

html[data-theme="dark"] .table-history thead tr {
    background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] .f-history-wrap {
    border-top-color: var(--glass-border);
}

/* Form, Select, Input & Trạng thái Focus */
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    color: var(--text-main) !important;
    border-color: var(--primary) !important;
}

html[data-theme="dark"] select option {
    background-color: var(--bg-deep) !important;
    color: var(--text-main) !important;
}

html[data-theme="dark"] select option:disabled {
    color: var(--text-muted) !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] .input-readonly {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .btn-inside-input {
    background: var(--primary) !important;
    color: #fff !important;
}

/* Khối Upload Ảnh */
html[data-theme="dark"] .upload-dropzone {
    background: rgba(0, 0, 0, 0.2) !important;
    border-color: var(--glass-border);
}

html[data-theme="dark"] .upload-dropzone:hover {
    background: rgba(50, 150, 250, 0.1) !important;
    border-color: var(--primary);
}

/* Checkbox Dịch vụ VAS */
html[data-theme="dark"] .service-pill-text {
    background: var(--input-bg);
    color: var(--text-muted);
    border-color: var(--glass-border);
}

html[data-theme="dark"] .vas-checkbox-hidden:checked + .service-pill-text {
    background: rgba(50, 150, 250, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

/* Modals */
html[data-theme="dark"] #surchargeModal .glass-card {
    background: var(--bg-deep) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
    border: 1px solid var(--glass-border) !important;
}

html[data-theme="dark"] #surchargeModal h3 {
    color: var(--primary) !important;
}

/* Khối CRM (Customer Info & Chat) */
html[data-theme="dark"] .c-info-box {
    background: var(--glass-bg);
}

html[data-theme="dark"] .c-info-box.box-primary {
    border-color: rgba(59, 130, 246, 0.3);
}

html[data-theme="dark"] .c-info-box.box-default {
    border-color: var(--glass-border);
}

html[data-theme="dark"] .c-info-box.box-danger {
    border-color: rgba(239, 68, 68, 0.3);
    background-color: rgba(239, 68, 68, 0.05);
}

html[data-theme="dark"] .c-info-box.box-warning {
    border-color: rgba(245, 158, 11, 0.3);
    background-color: rgba(245, 158, 11, 0.05);
}

html[data-theme="dark"] .branch-tag {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

html[data-theme="dark"] .tabs-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: var(--glass-border);
}

html[data-theme="dark"] .chat-content {
    background: rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .chat-input-area {
    background: var(--bg-deep);
}

html[data-theme="dark"] .fixed-action-bar {
    background: rgba(15, 23, 42, 0.95);
}

/* Ảnh QR Data View */
html[data-theme="dark"] .data-img-card {
    background: var(--glass-bg) !important;
    border-color: var(--glass-border);
}

html[data-theme="dark"] .data-img-header {
    background: rgba(0, 0, 0, 0.3) !important;
    color: var(--text-main);
}

html[data-theme="dark"] .data-img-view {
    background: rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .data-img-view img {
    background: transparent !important;
}

html[data-theme="dark"] .data-img-actions {
    background: rgba(0, 0, 0, 0.3) !important;
}
/* ========================================================================= */
/* 5. CÁC BẢN VÁ LỖI HIỂN THỊ (DROPDOWN, MODAL SCROLL, ICON)                 */
/* ========================================================================= */

/* --- Cuộn nội dung cho các Modal (Lịch sử phí & Lịch sử tài chính) --- */
.modal-body {
    max-height: 55vh; /* Giới hạn chiều cao */
    overflow-y: auto; /* Bật cuộn dọc */
}
/* Tuỳ chỉnh thanh cuộn cho đẹp mắt */
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
}
html[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb {
    background-color: #475569;
}

/* Định dạng lại từng dòng lịch sử cho gọn gàng */
.audit-item {
    padding: 12px 0;
    border-bottom: 1px dashed #e5e7eb;
}
.audit-item:last-child {
    border-bottom: none;
}
.audit-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}
.audit-content {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 4px;
}
html[data-theme="dark"] .audit-item {
    border-bottom-color: var(--table-border);
}

/* --- Khắc phục hiển thị Dropdown Menu (Nút 3 chấm) --- */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}
.ant-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 5px); /* Cách nút một chút */
    z-index: 1000;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
}
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    transition: background 0.2s;
}
.dropdown-item:hover {
    background-color: #f3f4f6;
    color: var(--primary);
}
/* Dark mode cho Dropdown */
html[data-theme="dark"] .ant-dropdown-menu {
    background: var(--bg-deep);
    border-color: var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] .dropdown-item {
    color: var(--text-main);
}
html[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- Đảm bảo hiển thị Icon Ghi chú --- */
.info-icon {
    display: inline-block !important;
    vertical-align: middle;
    visibility: visible !important;
}
/* --- Xử lý hiển thị Dropdown khi Hover (Di chuột) hoặc Click (Class active) --- */

/* Ép ẩn menu mặc định (ghi đè mọi inline style) */
.dropdown-wrapper .ant-dropdown-menu {
    display: none !important; 
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
}

/* Kích hoạt hiển thị khi di chuột HOẶC khi click (có class active từ JS) */
.dropdown-wrapper:hover .ant-dropdown-menu,
.dropdown-wrapper.active .ant-dropdown-menu {
    display: block !important;
    animation: dropDownFadeIn 0.2s ease forwards;
}

/* Hiệu ứng trượt xuống mượt mà */
@keyframes dropDownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ========================================================================= */
/* BỔ SUNG CSS: CHAT BUBBLES & BADGE DISCOUNT (HỖ TRỢ DARK MODE)             */
/* ========================================================================= */

/* 1. Badge Ưu đãi giảm giá */
.badge-discount { 
    background: #d1fae5; color: #065f46; border: 1px solid #10b981; 
    font-size: 11px; padding: 2px 6px; border-radius: 4px;
}
html[data-theme="dark"] .badge-discount { 
    background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.5); 
}

/* 2. Khung nhập liệu Chat */
.chat-input-area {
    background: var(--glass-bg) !important;
    border-top: 1px solid var(--glass-border) !important;
}
.chat-input-area .form-control {
    border: 1px solid var(--input-border) !important;
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
}
html[data-theme="dark"] .chat-input-area .form-control:focus {
    border-color: var(--primary) !important;
}

/* 3. Bong bóng Chat (Chat Bubbles) */
.chat-bubble { 
    display: inline-block; padding: 8px 12px; border-radius: 8px; 
    max-width: 85%; word-wrap: break-word; text-align: left; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); font-size: 13px;
}
.chat-bubble.mine-public { background: #d1fae5; color: #065f46; }
.chat-bubble.mine-internal { background: #fef3c7; color: #b45309; }
.chat-bubble.other { background: #f1f5f9; color: #334155; }
.chat-sender-name { color: #555; font-weight: 600; }

/* Dark mode cho Chat Bubbles */
html[data-theme="dark"] .chat-bubble.mine-public { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
html[data-theme="dark"] .chat-bubble.mine-internal { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
html[data-theme="dark"] .chat-bubble.other { background: rgba(255, 255, 255, 0.05); color: #e2e8f0; }
html[data-theme="dark"] .chat-sender-name { color: #cbd5e1; }
/* Bổ sung vào trong khối :root { ... } */
:root {
    --info: #0ea5e9; /* Màu xanh nước biển nhạt cho trạng thái Đang thực hiện */
}

/* Thêm vào dưới cùng file base.css */
.confirm-icon-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px auto;
    background: transparent;
    transition: all 0.3s ease;
}
/* ========================================================================= */
/* MODULE: HOÀN THIỆN GIAO DIỆN MOBILE & MENU HAMBURGER (SIDEBAR)            */
/* ========================================================================= */

/* 1. Nút Hamburger mặc định ẩn trên PC */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--primary);
    cursor: pointer;
    margin-right: 15px;
    padding: 4px;
    transition: color 0.3s ease;
}
.mobile-menu-btn:hover {
    color: var(--danger);
}

/* 2. Lớp màn đen mờ (Overlay) khi mở Menu trên Mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998; /* Nằm ngay dưới Sidebar (1000) */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 3. ĐIỀU CHỈNH TOÀN BỘ BỐ CỤC KHI MÀN HÌNH NHỎ HƠN 768PX (ĐIỆN THOẠI) */
@media (max-width: 768px) {
    
    /* Hiện nút 3 gạch */
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Giấu hoàn toàn thanh Sidebar sang mép trái màn hình (-260px) */
    .sidebar {
        left: calc(-1 * var(--sidebar-w)); 
        box-shadow: none;
    }

    /* Trạng thái khi bấm nút 3 gạch: Trượt Sidebar vào màn hình */
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 5px 0 25px rgba(0,0,0,0.4);
    }

    /* Đẩy phần nội dung chính (Main Wrapper) tràn full 100% màn hình */
    .main-wrapper, 
    html.sidebar-collapsed .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    /* Kéo dài thanh Navbar trên cùng dính sát lề trái */
    .top-navbar, 
    html.sidebar-collapsed .top-navbar {
        left: 0;
        padding: 0 15px; /* Thu gọn khoảng cách 2 bên cho đỡ chật */
    }

    /* Thanh Hành động ở đáy cũng phải kéo full lề trái */
    .fixed-action-bar,
    html.sidebar-collapsed .fixed-action-bar { 
        left: 0; 
    } 

    /* Thu nhỏ chữ Logo để tiết kiệm không gian Navbar */
    .nav-left h2 {
        font-size: 18px !important;
    }
    .nav-left small {
        display: none; /* Ẩn dòng chữ "Hệ Thống Lõi" trên điện thoại */
    }

    /* Ẩn chữ chào tên người dùng trên thanh Top (chỉ để lại ảnh Avatar) */
    .user-info {
        display: none;
    }
}