/* css/pages/attendance-form.css */
.attendance-form-container {
    max-width: 700px;
    margin: 2rem auto;
    background-color: var(--color-surface);
    padding: 2rem;
    border-radius: var(--border-radius-soft);
    box-shadow: var(--shadow-subtle);
}

.student-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-hard);
    max-height: 400px;
    overflow-y: auto;
}

.student-checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: var(--border-radius-hard);
    transition: background-color 0.2s ease;
}

.student-checkbox-item:hover {
    background-color: var(--color-surface-soft);
}

.student-checkbox-item input[type="checkbox"] {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.75rem;
}

.history-container {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.history-title {
    margin-bottom: 20px;
}

.history-item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-item-date {
    font-weight: bold;
    font-size: 1.1em;
}

.history-item-body ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 10px 0;
}

.history-item-notes {
    margin-top: 10px;
    font-style: italic;
    color: #555;
}

.history-container {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
    /* Đường kẻ phân cách với form */
}

.history-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
}

/* --- Ô tìm kiếm --- */
.history-search-container {
    margin-bottom: 20px;
}

#history-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#history-search-input:focus {
    outline: none;
    border-color: #4a90e2;
    /* Màu chủ đạo của bạn */
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* --- Bảng biểu Lịch sử --- */
.table-wrapper {
    overflow-x: auto;
    /* Giúp bảng có thể cuộn ngang trên màn hình nhỏ */
    border: 1px solid #ddd;
    border-radius: 8px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.history-table th,
.history-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
}

/* Bỏ đường kẻ của dòng cuối cùng */
.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.history-table tbody tr:hover {
    background-color: #f1f3f5;
    /* Màu nền khi di chuột qua */
}

/* Định dạng cho các cột cụ thể */
.history-table td:first-child,
/* Cột STT */
.history-table th:first-child {
    text-align: center;
    width: 60px;
}

.history-table td:last-child,
/* Cột Thao tác */
.history-table th:last-child {
    text-align: center;
}

/* Chữ in nghiêng cho trạng thái "Đi học đủ" */
.history-table td i {
    color: #888;
}

/* CSS cho nút nguy hiểm */
.button.button-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.button.button-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Thêm khoảng cách giữa 2 nút Sửa/Xóa */
.actions-cell .button {
    margin: 0 4px;
}

.attendance-form-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Khoảng cách giữa các hàng */
}

/* Tạo layout 2 cột cho ô chọn lớp và ngày */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Chia thành 2 cột bằng nhau */
    gap: 1.5rem;
    /* Khoảng cách giữa 2 cột */
}

/* Căn chỉnh label và input trong mỗi nhóm */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Khoảng cách giữa label và input */
}

/* Căn chỉnh lại nút bấm */
.attendance-form-container>button[type="submit"] {
    align-self: flex-start;
    /* Để nút co lại theo nội dung và căn trái */
    width: auto;
    min-width: 150px;
}

/* --- Responsive cho màn hình điện thoại --- */
@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
        /* Chuyển thành 1 cột duy nhất */
        gap: 1rem;
    }
}

