/* File: /ky-nang-so/style-app.css */
/* Phiên bản đã cập nhật để hỗ trợ Menu Hồ sơ Avatar, khoảng cách phiếu đánh giá và cỡ chữ/kích thước giấy chứng nhận */

/* --- THIẾT LẬP CHUNG VÀ BỐ CỤC --- */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    color: #333;
}

/* --- BANNER --- */
.banner {
    display: flex;
    align-items: center;
    background-color: #005a9e;
    color: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.logo { height: 70px; margin-right: 20px; }
.banner-text { display: flex; flex-direction: column; flex: 1; }
.banner-text h1 { font-size: 20px; color: white; font-weight: bold; margin: 0; text-transform: uppercase; line-height: 1.1;  text-align: center; }
.banner-subtitle { font-size: 32px; color: red; font-weight: bold; margin: 5px 0 0 0; text-transform: uppercase; text-align: center; }

/* --- THANH THÔNG TIN NGƯỜI DÙNG --- */
.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 10px 30px;
    border-bottom: 1px solid #ddd;
    flex-wrap: wrap; 
}
.user-details p { margin: 3px 10px 3px 0; font-size: 14px; }

/* ================================== */
/* == CSS CHO MENU HỒ SƠ AVATAR (MỚI) == */
/* ================================== */
.user-profile {
    position: relative;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    object-fit: cover;
}
.profile-dropdown {
    display: none; 
    position: absolute; 
    top: calc(100% + 10px); 
    left: 50%;             
    transform: translateX(-50%); 
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 250px;
    z-index: 10000; 
    border: 1px solid #eee;
}
.profile-dropdown.show {
    display: block;
}
.profile-dropdown a {
    display: block !important; 
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
}
.profile-dropdown a:hover {
    background-color: #f8f9fa;
}
.dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}
.dropdown-header strong {
    display: block;
    font-size: 16px;
}
.dropdown-header span {
    font-size: 13px;
    color: #666;
}

/* --- BỐ CỤC CHÍNH --- */
.container { display: flex; }

