/* Tệp: assets/css/style.css */

/* Nhúng font Roboto từ Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --edu-blue: #00AEEF;   /* Màu xanh header */
    --edu-orange: #F37021; /* Màu cam tiêu đề */
    --edu-green: #28a745;  /* Màu xanh text chạy */
}

body {
    /* Đổi font chủ đạo sang Roboto */
    font-family: 'Roboto', sans-serif;
    background-color: #f8f9fa;
}

.edugate-bg-primary {
    background-color: var(--edu-blue) !important;
}

.text-edu-orange {
    color: var(--edu-orange) !important;
}

/* Kiểu dáng cho các block trên Dashboard */
.card-custom {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background-color: #fff;
    margin-bottom: 20px;
}

.card-custom .card-header {
    background-color: #fff;
    border-bottom: 2px solid var(--edu-blue);
    font-weight: bold;
    color: var(--edu-blue);
    border-radius: 8px 8px 0 0;
    text-transform: uppercase;
    padding: 10px 15px;
}

.card-custom .card-body {
    padding: 15px;
}

/* Định dạng riêng cho khu vực scroll text */
.scroll-text-container {
    color: var(--edu-green);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Tuỳ biến thanh cuộn mỏng gọn */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1; 
}
::-webkit-scrollbar-thumb {
    background: #c1c1c1; 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; 
}

/* Sidebar màu cam bên phải */
.sidebar-orange {
    background-color: var(--edu-orange);
    border-radius: 8px;
    padding: 15px;
    color: #fff;
    height: 100%;
}

.sidebar-orange .card-custom {
    border: none;
    background-color: transparent;
    box-shadow: none;
}

.sidebar-orange .card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 1.1rem;
}

.sidebar-orange a {
    color: #fff;
    text-decoration: none;
}

.sidebar-orange a:hover {
    text-decoration: underline;
}

.timeline-item {
    font-size: 0.85rem;
    margin-bottom: 10px;
    padding-left: 15px;
    position: relative;
}

.timeline-item::before {
    content: "•";
    position: absolute;
    left: 0;
    top: -2px;
    font-size: 1.2rem;
}

.card-custom {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background-color: #fff;
    margin-bottom: 20px;
    /* ĐÃ XÓA height: 100%; ĐỂ KHÔNG BỊ MẤT THẺ TRÊN MOBILE */
}
/* =========================================
   1. CẤU HÌNH SIDEBAR CHUNG
   ========================================= */
.sidebar-wrapper {
    background-color: #ffffff !important; 
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
    padding: 20px 15px !important;
    position: sticky;
    top: 20px; 
    height: calc(100vh - 40px); 
    overflow: hidden; 
    transition: right 0.3s ease-in-out;
}

/* -----------------------------------------
   [CẬP NHẬT MỚI] GIAO DIỆN OFFCANVAS CHO MOBILE
   ----------------------------------------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

@media (max-width: 1199.98px) { /* Breakpoint cho màn hình dưới XL (Mobile & Tablet) */
    .sidebar-wrapper {
        position: fixed !important;
        top: 0 !important;
        right: -320px; /* Ẩn ra ngoài mép phải */
        width: 320px;
        height: 100vh !important;
        border-radius: 0 !important;
        z-index: 1050;
        padding-top: 15px !important;
    }
    .sidebar-wrapper.mobile-open {
        right: 0; /* Trượt vào màn hình */
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    }
}

