/* --- Reset & Base Styles --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa; /* Màu nền xám rất nhạt */
    color: #343a40;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Header --- */
.site-header {
    background-color: #ffffff;
    padding: 20px 0;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
    text-transform: uppercase;
}

.subtitle {
    font-size: 1rem;
    color: #6c757d;
    margin-top: 5px;
}

/* --- Main Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main .container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* --- Search Box --- */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

#searchInput {
    width: 100%;
    padding: 14px 20px 14px 50px; /* Thêm khoảng trống cho icon */
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f8f9fa;
}

#searchInput:focus {
    outline: none;
    border-color: #4d94ff;
    box-shadow: 0 0 0 3px rgba(77, 148, 255, 0.25);
}

/* Icon tìm kiếm */
.search-container::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    opacity: 0.8;
}

/* --- Summary & Messages --- */
#summaryCount {
    font-size: 0.95rem;
    color: #495057;
    margin-bottom: 15px;
}

#loading, #noResults {
    text-align: center;
    padding: 40px;
    font-size: 1.1em;
    color: #6c757d;
}

.hidden {
    display: none;
}

/* --- Table Styles --- */
.table-wrapper {
    overflow-x: auto; /* Thêm thanh cuộn ngang nếu bảng quá rộng */
}

#resultsTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#resultsTable th, #resultsTable td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef; /* Chỉ giữ lại đường kẻ ngang */
    vertical-align: top;
}

#resultsTable thead th {
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid #dee2e6;
}

#resultsTable tbody tr {
    transition: background-color 0.2s ease-in-out;
}

#resultsTable tbody tr:last-child td {
    border-bottom: none;
}

#resultsTable tbody tr:hover {
    background-color: #f1f3f5;
}

/* --- Pagination --- */
#paginationControls {
    margin-top: 30px;
    text-align: center;
    user-select: none;
}

.page-btn {
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    margin: 0 4px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.page-btn:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
}

.page-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    cursor: default;
}

.page-btn.disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.page-btn.disabled:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    h1 {
        font-size: 1.75rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    main .container {
        padding: 20px;
    }
    #resultsTable th, #resultsTable td {
        padding: 10px;
        font-size: 0.9rem;
    }
    .page-btn {
        padding: 6px 12px;
        margin: 0 2px;
    }
}
/* --- Thêm vào cuối tệp style.css --- */

/* Hiệu ứng fade-in cho bảng */
#resultsTable tbody {
    transition: opacity 0.3s ease-in-out;
}

#resultsTable.loading tbody {
    opacity: 0.5; /* Làm mờ bảng khi đang chờ kết quả mới */
}

/* Class để highlight từ khóa tìm kiếm */
.highlight {
    background-color: #ffe066; /* Màu vàng nhạt */
    font-weight: 600;
    border-radius: 3px;
    padding: 0 2px;
}

/* --- Thêm vào cuối tệp style.css --- */
.clear-search {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.6;
    display: none; /* Mặc định ẩn đi */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
}
.search-container.has-text .clear-search {
    display: block; /* Hiện ra khi có chữ */
}