/* --- MENU BÊN TRÁI --- */
.menu { flex: 0 0 320px; background-color: #fff; padding: 20px; border-right: 1px solid #ddd; }
.menu h2 { text-align: center; color: #005a9e; margin-top: 0; }
.menu-chapter { margin-bottom: 15px; }
.menu-chapter-title { background-color: #34495e; color: #ecf0f1; padding: 12px 15px; font-weight: bold; border-radius: 5px; cursor: pointer; }
.menu-lesson-list { list-style: none; padding-left: 15px; margin-top: 5px; }
.menu-item { display: block; color: #2c3e50; text-decoration: none; padding: 10px; margin-bottom: 3px; border-radius: 4px; transition: background-color 0.2s; position: relative; border-left: 3px solid transparent; }
.menu-item:hover { background-color: #ecf0f1; }
.menu-item.active { background-color: #e7f3ff; color: #005a9e; font-weight: bold; border-left: 3px solid #007bff; }
.menu-item.locked { color: #95a5a6; cursor: not-allowed; background-color: #f8f9fa; }
.menu-item.locked::after { content: '🔒'; position: absolute; right: 10px; color: #95a5a6; }
.menu-item.completed { background-color: #d4edda; color: #155724; }
.menu-item.completed::after { content: '✓'; font-weight: bold; position: absolute; right: 10px; color: #155724; }
.menu-lesson-list.collapsed {
    display: none;
}

/* --- NỘI DUNG BÊN PHẢI --- */
.content { flex: 1; padding: 30px; background-color: #f8f9fa; min-width: 0; }
.content-panel { display: none; }
.content-panel.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.instruction-box {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 25px;
    font-size: 15px;
    line-height: 1.6;
    font-weight: 500;
}
.video-container { margin-bottom: 30px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.quiz-container { margin-top: 20px; border-top: 2px solid #eee; padding-top: 20px; }

/* ĐIỀU CHỈNH KHOẢNG CÁCH CÂU HỎI VÀ ĐÁP ÁN (CHO QUIZ)*/
.question { 
    background-color: #fff; 
    border: 1px solid #e7e7e7; 
    padding: 15px; 
    margin-bottom: 8px; /* ĐÃ SỬA: Giảm khoảng cách giữa các câu hỏi */
    border-radius: 5px; 
}
.question p { 
    font-weight: bold; 
    margin-bottom: 6px; /* ĐÃ SỬA: Giảm khoảng cách dưới tiêu đề câu hỏi */
}
.question label {
    display: block; 
    margin-bottom: 1px; /* ĐÃ SỬA: Giảm khoảng cách giữa các đáp án */
    font-size: 0.95em; 
}
.fill-in-the-blank { width: 250px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.check-btn { display: inline-block; background-color: #27ae60; color: #fff; padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; margin-top: 10px; }
.check-btn:hover { background-color: #2ecc71; }
.check-btn:disabled { background-color: #bdc3c7; cursor: not-allowed; }
.feedback { margin-top: 15px; padding: 10px; border-radius: 5px; font-weight: bold; }
.feedback.success { background-color: #d4edda; color: #155724; }
.feedback.error { background-color: #f8d7da; color: #721c24; }

/* --- GIẤY CHỨNG NHẬN --- */
.certificate-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 15px; }
.certificate-container {
    background-color: #fff;
    width: 80%;
    max-width: 600px;
    padding: 20px; 
    border: 5px solid #005a9e; 
    text-align: center;
    position: relative;
    min-height: 350px; 
}
.certificate-close-btn { position: absolute; top: 10px; right: 20px; font-size: 30px; cursor: pointer; }
.certificate-header h3 { margin: 0; font-size: 20px; } 
.certificate-header h4 { margin: 0; font-size: 20px; } 
.certificate-title { color: #d9534f; margin: 20px 0; font-size: 30px; } 
.certificate-body { font-size: 15px; line-height: 1.5; } 
.certificate-footer { margin-top: 20px; } 
.certificate-footer h4 { margin-top: 40px; font-size: 15px; } 

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 1024px) {
    .menu { flex: 0 0 280px; }
    .banner-text h1 { font-size: 26px; }
    .banner-subtitle { font-size: 32px; }
    .certificate-container {
        padding: 15px; 
        min-height: 300px; 
    }
    .certificate-title { font-size: 26px; margin: 15px 0; } 
    .certificate-body { font-size: 14px; line-height: 1.4; } 
    .certificate-footer h4 { font-size: 14px; margin-top: 30px; } 
    .certificate-header h3 { font-size: 18px; } 
    .certificate-header h4 { font-size: 14px; } 
}

@media (max-width: 768px) {
    .banner { flex-direction: column; text-align: center; padding: 15px; }
    .logo { margin-bottom: 10px; margin-right: 0; }
    .banner-text h1 { font-size: 20px; }
    .banner-subtitle { font-size: 24px; }
    .user-bar { flex-direction: column; align-items: flex-start; padding: 15px; }
    /* Chỉnh sửa cho user-profile trên mobile */
    .user-bar .user-profile {
        align-self: flex-end; 
        margin-top: -45px; 
    }
    .container { flex-direction: column; }
    .menu { flex: 1; width: 100%; border-right: none; border-bottom: 2px solid #ddd; }
    .content { padding: 20px; }
    .certificate-container { 
        padding: 10px; 
        border-width: 3px; 
        min-height: 250px; 
    }
    .certificate-title { font-size: 20px; margin: 10px 0; } 
    .certificate-body { font-size: 13px; line-height: 1.3; } 
    .certificate-footer h4 { font-size: 13px; margin-top: 20px; } 
    .certificate-header h3 { font-size: 15px; } 
    .certificate-header h4 { font-size: 12px; } 
}
/* Vùng chứa các hành động điều hướng (nút quay lại và avatar) */
.navigation-actions {
    display: flex;
    align-items: center;
    gap: 20px; 
}

.back-to-dashboard-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 8px 15px;
    border-radius: 5px;
    color: #343a40;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

.back-to-dashboard-btn:hover {
    background-color: #e9ecef;
    color: #000;
}

.back-to-dashboard-btn span {
    font-size: 20px;
    line-height: 1;
}
/* ================================================= */
/* === CSS CHO KHUNG CHAT VÀ NÚT BẬT/TẮT === */
/* ================================================= */

/* Nút bấm nổi ở góc màn hình */
#chat-toggle-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 999;
    transition: transform 0.2s;
}

#chat-toggle-button:hover {
    transform: scale(1.1);
}

/* Lớp để ẩn/hiện khung chat */
#chat-container.chat-hidden {
    display: none;
}

/* Sao chép toàn bộ các định dạng của khung chat từ style-dashboard.css */
#chat-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 550px; 
    height: 400px;
    display: flex;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    overflow: hidden;
    border: 1px solid #ccc;
    z-index: 1000;
    transition: height 0.3s ease;
}
#online-users-panel {
    width: 200px;
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}
#online-users-panel h4 {
    margin: 0;
    padding: 15px;
    text-align: center;
    background-color: #e9ecef;
    border-bottom: 1px solid #ddd;
    height: 20px;
    line-height: 20px;
}
#online-users-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}
#online-users-list li {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#online-users-list li:hover {
    background-color: #dee2e6;
}
#online-users-list li.active {
    background-color: #007bff;
    color: white;
}
#chat-panel {
    flex-grow: 1;
    background: white;
    display: flex;
    flex-direction: column;
}
#chat-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
    height: 50px;
    font-weight: bold;
    background: #eee;
    border-bottom: 1px solid #ddd;
    position: relative;
}
#chat-partner-name {
    text-align: center;
}
#toggle-chat-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    padding: 0 10px;
    line-height: 1;
}
#chat-form { 
    background: #f1f1f1; 
    padding: 8px; 
    display: flex; 
    border-top: 1px solid #ddd; 
}
#chat-input { 
    border: 1px solid #ccc; 
    padding: 10px; 
    flex-grow: 1; 
    margin-right: 8px; 
    border-radius: 5px; 
}
#chat-form > button { 
    background: #007bff; 
    border: none; 
    padding: 0 15px; 
    color: white; 
    border-radius: 5px; 
    cursor: pointer; 
}
#chat-form > button:hover {
    background: #0056b3;
}
#messages { 
    list-style-type: none; 
    margin: 0; 
    padding: 10px; 
    flex-grow: 1; 
    overflow-y: auto; 
}
#messages > li { 
    padding: 8px 12px; 
    word-wrap: break-word; 
    margin-bottom: 5px;
}
#messages > li.my-message { 
    text-align: right;
    color: #005a9e;
    font-weight: bold;
}
#chat-container.minimized {
    height: 50px;
}
#chat-container.minimized #online-users-panel,
#chat-container.minimized #messages,
#chat-container.minimized #chat-form,
#chat-container.minimized #typing-indicator {
    display: none;
}
#typing-indicator {
    padding: 0 10px 5px;
    height: 20px;
    font-style: italic;
    color: #888;
    font-size: 13px;
}
.unread-badge {
    background-color: #e74c3c;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 10px;
    text-align: center;
    line-height: normal;
}

