/* style.css - File CSS hoàn chỉnh (Responsive và Tiêu đề 1 dòng) */

/* --- ĐỊNH NGHĨA BIẾN MÀU --- */
:root {
    --vnua-header-green: #0a7337; /* MÃ MÀU CHÍNH XÁC: Xanh lá đậm cho Top Bar */
    --vnua-light-blue: #e6f0ff; /* Màu xanh nhạt cho Banner/Header */
    --vnua-green: #0056b3; /* Màu xanh tiêu đề */
}

/* Thiết lập body và container */
body {
    background-color: #f4f4f4;
    font-family: Arial, sans-serif;
    margin: 0; 
    padding: 0;
}

/* --- PHẦN TOP BAR --- */
.top-bar {
    background-color: var(--vnua-header-green); /* Màu: #0a7337 */
    color: white;
    padding: 5px 20px;
    text-align: right;
    font-size: 0.9rem;
    display: block; 
}
.top-bar a {
    color: white;
    text-decoration: none;
    margin-left: 15px;
    transition: color 0.2s; 
}
.top-bar a:hover {
    color: #ffc107; /* Màu vàng khi hover */
}
/* Ẩn navigation bar cũ (nếu có) */
.main-nav-bar {
    display: none;
}

/* Định kiểu cho Tiêu đề Banner chính (ĐÃ GỘP THÀNH 1 DÒNG) */
.main-header {
    background-color: var(--vnua-light-blue); 
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    text-align: center; 
    display: block; 
}
.main-header h1 {
    color: var(--vnua-green); 
    /* Tăng cỡ chữ để tương đương với tiêu đề 2 dòng cũ */
    font-size: 2rem; 
    font-weight: bold;
    margin: 0;
    line-height: 1.2;
}


/* CONTAINER */
.container {
    padding: 20px 5%; 
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* --- Form Lọc --- */
.filter-form {
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 20px; 
    margin-bottom: 30px;
    padding: 15px 20px;
    border: none;
    border-radius: 12px; 
    background-color: #f0f8ff; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); 
}

.filter-form label {
    font-weight: bold;
    color: #333;
    font-size: 1rem;
}

.filter-form select {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fff;
    font-size: 1rem;
    min-width: 150px; 
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    appearance: none; 
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-6.4H18.6c-5.1%200-10.1%201.8-13.2%206.4-3.1%204.6-3.8%2010.5-2%2015.6l125.4%20165.4c4.6%206.1%2011.6%209.6%2018.6%209.6s14-%203.5%2018.6-9.6L289%2085c1.8-5.1%201.1-11-2-15.6z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

.filter-form select:focus {
    border-color: var(--vnua-green); 
    box-shadow: 0 0 5px rgba(0, 86, 179, 0.5); 
    outline: none;
}

.filter-form button[type="submit"] {
    padding: 10px 25px;
    background-color: var(--vnua-header-green); 
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.filter-form button[type="submit"]:hover {
    background-color: #0c8041; 
    transform: translateY(-1px);
}

/* --- DÒNG HIỂN THỊ THỜI GIAN ĐANG XEM --- */
.current-period {
    text-align: center;
    font-size: 1.1em; 
    color: #333; 
    font-weight: 600; 
    margin: 20px auto 30px auto; 
    padding: 12px 20px;
    background-color: #e3f3e3; 
    border: 1px solid #c8e6c8;
    border-radius: 8px;
    max-width: 400px; 
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* --- BẢNG DỮ LIỆU --- */
/* Thêm lớp bao bọc để tạo thanh cuộn ngang trên thiết bị nhỏ */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
}

table {
    /* Đảm bảo bảng hiển thị bình thường trên màn hình lớn */
    width: 100%; 
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}

th, td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
}

th {
    background-color: #e9ecef;
    font-weight: bold;
    color: #333;
}

.col-donvi {
    text-align: left;
}

.grand-total-row td {
    background-color: #d0e7ff; 
    font-weight: bold;
    color: #000;
}

.group-row td {
    background-color: #e0f0e0; 
    font-weight: bold;
    color: #000;
}

.ma-total-row td {
    background-color: #fffacd; 
    font-style: italic;
    font-weight: bold;
    color: #333;
}

.detail-row td {
    background-color: #ffffff;
    font-weight: normal;
}

/* --- Nút Chức Năng (In, Xuất File) --- */
.export-buttons {
    text-align: right;
    margin-bottom: 25px;
}

.action-btn {
    padding: 10px 18px; 
    margin-left: 10px;
    cursor: pointer;
    border: none;
    border-radius: 6px; 
    color: white;
    font-weight: bold;
    font-size: 0.95rem;
    transition: opacity 0.3s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.action-btn .emoji {
    margin-right: 5px;
}

.action-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.print {
    background-color: #6c757d; 
}

.excel {
    background-color: #28a745; 
}

.word {
    background-color: #007bff; 
}

.pdf {
    background-color: #dc3545; /* Màu đỏ cho nút PDF */
}

/* --- DÒNG CẢNH BÁO KHÔNG CÓ DỮ LIỆU --- */
.no-data {
    text-align: center;
    font-size: 1.1rem; 
    font-weight: bold;
    color: #a71d2a; 
    padding: 20px 30px;
    margin: 30px auto;
    background-color: #fff3f4; 
    border: 2px solid #e0b4b8; 
    border-radius: 10px; 
    max-width: 600px; 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05); 
}

/* ======================================= */
/* --- MEDIA QUERIES (RESPONSIVE) --- */
/* ======================================= */
@media (max-width: 768px) {
    /* Điều chỉnh Typography và Padding chung */
    .container {
        padding: 10px 10px;
        margin: 10px auto;
    }
    
    .main-header h1 { /* Chỉ cần chỉnh H1 vì H2 đã bị loại bỏ */
        font-size: 1.2rem;
    }
    .top-bar {
        text-align: center;
        padding: 5px 10px;
    }
    .top-bar a {
        display: block; 
        margin: 5px 0;
        font-size: 0.8rem;
    }

    /* Form Lọc: Chuyển sang xếp chồng dọc */
    .filter-form {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .filter-form label {
        align-self: flex-start; 
    }

    .filter-form select, 
    .filter-form button[type="submit"] {
        width: 100%; 
        box-sizing: border-box;
    }

    /* Dòng hiển thị thời gian */
    .current-period {
        max-width: 90%;
        font-size: 1em;
    }
    
    /* Nút Chức Năng: Chuyển sang xếp chồng và căn giữa */
    .export-buttons {
        text-align: center;
        display: flex;
        flex-wrap: wrap; 
        justify-content: center;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .action-btn {
        flex-grow: 1; 
        min-width: 120px;
        margin: 0; 
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    /* FIX LỖI: Buộc bảng có chiều rộng tối thiểu và không dùng width 100% để cuộn ngang hoạt động */
    .table-responsive table {
        min-width: 1000px; 
        width: auto; 
        font-size: 0.7em; 
    }
    
    /* Dòng cảnh báo */
    .no-data {
        max-width: 90%;
        font-size: 1rem;
        padding: 15px 20px;
    }
}

/* --- Xử lý khi in ấn --- */
@media print {
    body {
        background-color: #fff;
    }
    .top-bar, .main-header, .filter-form, .export-buttons {
        display: none; 
    }
    .container {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
    .table-responsive {
        overflow-x: visible; 
    }
    table {
        min-width: auto; 
        font-size: 10pt;
    }
    th, td {
        border-color: #000 !important;
    }
}