﻿/* index.css */
:root {
    /* ĐỊNH NGHĨA BIẾN MÀU CHO MOBILE (MẶC ĐỊNH DARK MODE) */
    --m-bg-main: #020617;
    --m-bg-card: #0b130f;
    --m-bg-header: rgba(15, 23, 42, 0.7);
    --m-text-main: #f8fafc;
    --m-text-muted: #94a3b8;
    --m-border-faint: rgba(255,255,255,0.06); 
    --m-border-row: rgba(255,255,255,0.1);   
    --m-bg-modal: rgba(2, 6, 23, 0.85);
    --m-modal-box: #0f172a;
    --m-bg-hover: rgba(255,255,255,0.03);
    --m-color-gd: #38bdf8;
    --m-color-gv: #94a3b8;
    --m-color-lop: #fcd34d;
    --m-color-tiet: #34d399;
    --m-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

body.light-theme {
    /* BIẾN MÀU CHO MOBILE LIGHT MODE */
    --m-bg-main: #f1f5f9;
    --m-bg-card: #ffffff;
    --m-bg-header: rgba(255, 255, 255, 0.85);
    --m-text-main: #1e293b;
    --m-text-muted: #64748b;
    --m-border-faint: rgba(0,0,0,0.05); 
    --m-border-row: rgba(0,0,0,0.1);
    --m-bg-modal: rgba(255, 255, 255, 0.7);
    --m-modal-box: #ffffff;
    --m-bg-hover: rgba(0,0,0,0.02);
    --m-color-gd: #0284c7;
    --m-color-gv: #475569;
    --m-color-lop: #d97706;
    --m-color-tiet: #10b981;
    --m-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
body { background-color: #f4f6f9; color: #333; transition: background-color 0.3s ease; }

/* CSS TOOLTIP HIỂN THỊ TÊN MÔN HỌC (DESKTOP) */
.nd-tooltip-wrapper { position: relative; display: inline-block; cursor: pointer; z-index: 1; }
.nd-tooltip-wrapper:hover, .nd-tooltip-wrapper.active { z-index: 99999; }
.nd-tooltip {
    visibility: hidden; opacity: 0; position: absolute; bottom: 130%; left: 0;
    background: #0f172a; color: white; padding: 8px 12px; border-radius: 4px; 
    width: max-content; max-width: 250px; z-index: 99999; font-size: 12px; 
    font-weight: normal; text-align: left; line-height: 1.4;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 10px 25px rgba(0,0,0,0.4); pointer-events: none;
}
.nd-tooltip::after { content: ''; position: absolute; top: 100%; left: 15px; border-width: 6px; border-style: solid; border-color: #0f172a transparent transparent transparent; }
.nd-tooltip-wrapper:hover .nd-tooltip, .nd-tooltip-wrapper.active .nd-tooltip { visibility: visible; opacity: 1; bottom: 110%; }

/* BỘ LỌC TÌM KIẾM (DESKTOP) */
.report-section { background: white; padding: 20px; border-radius: 8px; margin-bottom: 25px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); border: 2px solid #e67e22; }
.report-form { display: grid; grid-template-columns: 1fr 1.5fr 1.5fr auto; gap: 15px; margin-bottom: 20px; align-items: end; }
.report-form label { font-weight: bold; font-size: 13px; color: #003366; display: block; margin-bottom: 5px; }
.report-form select, .report-form input { width: 100%; padding: 10px; border-radius: 5px; border: 1px solid #cbd5e1; outline: none; font-size: 14px; font-weight: bold; color: #333;}
.report-form select:focus, .report-form input:focus { border-color: #e67e22; box-shadow: 0 0 5px rgba(230,126,34,0.3); }
.btn-filter-submit { background: linear-gradient(135deg, #e67e22 0%, #d35400 100%); color: white; border: none; padding: 11px 20px; border-radius: 5px; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); text-transform: uppercase; white-space: nowrap;}
.btn-filter-submit:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-word { background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%); margin-left: 10px; }
.report-table-wrapper { width: 100%; overflow-x: auto; border: 1px solid #cbd5e1; border-radius: 6px; }
.report-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.report-table th, .report-table td { border: 1px solid #cbd5e1; padding: 10px; text-align: center; vertical-align: middle; font-size: 13px; }
.report-table th { background: #003366; color: white; text-transform: uppercase; }
.report-table tr:nth-child(even) { background-color: #f8fafc; }
.report-table tr:hover { background-color: #fffbeb; }

/* DESKTOP VIEW */
.desktop-view { display: block; }
.mobile-app-view { display: none; }

.d-header { display: flex; justify-content: space-between; align-items: center; background-color: #003366; padding: 12px 20px; color: white; position: sticky; top: 0; z-index: 1000; }
.d-logo-box { display: flex; align-items: center; gap: 10px; }
.d-logo-box img { width: 40px; height: 40px; }
.d-header-title { font-size: 16px; font-weight: bold; text-transform: uppercase; }
.d-header-right { display: flex; align-items: center; gap: 15px; }

.btn-header { padding: 8px 16px; border-radius: 5px; text-decoration: none; font-size: 13px; font-weight: bold; color: white !important; background: linear-gradient(135deg, #8a9a5b 0%, #6b7940 100%); border: 1px solid rgba(138,154,91,0.4); display: inline-flex; align-items: center;}
.btn-header:hover { background: linear-gradient(135deg, #6b7940 0%, #4b5320 100%); transform: translateY(-1.5px); }
.btn-logout { background: transparent !important; border: none; color: #d1e7dd !important; box-shadow: none;}
.d-select-date { padding: 7px 12px; border-radius: 4px; border: 1px solid #ccc; font-weight: bold; color: #003366; outline: none;}

.d-layout { padding: 15px 20px; width: 100%; max-width: 100%; margin: 0 auto; }
.d-section-title { font-size: 18px; font-weight: bold; color: #003366; margin-bottom: 15px; text-transform: uppercase; }

.btn-toggle-panel { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important; border: 1px solid #334155 !important; color: #38bdf8 !important; text-shadow: 0 0 5px rgba(56, 189, 248, 0.5); transition: all 0.3s ease; }
.btn-toggle-panel:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, 0.4) !important; transform: translateY(-1px); }
.icon-spin { display: inline-block; animation: spin 3s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* HIỆU ỨNG TÁC CHIẾN ĐIỆN TỬ CHO TRỢ LÝ AI */
@keyframes ew-sweep { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes cyber-sparkle { 0% { opacity: 0.8; transform: scale(0.95); text-shadow: 0 0 5px rgba(52, 211, 153, 0.5); } 50% { opacity: 1; transform: scale(1.05); filter: brightness(1.3); text-shadow: 0 0 15px rgba(52, 211, 153, 1); } 100% { opacity: 0.8; transform: scale(0.95); text-shadow: 0 0 5px rgba(52, 211, 153, 0.5); } }

/* TRẠM ĐIỀU HÀNH TRUNG TÂM (DESKTOP) 
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; margin-bottom: 20px; }
.dash-card { background: #ffffff; border-radius: 8px; padding: 20px 15px; text-align: center; text-decoration: none; box-shadow: 0 2px 10px rgba(0,0,0,0.04); border-top: 4px solid transparent; border-left: 1px solid #e2e8f0; border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; align-items: center; }
.dash-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.dash-icon { width: 55px; height: 55px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 12px; transition: transform 0.3s ease; }
.dash-card:hover .dash-icon { transform: scale(1.1); }
.dash-title { font-size: 14.5px; font-weight: 700; color: #1e293b; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.dash-desc { font-size: 12px; color: #64748b; line-height: 1.4; }

.dash-card.ai-card { border-top-color: #10b981; background: linear-gradient(to bottom, #ecfdf5, #ffffff); cursor: pointer; }
.dash-icon.ai-ew { background: #022c22; color: #34d399; border: 2px solid #10b981; position: relative; overflow: hidden; box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
.dash-icon.ai-ew::before { content: ''; position: absolute; top: 50%; left: 50%; width: 150%; height: 150%; background: conic-gradient(from 0deg, transparent 70%, rgba(52, 211, 153, 0.7) 100%); transform-origin: center center; animation: ew-sweep 2s linear infinite; }
.dash-icon.ai-ew span { position: relative; z-index: 2; text-shadow: 0 0 8px rgba(52, 211, 153, 0.8); animation: cyber-sparkle 1.5s infinite alternate; }  */


/* =======================================================
   NÚT VỆ TINH ĐIỀU HƯỚNG TÁC CHIẾN ĐIỆN TỬ (FAB) - BẢN NÂNG CẤP
   ======================================================= */
.ew-fab-container { position: fixed; left: 80px; bottom: 80px; width: 65px; height: 65px; z-index: 999999; touch-action: none; border-radius: 50%; }

/* Vòng sáng radar mở rộng khi nút đang được bật */
.ew-fab-container::before {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 65px; height: 65px; border-radius: 50%; transition: width 0.5s ease, height 0.5s ease; z-index: 1;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
}
.ew-fab-container.active::before { width: 350px; height: 350px; }

/* Thân vệ tinh mẹ */
.ew-fab-btn {
    position: absolute; width: 100%; height: 100%; background: linear-gradient(135deg, #022c22, #064e3b);
    border: 2px solid #10b981; border-radius: 50%; color: #34d399;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    cursor: pointer; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(16, 185, 129, 0.3); 
    overflow: hidden; 
    z-index: 30; /* KHẮC PHỤC LỖI: Tăng từ 10 lên 30 để luôn nằm trên lớp menu */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
}
.ew-fab-container:hover .ew-fab-btn { transform: scale(1.05); }
.ew-fab-container.active .ew-fab-btn { transform: scale(1.1); box-shadow: 0 0 25px rgba(16, 185, 129, 0.8); }

.radar-sweep-fab {
    position: absolute; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent 70%, rgba(52, 211, 153, 0.7) 100%);
    animation: ew-sweep 2.5s linear infinite;
}

/* KHẮC PHỤC CHE KHUẤT: Nâng lớp menu lên cao hơn vệ tinh mẹ khi active */
.ew-fab-menu { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.ew-fab-container.active .ew-fab-menu { pointer-events: auto; z-index: 15; }

/* Vệ tinh con (Tính năng) */
.ew-fab-item {
    position: absolute; 
    width: 56px; height: 56px; 
    background: linear-gradient(135deg, #0f172a, #022c22);
    border: 2px solid rgba(16, 185, 129, 0.5); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    color: white; text-decoration: none; 
    top: 4.5px; left: 4.5px; /* Căn giữa hoàn hảo vào lõi mẹ */
    opacity: 0; font-size: 24px; 
    /* KHẮC PHỤC NHẢY TỪ LÕI: Khởi tạo translate(0px) tại tâm */
    transform: rotate(var(--angle)) translate(0px) rotate(calc(-1 * var(--angle))) scale(0); 
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 5;
}

/* ĐƯỜNG KẾT NỐI MẠCH ĐIỆN GẤP KHÚC (Circuit Trace) */
.ew-fab-item::before {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 130px; height: 40px; /* Vùng vẽ mạch điện */
    /* Dùng SVG vẽ đường gấp khúc sắc nét và núm sáng ở đuôi */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='130' height='40' viewBox='0 0 130 40'%3E%3Cpath d='M0,20 L25,20 L40,8 L90,8 L105,20 L130,20' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='130' cy='20' r='3' fill='%23fff'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left center;
    transform-origin: 0 50%;
    /* Toán học: Luôn xoay ngược 180 độ so với góc bung ra để chĩa thẳng đuôi về vệ tinh mẹ */
    transform: translateY(-50%) rotate(calc(180deg + var(--angle)));
    z-index: -1; opacity: 0;
    transition: opacity 0.4s ease 0.1s; /* Hiện ra sau khi icon vừa nảy lên */
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.6));
}

/* Trạng thái bung mở vệ tinh */
.ew-fab-container.active .ew-fab-item { 
    opacity: 1; 
    transform: rotate(var(--angle)) translate(130px) rotate(calc(-1 * var(--angle))) scale(1); 
}
.ew-fab-container.active .ew-fab-item::before { opacity: 1; }

.ew-fab-item:hover {
    background: linear-gradient(135deg, #10b981, #059669); 
    border-color: #34d399; box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
    transform: rotate(var(--angle)) translate(130px) rotate(calc(-1 * var(--angle))) scale(1.15); 
    z-index: 25; /* Nổi bần bật khi trỏ chuột */
}

/* BẢNG MỜ GHI CHÚ BÊN CẠNH */
.ew-fab-tooltip {
    position: absolute; top: 50%; left: 100%; 
    transform: translateY(-50%) translateX(15px); 
    margin-left: 12px; 
    background: rgba(2, 6, 23, 0.65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(52, 211, 153, 0.3); border-left: 3px solid #10b981;
    color: #a7f3d0; padding: 8px 16px; border-radius: 6px; 
    font-size: 13.5px; white-space: nowrap; 
    opacity: 0; pointer-events: none; font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4); letter-spacing: 0.5px;
    z-index: 999999; /* Đảm bảo không bao giờ bị che khuất */
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

.ew-fab-item:hover .ew-fab-tooltip { 
    opacity: 1; color: #fff; background: rgba(6, 78, 59, 0.85); border-color: #34d399;
    transform: translateY(-50%) translateX(0); /* Trượt mượt mà sát vào icon */
}

/* =======================================================
   HÌNH ẢNH DRONE CÓ CÁNH BAY BÊN TRONG LÕI MẸ
   ======================================================= */
.cyber-drone {
    position: relative; z-index: 2; 
    display: flex; align-items: center; justify-content: center; gap: 2px;
    animation: cyber-hover 2s infinite alternate ease-in-out;
}
.drone-core {
    width: 14px; height: 14px; background: #34d399; border-radius: 50%;
    box-shadow: 0 0 10px #10b981; position: relative; z-index: 3;
}
.drone-core::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 6px; height: 6px; background: #fff; border-radius: 50%;
    animation: blink-eye 1.5s infinite alternate ease-in-out;
}
.drone-wing {
    width: 12px; height: 5px; background: rgba(16, 185, 129, 0.4);
    border: 1px solid #6ee7b7; border-radius: 2px; box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}
.wing-left { transform-origin: right center; animation: flap-left 0.6s infinite alternate ease-in-out; }
.wing-right { transform-origin: left center; animation: flap-right 0.6s infinite alternate ease-in-out; }

@keyframes cyber-hover { 0% { transform: translateY(-4px); } 100% { transform: translateY(4px); } }
@keyframes flap-left { 0% { transform: rotate(25deg); } 100% { transform: rotate(-25deg); } }
@keyframes flap-right { 0% { transform: rotate(-25deg); } 100% { transform: rotate(25deg); } }
@keyframes blink-eye { 0% { opacity: 0.4; box-shadow: 0 0 0 transparent; } 100% { opacity: 1; box-shadow: 0 0 8px #fff, 0 0 15px #34d399; } }

/* KHUNG CHAT TRỢ LÝ ẢO TỐI ƯU HÓA GPU & CHỐNG LAG */
.ai-chat-container { position: fixed; right: -420px; bottom: 20px; width: 380px; height: 550px; background: #022c22; border-radius: 12px; box-shadow: -5px 5px 30px rgba(16, 185, 129, 0.3); z-index: 100000; transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; border: 1px solid #10b981; overflow: hidden; resize: both; min-width: 320px; min-height: 400px; max-width: 95vw; max-height: 95vh; will-change: top, left, width, height, right; }
.ai-chat-container.dragging { transition: none !important; opacity: 0.95; }
.ai-chat-container.dragging .ai-body, .ai-chat-container.dragging .ai-footer { pointer-events: none; }
.ai-chat-container.open { right: 20px; }
.ai-chat-container.open.expanded { width: 85vw !important; height: 85vh !important; right: 7.5vw !important; bottom: 7.5vh !important; top: auto !important; left: auto !important; box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 9999px rgba(0,0,0,0.6); border-radius: 16px; }
.ai-header { background: #064e3b; color: #34d399; padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #10b981; user-select: none; }
.ai-pulse-icon { font-size: 20px; animation: cyber-sparkle 1.5s infinite alternate; }
.ai-body { flex: 1; overflow-y: auto; padding: 15px; background: #022c22; display: flex; flex-direction: column; gap: 16px; }
.ai-footer { padding: 12px; background: #064e3b; border-top: 1px solid #10b981; display: flex; gap: 8px; }
.ai-input { flex: 1; padding: 10px 15px; border: 1px solid #10b981; border-radius: 20px; outline: none; font-size: 14px; background: #064e3b; color: #a7f3d0; }
.ai-input::placeholder { color: #059669; }
.ai-send-btn { background: #10b981; color: #022c22; border: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; font-weight: bold; transition: 0.2s; flex-shrink: 0; }
.ai-send-btn:hover { background: #34d399; transform: scale(1.05); }
.ai-msg { display: flex; max-width: 85%; flex-direction: column; }
.ai-chat-container.expanded .ai-msg { max-width: 900px; }
.ai-chat-container.expanded .ai-msg.user { align-self: flex-end; }
.ai-chat-container.expanded .ai-msg.bot { align-self: flex-start; }
.ai-msg.user { align-self: flex-end; align-items: flex-end; }
.ai-msg.bot { align-self: flex-start; align-items: flex-start; }
.ai-bubble { padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.ai-msg.user .ai-bubble { background: #10b981; color: #022c22; border-bottom-right-radius: 2px; }
.ai-msg.bot .ai-bubble { background: #064e3b; color: #a7f3d0; border: 1px solid #059669; border-bottom-left-radius: 2px; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1); }

/* TÙY CHỈNH CỠ CHỮ LINH HOẠT CHO BẢNG DESKTOP */
:root { --tbl-fs: 9.5px; }
.d-table-container { background: white; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); overflow: visible !important; margin-bottom: 35px; width: 100%; }
.d-table-container table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.d-table-container th, .d-table-container td { border: 1px solid #cce0ff; text-align: center; vertical-align: middle; font-size: var(--tbl-fs); padding: 4px 2px; word-wrap: break-word; }
.d-table-container table td:hover { position: relative; z-index: 9999; }
.th-month { background-color: #003366; font-size: calc(var(--tbl-fs) + 3.5px); padding: 8px; color: white; font-weight: bold; text-transform: uppercase; }
.th-week { background-color: #e6f0fa; font-weight: bold; color: #003366; padding: 4px 2px; font-size: calc(var(--tbl-fs) + 1px); }
.th-subcol { background-color: #f0f5ff; font-size: calc(var(--tbl-fs) - 1px); font-weight: bold; color: #003366; }
.td-day { background-color: #004080; color: white; font-weight: bold; font-size: calc(var(--tbl-fs) + 0.5px); }
.active-week { background-color: #fffde7 !important; }
th.active-week.th-week { background-color: #fef08a !important; color: #995c00 !important; }
td.active-week.td-day { background-color: #eab308 !important; color: white !important; }
.gv-list { font-size: calc(var(--tbl-fs) - 0.5px); font-weight: 700; color: #003366; }

/* CỬA SỔ CHAT TRỰC TUYẾN KHOA (DESKTOP) */
.chat-panel {
    position: fixed; right: -350px; bottom: 20px; width: 350px; height: 500px;
    background: #fff; border-radius: 12px 0 0 12px; box-shadow: -5px 5px 25px rgba(0,0,0,0.15);
    z-index: 99999; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex;
    flex-direction: column; border: 1px solid #cbd5e1; border-right: none;
}
.chat-panel.open { right: 0; }
.chat-toggle-btn {
    position: absolute; left: -40px; top: 50px; width: 40px; height: 50px;
    background: #003366; color: white; display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 10px 0 0 10px; box-shadow: -4px 0 8px rgba(0,0,0,0.1);
    font-weight: bold; font-size: 18px;
}
.chat-header { background: #003366; color: white; padding: 15px; border-radius: 12px 0 0 0; font-weight: bold; font-size: 14px; display: flex; align-items: center; gap: 8px;}
.chat-body { flex: 1; overflow-y: auto; padding: 15px; background: #f8fafc; display: flex; flex-direction: column; gap: 10px; }
.chat-footer { padding: 10px; background: white; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; border-radius: 0 0 0 12px;}
.chat-input { flex: 1; padding: 10px; border: 1px solid #cbd5e1; border-radius: 20px; outline: none; font-size: 13px; }
.chat-send-btn { background: #e67e22; color: white; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.msg-wrapper { display: flex; gap: 8px; max-width: 85%; }
.msg-wrapper.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: bold; color: #475569; overflow: hidden; flex-shrink: 0;}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-content { display: flex; flex-direction: column; gap: 4px; }
.msg-name { font-size: 11px; color: #64748b; font-weight: 600; }
.msg-wrapper.mine .msg-name { text-align: right; }
.msg-bubble { background: #ffffff; padding: 10px 12px; border-radius: 0 12px 12px 12px; font-size: 13px; color: #333; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; line-height: 1.4; word-break: break-word;}
.msg-wrapper.mine .msg-bubble { background: #003366; color: white; border-radius: 12px 0 12px 12px; border: none; }
.msg-time { font-size: 10px; color: #94a3b8; align-self: flex-end;}

/* =========================================================
   MOBILE WEB APP - THEME BIẾN ĐỔI (MAX-WIDTH: 900PX)
   ========================================================= */
@media screen and (max-width: 900px) {
    body { background-color: var(--m-bg-main); }
    .desktop-view { display: none !important; }
    
    .mobile-app-view { 
        display: flex !important; flex-direction: column; width: 100%; max-width: 550px; 
        margin: 0 auto; background-color: var(--m-bg-main); min-height: 100vh; box-shadow: 0 0 30px rgba(0,0,0,0.1); 
    }
    
    /* GIAO DIỆN GLASSMORPHISM HEADER */
    .m-header { 
        background: var(--m-bg-header); color: var(--m-color-tiet); padding: 12px 20px; display: flex; 
        justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; 
        border-bottom: 1px solid var(--m-border-row); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    }
    .m-logo-box { display: flex; align-items: center; gap: 10px; }
    .m-logo-box img { width: 32px; height: 32px; filter: drop-shadow(0 0 5px rgba(16,185,129,0.3)); }
    .m-title { font-size: 15px; font-weight: 800; text-transform: uppercase; color: var(--m-text-main); letter-spacing: 0.5px;}
    .m-month-picker { background: transparent; color: var(--m-color-tiet); border: none; font-size: 14px; font-weight: bold; outline: none; margin-left: 10px;}
    
    /* THANH NAVIGATION LƠ LỬNG CAO CẤP (FLOATING DOCK) */
    .m-icon-nav {
        display: flex; justify-content: space-around; align-items: center;
        background: var(--m-bg-header); padding: 8px 12px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15); position: sticky; top: 65px; z-index: 99;
        border: 1px solid var(--m-border-row); border-radius: 20px; margin: 10px 15px;
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    }
    .m-icon-btn {
        background: transparent; border: none; font-size: 22px; color: var(--m-text-muted);
        width: 44px; height: 44px; border-radius: 14px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex; justify-content: center; align-items: center; outline: none;
    }
    .m-icon-btn:hover, .m-icon-btn:active { 
        color: var(--m-color-tiet); transform: translateY(-2px) scale(1.05); 
        background: var(--m-bg-hover);
    }
    
    .anim-ring { animation: ringBell 2s infinite; transform-origin: top center; display: inline-block; }
    .anim-pulse { animation: cyber-sparkle 1.5s infinite alternate; }

    .m-body { padding: 10px 15px; flex: 1; overflow: visible !important; }
    
    /* MODALS BOTTOM SHEETS - GLASSMORPHISM DARK */
    .m-modal-overlay {
        display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: var(--m-bg-modal); z-index: 100000; justify-content: center; align-items: flex-end;
        opacity: 0; transition: opacity 0.3s ease; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    }
    .m-modal-overlay.show { opacity: 1; }
    .m-modal-box {
        background: var(--m-modal-box); border: 1px solid var(--m-border-row); border-bottom: none; width: 100%; max-height: 85vh; border-radius: 24px 24px 0 0;
        display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    }
    .m-modal-overlay.show .m-modal-box { transform: translateY(0); }
    .m-modal-header {
        padding: 18px 20px; font-weight: 800; font-size: 15px; color: var(--m-text-main); text-transform: uppercase;
        border-bottom: 1px solid var(--m-border-row); display: flex; justify-content: space-between; align-items: center;
        background: transparent; letter-spacing: 0.5px;
    }
    .m-modal-close {
        background: var(--m-bg-hover); border: none; width: 30px; height: 30px; border-radius: 50%;
        color: var(--m-text-muted); font-size: 14px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.2s;
    }
    .m-modal-close:active { background: var(--m-border-row); color: var(--m-text-main); }
    .m-modal-body { padding: 20px 15px; overflow-y: auto; flex: 1; }
    
    /* UI BÊN TRONG MODAL */
    .m-user-panel { background: var(--m-bg-hover); border-radius: 12px; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border: 1px solid var(--m-border-row); }
    .m-user-name { font-weight: bold; color: var(--m-text-main); font-size: 14px; }
    .m-btn-logout { color: #fca5a5; font-weight: bold; text-decoration: none; font-size: 12px; background: rgba(220, 38, 38, 0.15); padding: 6px 12px; border-radius: 6px; border: 1px solid rgba(220, 38, 38, 0.3); }
    .m-btn-login-main { display: block; text-align: center; background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; padding: 14px; border-radius: 12px; font-weight: bold; text-decoration: none; margin-bottom: 15px; text-transform: uppercase; box-shadow: 0 4px 15px rgba(16,185,129,0.3); }

    .m-tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
    .m-btn-tool { background: var(--m-bg-hover); color: var(--m-text-muted) !important; text-decoration: none; padding: 15px 10px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; border: 1px solid var(--m-border-row); font-size: 12px; font-weight: 600; transition: 0.2s;}
    .m-btn-tool:active { background: rgba(16,185,129,0.1); color: var(--m-color-tiet) !important; border-color: rgba(16,185,129,0.3); }
    .m-tool-icon { font-size: 22px; margin-bottom: 6px; }
    
    .report-section { border: none; box-shadow: none; padding: 0; margin-bottom: 0; background: transparent;}
    .report-form label { color: var(--m-text-muted); font-weight: 600; font-size: 12px;}
    .report-form select, .report-form input { background: var(--m-bg-hover); color: var(--m-text-main); border: 1px solid var(--m-border-row); border-radius: 8px;}
    .btn-filter-submit { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; border-radius: 8px;}
    
    .report-table-wrapper { border-radius: 8px; border: 1px solid var(--m-border-row); overflow: hidden;}
    .report-table th { background: var(--m-bg-hover); color: var(--m-text-muted); border-color: var(--m-border-row); font-size: 11px;}
    .report-table td { background: transparent; color: var(--m-text-main); border-color: var(--m-border-row); font-size: 12px;}
    .report-table tr:nth-child(even) td { background-color: var(--m-bg-hover); }

    .m-sk-wrapper { background: var(--m-bg-hover); border-left: 4px solid var(--m-color-lop); border-radius: 12px; padding: 15px;}
    .m-sk-item { background: transparent; border: none; border-bottom: 1px solid var(--m-border-row); padding: 10px 0; margin-bottom: 0; border-radius: 0; }
    .m-sk-item:last-child { border-bottom: none; padding-bottom: 0;}
    .m-sk-item:first-child { padding-top: 0;}
    .m-sk-time { font-size: 11.5px; color: var(--m-color-gd); font-weight: bold; }
    .m-sk-title { font-size: 13.5px; font-weight: bold; color: var(--m-text-main); margin: 4px 0; line-height: 1.4;}
    .m-sk-loc { font-size: 12px; color: var(--m-text-muted); font-style: italic; }

    .m-lct-table-card { background: var(--m-bg-hover); border-radius: 12px; border: 1px solid var(--m-border-row); overflow: hidden; margin-bottom: 15px; }
    .m-lct-day-group { border-bottom: 1px solid var(--m-border-row); }
    .m-lct-day-group:last-child { border-bottom: none; }
    .m-lct-day-title { background: rgba(0,0,0,0.1); padding: 8px 15px; font-weight: bold; color: var(--m-color-tiet); font-size: 13px; border-bottom: 1px solid var(--m-border-row); text-transform: uppercase; }
    .m-lct-row-item { padding: 10px 15px; border-bottom: 1px dashed var(--m-border-row); background: transparent; }
    .m-lct-row-item:last-child { border-bottom: none; }
    .m-lct-meta { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
    .m-lct-time { color: var(--m-color-lop); font-weight: bold; font-family: monospace; font-size: 13px; background: rgba(251, 191, 36, 0.1); padding: 2px 6px; border-radius: 4px;}
    .m-lct-job { font-size: 13.5px; color: var(--m-text-main); line-height: 1.5; margin-bottom: 4px; }

    /* DANH SÁCH LỊCH GIẢNG CYBER COMPACT GRID (SANG CHẢNH BẢNG 5 CỘT) */
    .m-week-header { 
        background: var(--m-bg-header); padding: 15px; font-weight: bold; color: var(--m-text-main); font-size: 14.5px; 
        display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--m-border-row);
        border-radius: 12px; margin-bottom: 15px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    }
    
    .cyber-day-block { margin-bottom: 15px; border: 1px solid var(--m-border-row); border-radius: 12px; background: var(--m-bg-card); overflow: visible !important; box-shadow: var(--m-shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
    .cyber-day-header { background: var(--m-bg-hover); color: var(--m-color-tiet); font-weight: 800; padding: 10px 15px; font-size: 13px; text-transform: uppercase; border-bottom: 1px solid var(--m-border-row); display: flex; align-items: center; gap: 8px; border-radius: 12px 12px 0 0;}
    .cyber-blink { width: 8px; height: 8px; background: var(--m-color-tiet); border-radius: 50%; box-shadow: 0 0 8px var(--m-color-tiet); animation: cyber-sparkle 1s infinite alternate; }
    .cyber-day-body { background: transparent; padding: 0; overflow: visible !important;}
    
    .m-grid-table { width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: fixed; }
    .m-grid-table th { background: transparent; color: var(--m-text-muted); padding: 8px 2px; text-align: center; border-left: 1px solid var(--m-border-faint); border-right: 1px solid var(--m-border-faint); border-bottom: 1px solid var(--m-border-row); border-top: none; font-size: 10.5px; text-transform: uppercase; font-weight: 700;}
    .m-grid-table td { border-left: 1px solid var(--m-border-faint); border-right: 1px solid var(--m-border-faint); border-bottom: 1px solid var(--m-border-row); padding: 0; text-align: center; vertical-align: middle; word-wrap: break-word; color: var(--m-text-main); }
    .m-grid-table tr:last-child td { border-bottom: none; }
    .m-grid-table tr:nth-child(even) td { background: var(--m-bg-hover); }

    /* TOOLTIP NỔI BONG BÓNG NHỎ TRÊN MOBILE ĐẢM BẢO KHÔNG BỊ CẮT */
    .nd-tooltip {
        position: absolute !important;
        top: auto !important;
        bottom: 120% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: max-content !important;
        max-width: 280px !important;
        background: var(--m-bg-modal) !important;
        border: 1px solid var(--m-border-row) !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
        z-index: 9999999 !important;
        text-align: center !important;
        padding: 12px 15px !important;
        border-radius: 10px !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    .nd-tooltip::after {
        display: block !important;
        content: ''; position: absolute; top: 100%; left: 50%;
        margin-left: -6px; border-width: 6px; border-style: solid;
        border-color: var(--m-bg-modal) transparent transparent transparent;
    }

    .m-empty { padding: 25px; text-align: center; color: var(--m-text-muted); font-style: italic; font-size: 13px; }
    .chat-panel { display: none !important; }
    
    .ai-chat-container { width: 100%; height: 100%; bottom: 0; right: -100%; border-radius: 0; border: none; z-index: 999999;}
    .ai-chat-container.open { right: 0; }
    .ai-chat-container.open.expanded { width: 100%; height: 100%; right: 0; bottom: 0; border-radius: 0; }
}