﻿/* CSS Cơ bản */
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f6f9; margin: 0; padding: 0; font-size: 14px; }
.login-container {
    display: flex;
    flex-direction: column; /* Xếp các thành phần theo chiều dọc từ trên xuống */
    align-items: center;    /* Canh giữa theo chiều ngang */
    min-height: 100vh;      /* Chiều cao bằng 100% màn hình */
    padding: 0;             /* Xóa padding mặc định để menu sát vào viền 2 bên */
}
.login-box {
    margin: auto; /* Tự động canh giữa khung đăng nhập vào không gian dọc còn lại */
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 92%; /* Thiết lập 92% thay vì 100% để trên điện thoại không bị dính mép màn hình */
    max-width: 400px;
    text-align: center;
}
.login-box h2 { color: #ee0033; margin-bottom: 20px; }
.form-control { width: 100%; padding: 10px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 4px; box-sizing: border-box; }
.btn { padding: 8px 12px; border: none; border-radius: 4px; cursor: pointer; color: white; margin-right: 3px; font-weight: 500; font-size: 13px; display: inline-block; text-decoration: none; }
.btn-login { width: 100%; background: #ee0033; padding: 12px; font-size: 16px; margin-bottom: 10px;}
.btn-primary { background: #007bff; } .btn-success { background: #28a745; }
.btn-warning { background: #ffc107; color: #333; } .btn-danger { background: #dc3545; }
.btn-info { background: #17a2b8; } .btn-secondary { background: #6c757d; }
.btn-purple { background: #6f42c1; } .btn-navy { background: #001f3f; }
.manager-container { padding: 15px; max-width: 100%; margin: 0 auto; }

.top-menu-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.site-logo { margin-left: 14px; margin-right: 8px; }
.site-logo img { height: 42px; width: auto; display: block; }
.site-banner { text-align: center; margin: 10px 0; }
.site-banner img { max-width: 100%; height: auto; }


/* Hiệu ứng khi hết hạn - Vô hiệu hóa nút */
.disabled-tool { opacity: 0.5 !important; pointer-events: none !important; cursor: not-allowed !important; filter: grayscale(100%); }
.expired-banner { background-color: #f8d7da; color: #721c24; padding: 15px; text-align: center; font-weight: bold; border-radius: 8px; margin-bottom: 15px; border: 1px solid #f5c6cb; }

/* User Dropdown */
.user-dropdown { position: relative; display: inline-block; }
.dropbtn { background-color: #fff; color: #ee0033; padding: 8px 15px; font-size: 14px; border: 1px solid #ee0033; border-radius: 4px; cursor: pointer; font-weight: bold; display: flex; align-items: center; gap: 5px; }
.dropbtn:hover { background-color: #fcebeb; }
.dropdown-content { display: none; position: absolute; right: 0; background-color: #fff; min-width: 220px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 100; border-radius: 4px; border: 1px solid #ddd; overflow: hidden; }
.dropdown-content a, .dropdown-content div.dd-text { color: #333; padding: 12px 16px; text-decoration: none; display: block; font-size: 13px; border-bottom: 1px solid #eee; text-align: left; }
.dropdown-content a:hover { background-color: #f8f9fa; color: #007bff; }
.user-dropdown:hover .dropdown-content { display: block; }
.dd-text { background: #e8f4f8; font-weight: bold; color: #0072bc !important; }

/* Header & Toolbar - Tối ưu Responsive */
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 2px solid #ee0033; padding-bottom: 10px; flex-wrap: wrap; gap: 10px;}
.header h2 { color: #ee0033; margin: 0; font-size: 1.5rem; }
.toolbar, .bulk-toolbar { background: #fff; padding: 10px; border-radius: 8px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); gap: 10px; flex-wrap: wrap; }
.bulk-toolbar { background: #fff3cd; border: 1px solid #ffeeba; }
.toolbar-left, .toolbar-right { display: flex; gap: 5px; flex-wrap: wrap;}
.toolbar-right { flex-grow: 1; justify-content: flex-end; }
.search-box { padding: 8px; border: 1px solid #ccc; border-radius: 4px; width: 250px; max-width: 100%; }

.print-tools-container { display: flex; justify-content: space-between; align-items: center; width: 100%; flex-wrap: wrap; gap: 10px;}
.print-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;}
.print-right { display: flex; align-items: center; gap: 8px; background: #fff1e5; padding: 5px 10px; border-radius: 5px; border: 1px solid #f3c299; flex-wrap: wrap;}

/* Bảng dữ liệu - Tối ưu Cuộn ngang & Gọn gàng */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); background: #fff; margin-bottom: 20px;}
.grid-view { width: 100%; min-width: 1100px; border-collapse: collapse; background: white; white-space: normal; word-break: break-word; }
.grid-view th { background: #ee0033; color: white; padding: 6px 4px; text-align: left; font-size: 12px; }
.grid-view td { padding: 4px 4px; border-bottom: 1px solid #eee; font-size: 12px; vertical-align: middle; }
.grid-view tr:hover { background: #f9f9f9; }
.grid-view input[type="text"], .grid-view input[type="number"] { width: 100%; padding: 4px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; }
.txt-order { width: 50px !important; text-align: center; font-weight: bold; color: #001f3f; }
.grid-view .btn { padding: 4px 8px; font-size: 11px; margin-right: 2px; }

/* Phân trang */
.grid-view tr.custom-pager td { border-bottom: none; padding: 0; background: #f8f9fa; border-top: 1px solid #ddd; }
.pager-flex-container { display: flex; justify-content: flex-start; gap: 20px; align-items: center; width: 100%; padding: 10px 15px; box-sizing: border-box; }
.pager-total-label { font-size: 14px; font-weight: 500; color: #333; }
.custom-pager table { margin: 0; border-collapse: collapse; }
.custom-pager table td { border: none !important; padding: 0 2px !important; }
.custom-pager a, .custom-pager span { display: inline-block; padding: 6px 12px; border: 1px solid #dee2e6; border-radius: 4px; color: #007bff; text-decoration: none; font-size: 14px; font-weight: 500; background-color: #fff; }
.custom-pager a:hover { background-color: #e9ecef; }
.custom-pager span { background-color: #ee0033; color: white; border-color: #ee0033; font-weight: bold; }

/* Khung Đăng ký / Admin */
.add-panel { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 700px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.add-header { color: #28a745; margin-bottom: 15px; text-align: center; border-bottom: 1px solid #eee; padding-bottom: 10px; }
.form-row { margin-bottom: 10px; text-align: left;} .form-row label { display: block; font-weight: bold; margin-bottom: 4px; color: #555; font-size: 13px; }
.qr-payment-box { background: #f8f9fa; border: 1px dashed #ccc; padding: 15px; border-radius: 8px; text-align: center; margin-top: 15px;}
.qr-payment-box img { width: 200px; height: 200px; border-radius: 8px; border: 2px solid #ee0033;}
.status-badge { padding: 4px 8px; border-radius: 4px; font-weight: bold; font-size: 12px; }
.status-active { background: #d4edda; color: #155724; } .status-expired { background: #f8d7da; color: #721c24; }

#pnlReceiptContainer { display: none; }

@media (max-width: 768px) {
    .header, .toolbar, .bulk-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { flex-direction: column; }
    .search-box { width: 100% !important; }
    .btn { width: 100%; margin-bottom: 5px; text-align: center; margin-right: 0; }
}

/* --- CSS IN ẤN --- */
@media print {
    @page { size: A5 landscape; margin: 0; }
    body { margin: 0; padding: 0; -webkit-print-color-adjust: exact; }
    #form1 > *:not(#pnlReceiptContainer) { display: none !important; }
    #pnlReceiptContainer { display: block !important; width: 100%; background: white; }
    .single-receipt-page { position: relative; width: 210mm; height: 147mm; padding: 5mm 10mm; box-sizing: border-box; font-family: 'Times New Roman', serif; color: #000; background: white; overflow: hidden; page-break-after: always; display: flex; flex-direction: column; }
    #defaultSingleReceipt { display: none; }
    .main-receipt { flex-grow: 1; position: relative; }
    .watermark-img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60%; opacity: 0.15; z-index: 0; }
    .receipt-content { position: relative; z-index: 1; }
    .receipt-header { display: flex; justify-content: space-between; margin-bottom: 5px; }
    .receipt-header-left h3 { color: #ee0033 !important; margin: 0 0 2px 0; font-size: 15px; font-weight: bold; }
    .receipt-header-right strong { color: #ee0033 !important; font-size: 12px; }
    .receipt-header-left div { font-size: 10px; margin-bottom: 1px; }
    .logo-small { height: 30px; margin-top: 2px; }
    .receipt-header-right { text-align: right; font-size: 10px; }
    .receipt-title { text-align: center; margin: 0px 0 5px 0; }
    .receipt-title h1 { margin: 0; font-size: 22px; font-weight: bold; text-transform: uppercase; }
    .receipt-title p { margin: 0; font-size: 12px; font-style: italic; }
    .receipt-title .sub-title { font-weight: bold; font-size: 13px; margin-top: 2px; }
    .receipt-body { font-size: 13px; line-height: 1.4; margin-left: 5px; margin-top: 5px; padding-right: 135px; box-sizing: border-box; }
    .receipt-row { margin-bottom: 4px; }
    .receipt-label { font-weight: bold; margin-right: 4px; }
    .receipt-value { font-weight: bold; }
    .qr-code-container { position: absolute; top: 50px; right: 5px; display: flex; flex-direction: column; align-items: center; z-index: 10; width: 125px; background: rgba(255,255,255,0.8); border-radius: 4px; padding-bottom: 2px;}
    .qr-code-container img { width: 95px; height: 95px; border: 1px solid #ccc; padding: 2px; background: #fff; border-radius: 4px; }
    .custom-qr-text { text-align: center; font-size: 11px; margin-top: 2px; line-height: 1.2; font-family: sans-serif;}
    .custom-qr-text .bank-name { font-weight: bold; color: #00a651; font-size: 11px;}
    .custom-qr-text .acc-name { font-weight: bold; font-size: 11px; }
    .custom-qr-text .acc-num { font-weight: bold; font-size: 12px; }
    .custom-qr-text .amount { font-weight: bold; color: #ee0033; font-size: 11px; }
    .qr-text { font-size: 11px; font-weight: bold; margin-top: 2px; color: #ee0033; text-align: center; font-style: italic; }
    .receipt-footer { position: absolute; bottom: 5px; right: 5px; text-align: center; width: 250px; z-index: 10; }
    .footer-content .date { font-style: italic; font-size: 12px; margin-bottom: 2px; }
    .footer-content .sign-title { font-weight: bold; font-size: 12px; font-style: italic; }
    .footer-content .sign-box { height: 50px; display: flex; align-items: flex-end; justify-content: center; color: #ee0033; }
    .cut-line { border-top: 1px dashed #000; margin: 5px 0; position: relative; }
    .cut-line::after { content: "✂ Cắt tại đây"; position: absolute; right: 0; top: -10px; font-size: 10px; background: white; padding-left: 5px; font-style: italic; }
    .stub-section { height: 35mm; font-size: 12px; display: flex; justify-content: space-between; padding-top: 5px; }
    .stub-left { width: 65%; }
    .stub-right { width: 35%; text-align: center; border-left: 1px dotted #ccc; padding-left: 5px;}
    .stub-row { display: flex; margin-bottom: 3px; }
    .stub-label { width: 90px; font-weight: normal; color: #555; }
    .stub-val { font-weight: bold; }
    .receipt-note { margin-top: 15px; padding: 10px; font-size: 18px; font-style: italic; color: blue !important; font-weight: bold; text-align: left; }
}

/* =========================================
   CSS CHO THANH MENU (CHUNG & HIỆU ỨNG) 
   ========================================= */
.top-menu-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Menu trong khung Đăng nhập */
/* Menu trong trang Đăng nhập (Gắn lên đầu trang) */
/* Menu trong trang Đăng nhập (Gắn lên đầu trang) */
.login-menu {
    position: relative; /* Trả về dạng tĩnh, tự nằm ở trên cùng của trang */
    width: 100%;
    justify-content: center;
    background-color: #ffffff;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-bottom: 1px solid #dee2e6;
    box-sizing: border-box;
}

/* Menu trong trang Quản lý (nằm ngang hàng) */
.manager-menu {
    flex: 1; /* Choán không gian ở giữa, đẩy "Xin chào" sang phải */
    padding-left: 30px;
}

/* Nút menu và Hiệu ứng 3D */
.menu-btn {
    text-decoration: none;
    color: #495057;
    font-weight: bold;
    font-size: 14px;
    padding: 8px 20px;
    border-radius: 8px; /* Bo góc tròn */
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Bóng đổ nhẹ */
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    display: inline-block;
}

/* Lướt chuột (Hover): Đổi xanh và nổi bổng lên */
.menu-btn:hover {
    background-color: #007bff;
    color: #ffffff !important;
    border-color: #007bff;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.4);
    transform: translateY(-2px); 
}

/* Bấm chuột (Active): Lún nhún xuống mượt mà */
.menu-btn:active {
    transform: scale(0.92) translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Responsive cho menu trên điện thoại */
@media (max-width: 768px) {
    .manager-menu {
        padding-left: 0;
        justify-content: center;
        width: 100%;
        margin: 10px 0;
    }
	.login-container {
        padding-top: 40px; /* Thêm padding top để đẩy khung đăng nhập xuống */
        align-items: flex-start; /* Canh lên trên thay vì giữa để không bị che khuất */
        min-height: auto; /* Bỏ min-height cố định */
    }
    
    .login-box {
        margin-top: 20px; /* Khoảng cách phụ thêm nếu cần */
    }
}