/* Ẩn chat trên mobile cho trang này */
@media (max-width: 768px) {
    #chat-toggle-button, #chat-container {
        display: none;
    }
}
/* CSS cho nút AI Gợi ý */
.ai-suggestion-btn {
    display: inline-block;
    background-color: #007bff; /* Màu xanh dương */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    margin-left: 10px; /* Tạo khoảng cách với nút Xác nhận */
}

.ai-suggestion-btn:hover {
    background-color: #0056b3;
}
/* CSS cho AI Result Modal */
.modal {
    display: none; /* Ẩn theo mặc định */
    position: fixed; /* Giữ nguyên vị trí khi cuộn */
    z-index: 1000; /* Hiển thị trên cùng */
    left: 0;
    top: 0;
    width: 100%; /* Chiếm toàn bộ chiều rộng */
    height: 100%; /* Chiếm toàn bộ chiều cao */
    overflow: auto; /* Cho phép cuộn nếu nội dung lớn */
    background-color: rgba(0,0,0,0.5); /* Nền đen mờ */
    display: flex; /* Sử dụng flexbox để căn giữa */
    justify-content: center; /* Căn giữa theo chiều ngang */
    align-items: center; /* Căn giữa theo chiều dọc */
    padding: 20px; /* Thêm padding tổng thể cho modal */
    box-sizing: border-box; /* Đảm bảo padding không làm tăng kích thước */
}

.modal-content {
    background-color: #fefefe;
    padding: 30px; /* Tăng padding nội dung */
    border: 1px solid #ddd;
    width: 90%; /* Chiếm 90% chiều rộng màn hình nhỏ */
    max-width: 700px; /* Giới hạn chiều rộng tối đa */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); /* Bóng đổ đẹp hơn */
    border-radius: 8px; /* Bo tròn góc */
    position: relative; /* Dùng cho nút đóng */
    animation-name: animatemodal;
    animation-duration: 0.5s;
    max-height: 90vh; /* Giới hạn chiều cao để có thể cuộn */
    overflow-y: auto; /* Cho phép cuộn nội dung modal */
}

/* Animation cho modal */
@keyframes animatemodal {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

.close-button {
    color: #888;
    font-size: 30px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 25px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
    color: #333;
}

.ai-feedback-list {
    list-style-type: none;
    padding: 0;
    margin-top: 20px;
}

.ai-feedback-list li {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    line-height: 1.6;
    word-wrap: break-word; /* Đảm bảo text dài xuống dòng */
}

.ai-feedback-list li:last-child {
    margin-bottom: 0;
}

.ai-feedback-list strong {
    color: #333;
}

.ai-feedback-list .fib-placeholder {
    font-style: italic;
    color: #555;
}

/* CSS cho trạng thái Đúng/Sai */
.ai-feedback-list li strong:nth-of-type(3) { /* Đáp án đúng */
    color: #28a745; /* Màu xanh lá cây */
}

/* Kích thước font cho mobile */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 15px;
    }
    .close-button {
        font-size: 24px;
        top: 10px;
        right: 15px;
    }
    .ai-feedback-list li {
        font-size: 0.9em;
        padding: 10px;
    }
}
/* CSS cho trạng thái Đúng/Sai của AI gợi ý */
.ai-feedback-status {
    margin-top: 5px;
    font-weight: bold;
    font-size: 0.9em;
    padding: 5px 8px;
    border-radius: 4px;
    display: inline-block; /* Để nằm trên cùng dòng với text */
}