.form-options {
    display: flex;
    gap: 2rem;
    margin-top: -0.5rem;
    /* Kéo lên gần hơn với hàng trên */
    margin-bottom: 1rem;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group-inline label {
    margin-bottom: 0;
    /* Bỏ margin bottom mặc định của label */
    cursor: pointer;
}

.page-header-new {
    text-align: center;
}

.history-title {
    text-align: center;
}

.history-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.attendance-form-container>button[type="submit"] {
    width: 100%;
    /* Kéo dài hết chiều ngang của form */
    padding: 12px;
    /* Thêm chút đệm cho đẹp hơn */
    font-size: 1.1rem;
}

.attendance-form-container select,
.attendance-form-container input[type="date"] {
    border-radius: 8px;
    /* <-- Giá trị bo tròn góc, bạn có thể thay đổi */
    border: 1px solid #ddd;
    padding: 10px;
    font-size: 1rem;
}

.pagination-container {
    margin-top: 20px;
    text-align: center;
}

.pagination-button {
    background-color: #fff;
    border: 1px solid #ddd;
    color: #4a90e2;
    padding: 8px 12px;
    margin: 0 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.pagination-button:hover {
    background-color: #f1f3f5;
}

.pagination-button.active {
    background-color: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

/* ==========================================================================
   History Section Styling
   ========================================================================== */

.history-container {
    margin-top: 3rem;
    background-color: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 70, 140, 0.08);
}

.history-title {
    font-size: 1.75rem;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color-translucent);
    padding-bottom: 1rem;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.filter-group select,
.filter-group input[type="month"],
.filter-group input[type="text"] {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--background-color-light);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.history-title {
    font-size: 1.75rem;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color-translucent);
    padding-bottom: 1rem;
}

.history-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.filter-group select,
.filter-group input[type="month"],
.filter-group input[type="text"] {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--background-color-light);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.filter-group button {
    padding: 0.6rem 1.2rem;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-group button:hover {
    background-color: var(--color-primary-dark);
}

.table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

/* ==========================================================================
   Action Buttons Styling (NEW)
   ========================================================================== */

.history-table .actions-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    /* Khoảng cách giữa các nút */
}

.actions-cell .button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.actions-cell .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- NEW: Note Icons Styling --- */
.note-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.9rem;
    color: #fff;
    margin: 0 4px;
    cursor: help;
    /* Thay đổi con trỏ chuột để người dùng biết có thể hover */
}

.note-icon.makeup {
    background-color: var(--color-warning);
    /* Màu vàng cho lớp bù */
}

.note-icon.substitute {
    background-color: var(--color-info);
    /* Màu xanh dương cho GV cover */
}

.form-option-item {
    background-color: var(--color-surface);
    padding: 1rem;
    border-radius: var(--border-radius-hard);
    border: 1px solid var(--color-border);
    flex: 1;
}

.form-option-item .form-group {
    margin-top: 1rem;
}

/* --- MỚI: Định dạng cho chi tiết ghi chú trong bảng --- */
.note-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.note-detail:last-child {
    margin-bottom: 0;
}

.note-detail.makeup {
    background-color: hsla(45, 100%, 51%, 0.1);
    color: hsl(45, 100%, 30%);
}

.note-detail.substitute {
    background-color: hsla(210, 100%, 50%, 0.1);
    color: hsl(210, 100%, 35%);
}



.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    padding: 8px 4px;
    color: var(--color-text-secondary);
    font-weight: 600;
}

.pagination-ellipsis:hover {
    background-color: transparent;
    cursor: default;
}

/* --- Modal Styles --- */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 2000;
    /* Tăng z-index để đảm bảo nó ở trên cùng */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(17, 24, 39, 0.6);
    /* Màu nền tối hơn, mờ hơn */
    backdrop-filter: blur(8px);
    /* Hiệu ứng kính mờ */
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    opacity: 0;
    /* Bắt đầu với độ mờ = 0 để tạo hiệu ứng */
    transition: opacity 0.3s ease;
}

/* Thêm lớp .active để điều khiển hiển thị và animation */
.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: #fff;
    margin: auto;
    padding: 0;
    /* Bỏ padding cũ để kiểm soát tốt hơn */
    border-radius: 12px;
    /* Bo góc lớn hơn */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 5px 10px rgba(0, 0, 0, 0.05);
    width: 90%;
    max-width: 500px;
    transform: scale(0.95);
    /* Hiệu ứng phóng to khi xuất hiện */
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    /* Ẩn các phần tử con bị tràn ra ngoài */
}

.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color-translucent);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    /* Điều chỉnh kích thước font */
    font-weight: 700;
    color: var(--color-text-primary);
    /* Thêm icon vào header */
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h3 i {
    color: var(--color-success);
    /* Màu xanh lá cho icon Excel */
}

/* Thêm icon vào header của modal */
.modal-header h3::before {
    content: '\f1c3';
    /* Font Awesome icon for file-excel */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--color-success);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    /* Khoảng cách giữa các form-group */
}

.modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Khoảng cách giữa label và input */
    width: 100%;
}

.modal-body .form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    /* Thêm khoảng cách nhỏ với input */
}


.modal-body .form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--background-color-light);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-primary);
    /* Đồng bộ font chữ */
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--color-danger);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background-color: var(--background-color-light);
    border-top: 1px solid var(--border-color-translucent);
}