/* Thanh cuộn thu gọn cho các phần tử con */
.custom-scroll::-webkit-scrollbar { width: 5px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 10px; }
.custom-scroll::-webkit-scrollbar-thumb:hover { background: #adb5bd; }

/* =========================================
   2. GIAO DIỆN CÁC KHỐI BÊN TRONG 
   ========================================= */
.sb-card {
    background: transparent; 
    border: none;
    box-shadow: none;
    margin-bottom: 1rem;
}
.sb-card-header {
    background-color: #ffffff;
    padding: 0 5px 12px 5px;
    border-bottom: 2px solid #f0f2f5;
    margin-bottom: 5px;
    z-index: 10; 
}
.sb-card-title {
    font-weight: 800;
    font-size: 0.95rem;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 0.5px;
    color: var(--edu-blue);
    display: flex;
    align-items: center;
}

/* Khối từng sự kiện (Có gì mới) */
.activity-item {
    display: block;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    border-left: 4px solid transparent;
}
.activity-item:first-child { margin-top: 5px; }
.activity-item:hover { transform: translateX(3px); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* Bảng màu phân loại sự kiện */
.act-warning { background-color: rgba(255, 193, 7, 0.1); border-left-color: #ffc107; }
.act-warning:hover { background-color: rgba(255, 193, 7, 0.15); }
.act-warning .act-icon { color: #d39e00; }
.act-danger { background-color: rgba(220, 53, 69, 0.08); border-left-color: #dc3545; }
.act-danger:hover { background-color: rgba(220, 53, 69, 0.12); }
.act-danger .act-icon { color: #dc3545; }
.act-info { background-color: rgba(13, 202, 240, 0.1); border-left-color: #0dcaf0; }
.act-info:hover { background-color: rgba(13, 202, 240, 0.15); }
.act-info .act-icon { color: #087990; }
.act-success { background-color: rgba(25, 135, 84, 0.08); border-left-color: #198754; }
.act-success:hover { background-color: rgba(25, 135, 84, 0.12); }
.act-success .act-icon { color: #198754; }

.act-title { font-size: 0.75rem; font-weight: 600; color: #6c757d; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center;}
.act-text { font-size: 0.8rem; font-weight: 400; color: #343a40; line-height: 1.35;}

/* Sổ tay cá nhân */
.note-wrapper {
    background: #fffdf2; 
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}
#quickNoteArea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    background: transparent;
    padding: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #495057;
    outline: none;
    overflow-y: auto;
}

/* =========================================
   FIX FOOTER LUÔN Ở ĐÁY & SIDEBAR ĐỨNG IM 
   ========================================= */
html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
}

.main-content-wrapper {
    flex: 1 0 auto; /* Đẩy footer xuống đáy nếu nội dung ngắn */
}

.footer-custom {
    flex-shrink: 0;
}

/* Sidebar màu cam */
.sidebar-orange {
    background-color: var(--edu-orange);
    border-radius: 8px;
    padding: 15px;
    color: #fff;
}

/* Biến Sidebar thành dạng dính (Sticky) khi cuộn trang */
.sidebar-sticky {
    position: sticky;
    top: 75px; /* Cách mép trên (dưới thanh navbar) 75px */
    height: calc(100vh - 90px); /* Kéo dài gần chạm đáy màn hình */
    overflow-y: auto; /* Nếu sidebar nhiều link quá thì tự có thanh cuộn riêng */
}

.sidebar-orange .card-custom { border: none; background-color: transparent; box-shadow: none; margin-bottom: 10px; }
.sidebar-orange .card-header { background-color: transparent; border-bottom: 1px solid rgba(255,255,255,0.3); color: #fff; font-size: 1.1rem; }
.sidebar-orange a { color: #fff; text-decoration: none; }
.sidebar-orange a:hover { text-decoration: underline; }
.timeline-item { font-size: 0.85rem; margin-bottom: 10px; padding-left: 15px; position: relative; }
.timeline-item::before { content: "•"; position: absolute; left: 0; top: -2px; font-size: 1.2rem; }

/* =========================================
   FIX SCROLL NGANG CHO CÁC BẢNG TRÊN MOBILE 
   ========================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.min-w-500 { min-width: 500px; }
.min-w-700 { min-width: 700px; }
.min-w-800 { min-width: 800px; }

/* =========================================
   GIAO DIỆN MODULE TRÒ CHUYỆN (ZALO CLONE)
   ========================================= */
.chat-wrapper { 
    height: calc(100vh - 190px);
    min-height: 500px;
    background: #fff; 
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    display: flex; 
    overflow: hidden; 
    border: 1px solid #dee2e6;
    position: relative;
}

/* Fix lỗi Select2 trong Modal */
.select2-container { width: 100% !important; }

/* Cột Trái - Danh sách phòng */
.chat-sidebar { width: 320px; background: #f8f9fa; border-right: 1px solid #dee2e6; display: flex; flex-direction: column; flex-shrink: 0; transition: all 0.3s ease;}
.chat-sidebar-header { padding: 15px; border-bottom: 1px solid #dee2e6; display: flex; justify-content: space-between; align-items: center; background: #fff;}
.chat-room-list { flex-grow: 1; overflow-y: auto; }
.room-item { padding: 15px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; display: flex; align-items: center;}
.room-item:hover { background: #e9ecef; }
.room-item.active { background: #e7f1ff; border-left: 4px solid var(--edu-blue); padding-left: 11px;}
.room-avatar { width: 45px; height: 45px; border-radius: 50%; background: var(--edu-blue); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.2rem; flex-shrink: 0; margin-right: 12px;}
.room-info { overflow: hidden; flex-grow: 1; }
.room-name { font-weight: 700; color: #333; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;}
.room-last-msg { font-size: 0.8rem; color: #6c757d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

/* Cột Phải - Cửa sổ chat */
.chat-main { flex-grow: 1; display: flex; flex-direction: column; background: #e5ecef; min-width: 0; transition: all 0.3s ease;}
.chat-header { padding: 10px 20px; background: #fff; border-bottom: 1px solid #dee2e6; display: flex; align-items: center; flex-shrink: 0;}
.chat-body { flex-grow: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px;}
.chat-footer { padding: 15px; background: #fff; border-top: 1px solid #dee2e6; flex-shrink: 0;}

/* Bubble Tin Nhắn */
.msg-row { display: flex; flex-direction: column; max-width: 75%; }
.msg-row.me { align-self: flex-end; align-items: flex-end; }
.msg-row.them { align-self: flex-start; align-items: flex-start; }
.msg-sender { font-size: 0.75rem; color: #6c757d; margin-bottom: 3px; font-weight: 600; margin-left: 5px;}
.msg-bubble { padding: 10px 15px; border-radius: 15px; font-size: 0.95rem; line-height: 1.4; word-wrap: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.05);}
.msg-row.me .msg-bubble { background: #cce4ff; border-top-right-radius: 2px; border: 1px solid #b8daff;}
.msg-row.them .msg-bubble { background: #fff; border-top-left-radius: 2px; border: 1px solid #dee2e6;}
.msg-time { font-size: 0.7rem; color: #adb5bd; margin-top: 3px; }

/* Nút Trở về trên Mobile (Mặc định ẩn) */
.btn-back-chat { display: none; }

/* Reponsive cho Điện Thoại */
@media (max-width: 768px) {
    .chat-sidebar { width: 100% !important; border-right: none; }
    .chat-main { display: none !important; width: 100% !important; }
    
    /* Khi mở một phòng chat trên Mobile */
    .chat-wrapper.chat-mobile-active .chat-sidebar { display: none !important; }
    .chat-wrapper.chat-mobile-active .chat-main { display: flex !important; }
    .btn-back-chat { display: block !important; margin-right: 15px; }
    
    .msg-row { max-width: 85%; }
}