.ai-feedback-status.ai-correct {
    color: #155724; /* Màu xanh lá cây đậm */
    background-color: #d4edda; /* Nền xanh lá cây nhạt */
}

.ai-feedback-status.ai-incorrect {
    color: #721c24; /* Màu đỏ đậm */
    background-color: #f8d7da; /* Nền đỏ nhạt */
}
/* File: /ky-nang-so/style-app.css */
/* Các styles chung cho form đánh giá */
.self-assessment-form {
    background-color: #fff;
    padding: 20px; /* Giảm padding tổng thể */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: 20px; /* Giảm margin top */
}

.self-assessment-form h3 {
    color: #005a9e;
    font-size: 20px; /* Giảm kích thước font */
    margin-bottom: 15px; /* Giảm khoảng cách dưới tiêu đề chính */
    text-align: center;
}

.assessment-part {
    margin-bottom: 10px; /* Giảm khoảng cách giữa các phần */
    padding-bottom: 10px; /* Giảm padding dưới mỗi phần */
    border-bottom: 1px solid #eee;
}

.assessment-part:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.assessment-part h4 {
    color: #34495e;
    font-size: 16px; /* Giảm kích thước font */
    margin-bottom: 10px; /* Giảm khoảng cách dưới tiêu đề phần */
}

.question-group {
    margin-bottom: 5px; /* Giảm khoảng cách giữa các nhóm câu hỏi */
}

.question-group p {
    font-weight: bold;
    margin-bottom: 5px; /* Giảm khoảng cách dưới câu hỏi */
    line-height: 1.4; /* Điều chỉnh line-height nếu cần */
    color: #555;
}
/* Trong phần "Các styles chung cho form đánh giá" */
.question-group label {
    display: block; 
    margin-bottom: 2px; /* Giảm khoảng cách giữa các tùy chọn đáp án */
    cursor: pointer;
    font-size: 14px; /* Giảm kích thước font cho đáp án */
}

.question-group input[type="radio"] {
    margin-right: 5px;
    transform: scale(0.9); /* Thu nhỏ radio button một chút */
}

/* Checkbox specific styles */
/* Trong phần "Checkbox specific styles" */
.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 2px; /* Giảm khoảng cách giữa các checkbox */
    font-size: 14px; /* Giảm kích thước font cho checkbox */
    color: #555;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 5px;
    transform: scale(0.9); /* Thu nhỏ checkbox một chút */
}

.other-input {
    flex-grow: 1; 
    padding: 6px; /* Giảm padding */
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-left: 5px;
    box-sizing: border-box;
    font-size: 0.9em; /* Giảm kích thước font */
}

.suggestions-textarea {
    width: 100%;
    min-height: 100px; /* Giảm chiều cao tối thiểu */
    padding: 10px; /* Giảm padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
    font-size: 0.95em; /* Giảm kích thước font */
    line-height: 1.5;
}

.submit-assessment-btn {
    display: block;
    width: 100%;
    padding: 12px; /* Giảm padding */
    background-color: #27ae60; 
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px; /* Giảm kích thước font */
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px; /* Giảm margin top */
    transition: background-color 0.3s;
}

.submit-assessment-btn:hover {
    background-color: #2ecc71;
}

/* Feedback messages for assessment */
.feedback {
    margin-top: 10px; /* Giảm margin top */
    padding: 8px; /* Giảm padding */
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    display: none; 
}

.feedback.success {
    background-color: #d4edda;
    color: #155724;
}

.feedback.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* --- Responsive Adjustments for Assessment Form --- */
@media (max-width: 768px) {
    .self-assessment-form {
        padding: 15px; /* Điều chỉnh padding cho mobile */
    }
    .self-assessment-form h3 {
        font-size: 18px;
    }
    .assessment-part h4 {
        font-size: 15px;
    }
    .question-group p,
    .question-group label,
    .checkbox-label {
        font-size: 13px;
    }
    .suggestions-textarea,
    .other-input {
        font-size: 0.85em;
    }
    .submit-assessment-btn {
        font-size: 14px;
        padding: 10px;
    }
}
