/* --- THIẾT LẬP TỔNG THỂ --- */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;700&display=swap');

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    color: #3a3a3a;
    margin: 0;
    background-image: url("https://images.pexels.com/photos/314726/pexels-photo-314726.jpeg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 80px;
    box-sizing: border-box;
}

/* --- ĐỊNH DẠNG KHUNG CHỨA --- */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 30px 40px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(14, 21, 47, 0.08);
    box-sizing: border-box;
    transition: all 0.3s ease-in-out;
}
#login-page, #home-page, #form-page, #class-list-page, #user-bar {
    max-width: 800px;
}
#schedule-details-page {
    max-width: 1200px;
}
#app-content {
    display: none; /* Sẽ được JS bật lên */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    flex-direction: column;
    align-items: center;
}

/* --- TRANG ĐĂNG NHẬP VÀ THANH USER --- */
.login-container { text-align: center; padding: 20px 0; }
#btn-google-login {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}
#btn-google-login:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
#btn-google-login img { width: 20px; height: 20px; margin-right: 12px; }
#user-bar { display: flex; justify-content: space-between; align-items: center; }

/* --- TIÊU ĐỀ --- */
header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid #e9ecef; }
header h1 { font-size: 2em; color: #0056b3; margin: 0 0 10px 0; }
header p { color: #6c757d; font-size: 1.1em; }
#schedule-details-page header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* --- TRANG CHỦ --- */
.home-buttons { display: flex; flex-direction: column; gap: 20px; margin-top: 20px; }
.home-buttons button { padding: 20px; font-size: 1.2em; font-weight: 700; border-radius: 12px; border: none; cursor: pointer; transition: all 0.3s ease; }
.home-buttons button:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
#btn-show-create-form { background-color: #007bff; color: white; }
#btn-show-class-list { background-color: #f8f9fa; color: #343a40; border: 1px solid #ddd; }

/* --- DANH SÁCH LỚP --- */
#class-list-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.class-item { background-color: #fff; border: 1px solid #e0e0e0; border-left: 6px solid #007bff; border-radius: 12px; padding: 20px; transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; justify-content: space-between; }
.class-item:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.class-info { cursor: pointer; }
.class-item h3 { margin: 0 0 10px 0; color: #0056b3; }
.class-item p { margin: 5px 0 0 0; color: #555; font-size: 0.95em; }
.class-item-actions { margin-top: 15px; padding-top: 10px; border-top: 1px solid #eee; text-align: right; }
.edit-btn { background-color: #ffc107; color: #212529; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; transition: background-color 0.2s ease; }
.edit-btn:hover { background-color: #e0a800; }
.delete-btn { background-color: #dc3545; color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 500; transition: background-color 0.2s ease; margin-left: 10px; }
.delete-btn:hover { background-color: #c82333; }

/* --- FORM --- */
.controls { display: flex; flex-direction: column; gap: 20px; }
.control-group { display: flex; flex-direction: column; }
label { font-weight: 500; margin-bottom: 8px; color: #343a40; }
select, input[type="date"], input[type="text"], input[type="number"], input[type="url"] { padding: 12px; border-radius: 8px; border: 1px solid #ced4da; font-size: 16px; width: 100%; box-sizing: border-box; }
form button[type="submit"] { padding: 12px 20px; border: none; background-color: #28a745; color: white; font-size: 16px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: background-color 0.3s ease; }
form button[type="submit"]:hover { background-color: #218838; }
.back-link { color: #007bff; text-decoration: none; font-weight: 500; }
.back-link:hover { text-decoration: underline; }
.error { color: red; text-align: center; margin-top: 15px; font-weight: 500; }

/* --- TRANG CHI TIẾT LỊCH --- */
.lookup-wrapper { background-color: #eaf6ff; border: 1px solid #bce0fd; border-radius: 12px; padding: 20px; margin-bottom: 30px; }
#lookup-summary { margin-top: 15px; background-color: #fff; padding: 15px; border-radius: 8px; min-height: 50px; }
#lookup-summary ul { padding-left: 20px; margin: 0; }
#lookup-summary li { margin-bottom: 8px; }
.table-header-wrapper { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-top: 1px solid #e9ecef; padding-top: 20px; margin-bottom: 20px; }
.table-title { grid-column: 2 / 3; text-align: center; color: #333; border-top: none; padding-top: 0; margin-bottom: 0; }
#btn-undo { grid-column: 3 / 4; justify-self: end; }
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; border: 1px solid #e9ecef; text-align: left; white-space: nowrap; }
th { background-color: #f8f9fa; font-weight: 700; position: sticky; top: 0; }
tbody tr:nth-child(even) { background-color: #f8f9fa; }
tbody tr:hover { background-color: #e9ecef; }
tbody tr.highlight { background-color: #fff3cd; }

/* --- ĐỊNH DẠNG SỬA TÊN BÀI HỌC --- */
.lesson-name-cell { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.lesson-name-text { flex-grow: 1; outline: none; padding: 2px 5px; border-radius: 4px; transition: background-color 0.2s ease; }
.lesson-name-text[contenteditable="true"] { background-color: #eaf6ff; outline: 2px solid #007bff; }
.lesson-actions { display: flex; gap: 5px; }
.lesson-actions button { background: none; border: none; cursor: pointer; font-size: 1.2em; padding: 4px; line-height: 1; opacity: 0.4; transition: opacity 0.2s; }
.lesson-actions button.active { opacity: 1; }
.lesson-actions button:hover { opacity: 1; }
.lesson-actions .confirm-lesson-btn { color: #28a745; }
.lesson-actions .cancel-lesson-btn { color: #dc3545; }
.hidden { display: none; }

/* --- ĐỊNH DẠNG NGÀY TEST TRÊN LỊCH --- */
tbody tr.mini-test-day td { background-color: #fff3cd; font-weight: 700; color: #856404; text-align: center; }
tbody tr.mini-test-day:hover td { background-color: #ffeeba; }
tbody tr.final-test-day td { background-color: #f8d7da; font-weight: 700; color: #721c24; text-align: center; }
tbody tr.final-test-day:hover td { background-color: #f5c6cb; }

/* --- CỬA SỔ POP-UP (MODAL) --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 12px; text-align: center; max-width: 400px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.modal-actions { margin-top: 20px; display: flex; justify-content: center; gap: 15px; }
button, .btn-secondary, .btn-primary { padding: 10px 20px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; font-family: 'Be Vietnam Pro', sans-serif; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-secondary { background-color: #6c757d; color: white; }
.btn-primary { background-color: #007bff; color: white; }
button:disabled { background-color: #ccc; cursor: not-allowed; }

/* --- FOOTER --- */
.footer-text { text-align: center; padding: 15px; color: #3a3a3a; background-color: rgba(255, 255, 255, 0.9); width: 100%; max-width: 800px; border-radius: 12px; box-sizing: border-box; font-weight: 500; margin: 20px auto 0 auto; }

/* --- KHUNG LỊCH HÔM NAY --- */
#today-summary { background-color: #eaf6ff; border-left: 6px solid #007bff; border-radius: 12px; padding: 20px 25px; margin-bottom: 30px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
#today-summary h2 { margin-top: 0; color: #0056b3; text-align: center; margin-bottom: 15px; font-size: 1.5em; }
#today-summary ul { padding-left: 20px; margin-top: 10px; margin-bottom: 15px; }
#today-summary li { margin-bottom: 8px; font-size: 1.05em; }
#today-summary strong { font-size: 1.1em; color: #343a40; }
#today-summary .no-class-message { text-align: center; font-weight: 500; font-size: 1.1em; color: #555; padding: 10px 0; }

/* --- ĐỊNH DẠNG NÚT VÀ CỬA SỔ HƯỚNG DẪN --- */
#show-csv-guide { display: inline-flex; justify-content: center; align-items: center; background-color: #6c757d; color: white; width: 22px; height: 22px; border-radius: 50%; font-weight: bold; cursor: pointer; font-size: 14px; transition: background-color 0.2s ease; }
#show-csv-guide:hover { background-color: #5a6268; }
.modal-content-large { max-width: 600px; text-align: left; max-height: 85vh; overflow-y: auto; }
.guide-container { display: flex; gap: 25px; margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee; }
.guide-column { flex: 1; }
.file-upload-wrapper { display: flex; align-items: center; gap: 10px; }
.btn-upload { display: inline-block; padding: 10px 15px; background-color: #5a6268; color: white; border-radius: 8px; cursor: pointer; font-weight: 500; transition: background-color 0.2s ease; }
.btn-upload:hover { background-color: #494f54; }
.file-input-hidden { display: none; }
#file-feedback { display: block; margin-top: 8px; font-style: italic; color: #555; }

/* --- ĐỊNH DẠNG CÁC MENU CONTEXT --- */
.context-menu { position: fixed; display: none; background-color: white; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); z-index: 1001; border: 1px solid #ddd; }
.context-menu ul { list-style: none; padding: 5px; margin: 0; }
.context-menu ul li { padding: 8px 12px; cursor: pointer; border-radius: 4px; }
.context-menu ul li:hover { background-color: #f0f0f0; }

/* --- ĐỊNH DẠNG MODAL NHẬP LINK QUIZLET --- */
#quizlet-link-feedback {
    margin-top: 5px;
    font-size: 0.9em;
    font-weight: 500;
}
#quizlet-link-feedback.valid {
    color: #28a745;
}
#quizlet-link-feedback.invalid {
    color: #dc3545;
}

/* --- TRANG HỌC VIÊN & GAMIFICATION --- */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.student-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.avatar-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #007bff;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.student-card h3 {
    margin: 0 0 5px;
    color: #333;
    font-size: 1.2em;
}

.level-badge {
    background-color: #ffc107;
    color: #333;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
}

/* Thanh XP nhỏ ở Card */
.xp-progress-mini {
    background-color: #e9ecef;
    border-radius: 10px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.xp-fill-mini {
    background-color: #28a745;
    height: 100%;
    transition: width 0.5s ease;
}

/* Header trang chi tiết */
.student-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-profile-summary {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.rank-badge {
    color: #0056b3;
    font-weight: 600;
    margin: 5px 0 10px;
}

.xp-bar-container {
    width: 300px;
    background-color: #e9ecef;
    border-radius: 15px;
    height: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.xp-bar-fill {
    background: linear-gradient(90deg, #00c6ff, #0072ff);
    height: 100%;
    border-radius: 15px;
    transition: width 0.5s ease;
}

#detail-xp-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 0;
    left: 0;
    font-size: 0.8em;
    font-weight: bold;
    color: #333;
    line-height: 20px;
    text-shadow: 0 0 2px rgba(255,255,255,0.8);
}

/* Checkbox điểm danh */
.lesson-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #28a745;
}

/* Nút thêm học viên */
#btn-add-student {
    background-color: #6610f2; /* Màu tím */
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
}
#btn-add-student:hover { background-color: #520dc2; }

.btn-attendance {
    background-color: #17a2b8; /* Màu xanh cyan */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    margin-right: 10px;
    transition: background-color 0.2s ease;
}
.btn-attendance:hover { background-color: #138496; }

/* Avatar preview trong modal */
.avatar-preview {
    margin-top: 10px;
    text-align: center;
}
.avatar-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ddd;
}
.checked-row {
    background-color: #d4edda !important; /* Xanh nhạt khi đã tick */
}

/* --- GIAO DIỆN SPACED REPETITION (MỚI) --- */
.task-table th {
    background-color: #f1f3f5;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

/* Cột Ngày */
.task-date {
    font-weight: 700;
    color: #007bff;
    font-size: 1.1em;
}
.task-date.is-today {
    color: #dc3545; /* Màu đỏ nếu là hôm nay */
}
.today-badge {
    display: inline-block;
    background-color: #ffe3e3;
    color: #e03131;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Cột Nội dung */
.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.task-item {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eee;
}
.task-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.task-name {
    display: block;
    font-weight: 500;
    color: #343a40;
    margin-bottom: 2px;
}
.task-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
}
/* Badge màu cam cho Ôn tập */
.badge-review {
    background-color: #fff4e6;
    color: #fd7e14;
    border: 1px solid #ffe8cc;
}
/* Badge màu xanh cho Bài mới */
.badge-new {
    background-color: #eebefa;
    color: #9c36b5;
    border: 1px solid #eebefa;
}

/* Cột Trạng thái */
.task-checkbox-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}
.daily-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #28a745;
    transition: transform 0.2s;
}
.daily-checkbox:hover {
    transform: scale(1.1);
}

/* Hiệu ứng khi đã hoàn thành */
tr.task-done {
    background-color: #f8f9fa !important;
    opacity: 0.6;
}
tr.task-done .task-name {
    text-decoration: line-through;
    color: #adb5bd;
}
tr.task-done .task-date {
    color: #adb5bd;
}

/* --- THÊM VÀO CUỐI FILE STYLE.CSS --- */

/* Định vị thẻ chứa học viên để đặt nút tuyệt đối */
.student-card {
    position: relative; 
    /* Giữ nguyên các thuộc tính cũ */
}

/* Container chứa nút Sửa/Xóa */
.student-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    opacity: 0; /* Ẩn đi mặc định cho đỡ rối */
    transition: opacity 0.2s ease;
}

/* Chỉ hiện nút khi di chuột vào thẻ */
.student-card:hover .student-card-actions {
    opacity: 1;
}

/* Style cho nút icon nhỏ */
.btn-icon-small {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    padding: 0; /* Reset padding */
}

.btn-icon-small:hover {
    transform: scale(1.1);
}

.btn-edit-stu { color: #ffc107; }
.btn-edit-stu:hover { background-color: #fff3cd; }

.btn-delete-stu { color: #dc3545; }
.btn-delete-stu:hover { background-color: #f8d7da; }

/* Thêm vào file style.css */
.btn-report {
    color: #fd7e14; /* Màu cam nổi bật */
}
.btn-report:hover {
    background-color: #fff4e6;
}
textarea {
    resize: vertical; /* Cho phép kéo giãn khung nhập liệu */
    line-height: 1.5;
}
