@import url('https://fonts.googleapis.com/css2?family=Google Sans Flex:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Google Sans Flex:wght@300;400;500;600;700&display=swap');

/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --accent: #3b82f6;
    --accent-dark: #2563eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    
    /* Glassmorphism Variables Premium */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --card-hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);

    --primary-color: #087be0;
    --secondary-color: #00f2fe;
    --accent-color: #667eea;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Google Sans Flex', sans-serif;
    background: transparent;
    color: var(--text-primary);
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
body, button, input { font-family: 'Google Sans Flex', sans-serif; }
h1, h2, h3, h4, h5, h6, .navbar-brand { font-family: 'Google Sans Flex', sans-serif; }

/* =========================================
   2. BACKGROUND & UTILITIES
   ========================================= */
.page-bg {
    position: fixed; inset: 0; z-index: -1; 
    pointer-events: none;
}
.page-bg svg {
    pointer-events: none;
}

.page-bg::before {
    content: ''; position: absolute; inset: 0;
    /* background-image: url('https://source.unsplash.com/random/1920x1080/?abstract,white,technology'); */
    background-size: cover; background-position: center;
    filter: grayscale(1) brightness(1.1); opacity: 0.3;
}
.float-shape { 
    position: absolute; filter: blur(80px); opacity: 0.4; 
    animation: floatMove 25s infinite alternate ease-in-out;
}
@keyframes floatMove { 0% { transform: translate(0, 0) rotate(0deg); } 100% { transform: translate(50px, -50px) rotate(10deg); } }

/* Utility Classes cho Animation */
.fade-in-up { animation: fadeInUp 0.6s ease-out forwards; opacity: 0; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }


/* =========================================
   3. LOGIN PAGE STYLES (Giữ nguyên từ phiên bản trước)
   ========================================= */
.container { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 24px 80px 24px; }
.main { display: grid; grid-template-columns: 1fr 450px; gap: 60px; max-width: 1200px; width: 100%; align-items: center; }
.intro-content-wrapper { padding: 0 0 20px 20px; z-index: 2; position: relative; }
.language-toggle { display: flex; justify-content: flex-start; margin-bottom: 25px; }
.lang-switch { display: flex; border: 1px solid rgba(59, 130, 246, 0.3); border-radius: 50px; padding: 4px; background: rgba(255,255,255,0.5); backdrop-filter: blur(5px); }
.lang-switch button { background: none; border: none; padding: 6px 16px; color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: 0.3s; border-radius: 40px; }
.lang-switch button.active { background: var(--accent); color: white; box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3); }
.header-content { display: flex; align-items: center; gap: 25px; margin-bottom: 15px; }
.logo-intro { width: 100px; height: 100px; display: flex; align-items: center; justify-content: center; }
.logo-intro img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.headline { font-size: 48px; font-weight: 800; color: var(--text-primary); line-height: 1.1; letter-spacing: -1px; }
.headline span { background: linear-gradient(135deg, var(--accent), #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-image-placeholder { width: 100%; height: 450px; position: relative; z-index: 1; border-radius: 30px; overflow: hidden; margin-top: -30px; box-shadow: 0 20px 50px rgba(0,0,0,0.15); transform: perspective(1000px) rotateY(-5deg); transition: transform 0.5s; }
.hero-image-placeholder:hover { transform: perspective(1000px) rotateY(0deg); }
.hero-image-placeholder img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay-content { margin-top: 20px; padding-left: 10px; position: relative; z-index: 3; }
.hero-overlay-content .lead { font-size: 20px; font-weight: 500; color: var(--text-secondary); max-width: 80%; }

.login-wrapper { background: var(--glass-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid var(--glass-border); border-radius: 30px; padding: 48px 40px; box-shadow: var(--glass-shadow); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-wrapper::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: linear-gradient(90deg, var(--accent), #8b5cf6); }
.login-wrapper h2 { margin: 0 0 10px 0; font-size: 30px; font-weight: 700; text-align: center; color: var(--text-primary); }
.login-wrapper p.sub { margin: 0 0 35px 0; text-align: center; color: var(--text-secondary); font-size: 15px; }
.group-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; display: block; }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: 15px; width: 100%; height: 56px; border-radius: 16px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); border: none; text-decoration: none; margin-bottom: 10px; position: relative; overflow: hidden; }
.sso-btn i { font-size: 20px; }
.ms-btn { background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25); }
.ms-btn:hover { background: var(--accent-dark); transform: translateY(-3px); box-shadow: 0 12px 25px rgba(59, 130, 246, 0.35); }
.google-btn { background: white; color: var(--text-primary); border: 2px solid #e5e7eb; }
.google-btn:hover { background: #f9fafb; border-color: #d1d5db; transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.google-btn i { color: #EA4335; }
.divider { display: flex; align-items: center; width: 100%; margin: 30px 0; color: #9ca3af; font-size: 14px; font-weight: 500; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #e5e7eb; }
.divider span { padding: 0 15px; }
.form-footer { text-align: center; margin-top: 30px; font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.form-footer a { color: var(--accent); font-weight: 700; }
.alert-error { background: #fee2e2; color: #991b1b; padding: 16px; border-radius: 12px; margin-bottom: 25px; font-size: 14px; display: flex; align-items: center; gap: 12px; border-left: 4px solid #ef4444; font-weight: 500; }
footer { position: fixed; bottom: 0; left: 0; right: 0; padding: 20px; text-align: center; color: var(--text-secondary); z-index: 50; backdrop-filter: blur(10px); font-size: 13px; font-weight: 500; mix-blend-mode: multiply; }


/* =========================================
   4. MODERN DASHBOARD STYLES (NEW & IMPROVED)
   ========================================= */

/* Navbar Premium */
.navbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 5%;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--glass-shadow);
}
.nav-brand { 
    font-size: 1.4rem; font-weight: 700; color: var(--text-primary); 
    display: flex; align-items: center; gap: 12px; letter-spacing: -0.5px;
}
.nav-brand i { 
    font-size: 1.6rem; 
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.user-info { display: flex; align-items: center; gap: 24px; }
.user-name { font-weight: 600; color: var(--text-primary); font-size: 0.95rem; }
.user-name strong { color: var(--accent); }

.logout-btn {
    background: #fee2e2; color: #b91c1c; border: none;
    padding: 10px 24px; border-radius: 50px; font-size: 0.9rem; font-weight: 700; 
    cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px;
}
.logout-btn:hover { background: #ef4444; color: white; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

/* Container & Welcome Banner */
.dashboard-container { 
    padding: 2rem 5% 4rem; max-width: 1440px; margin: 0 auto; 
}

.welcome-banner {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(20px);
    border-radius: 30px; padding: 3rem;
    margin-bottom: 3rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    position: relative; overflow: hidden;
}
/* Hiệu ứng trang trí cho banner */
.welcome-banner::after {
    content: ''; position: absolute; right: -50px; top: -50px;
    width: 300px; height: 300px;
    background: linear-gradient(135deg, var(--accent), transparent);
    filter: blur(80px); opacity: 0.2; border-radius: 50%; z-index: 0;
}

.welcome-content { position: relative; z-index: 1; }
.welcome-title { 
    font-size: 2.2rem; font-weight: 600; color: var(--text-primary); 
    margin-bottom: 0.5rem; letter-spacing: -1px;
}
.welcome-subtitle { 
    font-size: 1.1rem; color: var(--text-secondary); font-weight: 500; 
}

/* Section Header Mới */
.section-header {
    display: flex; align-items: center; gap: 15px;
    margin-bottom: 2rem; padding-left: 10px;
    border-left: 5px solid var(--accent);
}
.section-header h3 { 
    font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 0; 
}

/* GRID & MODERN CARDS (Thiết kế mới hoàn toàn) */
.grid-apps { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 30px; 
}

.app-card-modern {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    border: 2px solid transparent; /* Viền trong suốt mặc định */
    box-shadow: var(--glass-shadow);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; height: 100%;
    text-align: left; /* Canh trái cho hiện đại */
}

/* Sử dụng biến CSS (ví dụ: --card-color: #E72429) được định nghĩa trong HTML */
.app-card-modern::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at top right, var(--card-color), transparent 60%);
    opacity: 0; transition: opacity 0.4s ease; z-index: 0; filter: blur(30px);
}

.app-card-modern:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--card-color); /* Viền đổi màu theo app */
}

.app-card-modern:hover::before { opacity: 0.1; } /* Hiện gradient nền mờ khi hover */

.card-icon-large {
    font-size: 3.5rem; margin-bottom: 1.5rem;
    display: inline-block;
    /* Tạo màu gradient cho icon */
    background: linear-gradient(135deg, var(--card-color), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.4s ease;
    position: relative; z-index: 1;
}
.app-card-modern:hover .card-icon-large { transform: scale(1.1) rotate(-5deg); }

.card-content { position: relative; z-index: 1; flex-grow: 1; }
.app-card-modern h4 { 
    font-size: 1.25rem; font-weight: 700; color: var(--text-primary); 
    margin-bottom: 0.75rem; 
}
.app-card-modern p { 
    font-size: 0.95rem; color: var(--text-secondary); 
    line-height: 1.6; font-weight: 500; 
}

/* Nút mũi tên xuất hiện khi hover */
.action-arrow {
    position: absolute; bottom: 2rem; right: 2rem;
    font-size: 1.2rem; color: var(--card-color);
    opacity: 0; transform: translateX(-10px);
    transition: all 0.3s ease;
}
.app-card-modern:hover .action-arrow { opacity: 1; transform: translateX(0); }


/* Thêm vào style.css */

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Bo tròn hoàn toàn */
    object-fit: cover; /* Đảm bảo ảnh không bị méo */
    border: 2px solid var(--accent); /* Viền màu xanh chủ đạo */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    margin-right: 10px; /* Cách tên người dùng một chút */
}

.user-avatar:hover {
    transform: scale(1.1); /* Phóng to nhẹ khi rê chuột vào */
}

/* Cập nhật lại user-info để căn giữa avatar và tên */
.user-info { 
    display: flex; 
    align-items: center; 
    gap: 15px; /* Khoảng cách giữa các phần tử */
}



/* === CẬP NHẬT WELCOME BANNER & QUOTE CARD === */

/* 1. Biến banner thành Flexbox để chứa 2 cột */
.welcome-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap; /* Tự xuống dòng trên mobile */
}

/* 2. Thiết lập độ rộng cho nội dung lời chào */
.welcome-content {
    flex: 1;
    min-width: 300px;
}

/* 3. Trang trí Card Danh ngôn */
.quote-card {
    flex: 0 0 400px; /* Chiều rộng cố định trên Desktop */
    background: rgba(255, 255, 255, 0.4); /* Nền mờ hơn banner chính */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 20px 25px;
    display: flex;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.quote-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.6);
}

.quote-icon i {
    font-size: 24px;
    color: var(--accent);
    opacity: 0.7;
}

.quote-text p {
    font-style: italic;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* 4. Responsive cho Mobile */
@media (max-width: 900px) {
    .quote-card {
        flex: 100%; /* Chiếm hết chiều rộng trên mobile */
        margin-top: 15px;
    }
    .welcome-banner {
        padding: 1.5rem; /* Giảm padding banner trên mobile */
    }
}



/* Responsive */
@media (max-width: 900px) {
    .main { grid-template-columns: 1fr; max-width: 500px; gap: 30px; }
    .intro, .hero-image-placeholder { display: none; }
    .container { padding-top: 30px; }
    .user-name { display: none; }
    .welcome-title { font-size: 1.8rem; }
    .welcome-banner { padding: 2rem; }
    .grid-apps { grid-template-columns: 1fr; }
}
@media (min-width: 768px) { .user-name { display: block; } }



/* =========================================
   5. TREE MASCOT STYLES (INTEGRATED)
   ========================================= */

/* Biến màu sắc riêng cho Tree */

:root {
    --skin-light: #d4f7d4;
    --skin-main: #98e698;
    --skin-shadow: #76c976;
    --leaf-color: #5cdb5c;
    --leaf-dark: #4caf50;
    --stem-color: #3e8e41;
    --glasses-color: #8d5524;
    --blush: #ff99aa;
}



/* Container bao quanh cây trong Banner */
.tree-widget {
    position: relative;
    width: 180px; 
    height: 180px;
    flex-shrink: 0; /* Không bị co lại khi màn hình nhỏ */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-right: 20px;
}

/* Điều chỉnh lại .mascot-wrap cũ để phù hợp container mới */
.mascot-wrap {
    position: absolute;
    bottom: -20px; /* Căn chỉnh vị trí */
    transform: scale(0.7); /* Thu nhỏ cây lại 70% */
    transform-origin: bottom center;
    z-index: 10;
    pointer-events: all; /* Đảm bảo click được */
}

/* Giữ nguyên các class tạo hình cây (Copy từ tree.css nhưng bỏ body/layout) */
.mascot-container {
    position: relative; width: 200px; height: 220px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    cursor: pointer; animation: floatAndBreathe 4s ease-in-out infinite;
}

.body {
    width: 160px; height: 150px;
    background: radial-gradient(circle at 30% 30%, var(--skin-light), var(--skin-main), var(--skin-shadow));
    border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
    position: relative; z-index: 2;
    box-shadow: inset -5px -5px 20px rgba(0,0,0,0.15);
    border: 2px solid rgba(62, 142, 65, 0.2);
}

/* Các bộ phận lá, mắt, kính... (Giữ nguyên logic cũ) */
.leaves-container { position: absolute; top: -50px; left: 50%; transform: translateX(-50%); display: flex; justify-content: center; z-index: 1; width: 120px; }
.leaf-group { position: relative; display: flex; flex-direction: column; align-items: center; transform-origin: bottom center; margin: 0 -5px; }
.stem { width: 4px; height: 25px; background: var(--stem-color); border-radius: 4px; position: absolute; bottom: -10px; z-index: 1; }
.leaf-blade { width: 42px; height: 38px; background: var(--leaf-color); position: relative; z-index: 2; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%; box-shadow: inset 2px 2px 5px rgba(255,255,255,0.4), inset -2px -2px 5px rgba(0,0,0,0.1); border: 2px solid var(--stem-color); }
.leaf-inner { width: 2px; height: 60%; background: rgba(255,255,255,0.3); position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); border-radius: 2px; }

.leaf-group.left { transform: rotate(-30deg) translateY(10px); }
.leaf-group.right { transform: rotate(30deg) translateY(10px); }
.leaf-group.center { transform: translateY(-5px); z-index: 3; }

.glasses { position: absolute; top: 40px; width: 100%; display: flex; justify-content: center; align-items: center; gap: 6px; z-index: 5; }
.lens { width: 55px; height: 55px; border: 6px solid var(--glasses-color); border-radius: 50%; background: rgba(255, 255, 255, 0.2); position: relative; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.bridge { width: 15px; height: 6px; background: var(--glasses-color); border-radius: 4px; }
.eye-bg { width: 100%; height: 100%; position: relative; }

.pupil { width: 18px; height: 24px; background: #2c2c2c; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); transition: transform 0.1s ease-out;}

.shine-big { width: 8px; height: 8px; background: white; border-radius: 50%; position: absolute; top: 5px; left: 4px; }
.shine-small { width: 4px; height: 4px; background: white; border-radius: 50%; position: absolute; bottom: 6px; right: 5px; opacity: 0.8; }

.cheeks { position: absolute; top: 85px; width: 100%; display: flex; justify-content: space-between; padding: 0 30px; box-sizing: border-box; z-index: 4; }
.cheek { width: 25px; height: 15px; background: var(--blush); border-radius: 50%; filter: blur(5px); }
.mouth { width: 16px; height: 12px; background: #6b2e2e; border-radius: 0 0 20px 20px; position: absolute; top: 95px; left: 50%; transform: translateX(-50%); overflow: hidden; transition: 0.2s; z-index: 4; }
.tongue { width: 20px; height: 10px; background: #ff6b6b; border-radius: 50%; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); }
.feet { position: absolute; bottom: -8px; width: 100%; display: flex; justify-content: center; gap: 70px; z-index: 1; }
.foot { width: 20px; height: 18px; background: var(--skin-shadow); border-radius: 0 0 15px 15px; }
.shadow-ground { width: 130px; height: 15px; background: rgba(0,0,0,0.15); border-radius: 50%; margin-top: -5px; filter: blur(4px); animation: shadowScale 4s ease-in-out infinite; }

/* Bong bóng Chat mới */
.bubble-container { position: absolute; top: -120px; width: 800; left: 10%; transform: translateX(-50%); display: flex; justify-content: center; pointer-events: none; z-index: 20; }
.bubble { 
    background: white; color: #333; padding: 12px 15px; border-radius: 15px; 
    font-size: 1.5rem; font-weight: 400; text-align: center; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); border: 2px solid var(--skin-main);
    opacity: 0; transform: translateY(10px); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: auto; min-width: 400px;
}
.bubble.show { opacity: 1; transform: translateY(0); }
/* Mũi tên bong bóng */
.bubble::after { content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--skin-main); }

/* Animation Keyframes */
@keyframes floatAndBreathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.02); } }
@keyframes shadowScale { 0%, 100% { transform: scale(1); opacity: 0.15; } 50% { transform: scale(0.85); opacity: 0.1; } }
.mascot-container:hover .leaf-group.left { transform: rotate(-35deg) translateY(10px); }
.mascot-container:hover .leaf-group.right { transform: rotate(35deg) translateY(10px); }
.mascot-container:hover .mouth { height: 18px; }

/* Ẩn trên mobile nếu cần */
@media (max-width: 768px) {
    .tree-widget { display: none; }
}





/* =========================================
   6. CHATBOT WIDGET STYLES
   ========================================= */

.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: 'Google Sans Flex', sans-serif;
}

/* --- NÚT TRÒN NỔI (TOGGLE BUTTON) --- */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent); /* Màu xanh chủ đạo */
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-toggle-btn:hover {
    transform: scale(1.1) rotate(10deg);
    background: var(--accent-dark);
}

/* Hiệu ứng rung nhẹ để gây chú ý */
.chat-toggle-btn {
    animation: pulse-blue 2s infinite;
}
@keyframes pulse-blue {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* --- KHUNG CHAT (CHAT BOX) --- */
.chat-box {
    width: 350px;
    height: 450px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.5);
    display: flex;
    flex-direction: column;
    margin-bottom: 20px; /* Cách nút chat một chút */
    
    /* Animation ẩn/hiện */
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    bottom: 70px; /* Đẩy lên trên nút chat */
    right: 0;
}

/* Class active để hiện khung chat */
.chat-box.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: var(--accent);
    color: white;
    padding: 15px 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.close-chat { background: none; border: none; color: white; cursor: pointer; font-size: 16px; opacity: 0.8; }
.close-chat:hover { opacity: 1; transform: scale(1.1); }

/* Body (Vùng tin nhắn) */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.message { max-width: 80%; padding: 10px 15px; border-radius: 15px; font-size: 14px; line-height: 1.4; }
.message.bot { align-self: flex-start; background: white; border: 1px solid #e5e7eb; border-bottom-left-radius: 2px; color: var(--text-primary); }
.message.user { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 2px; }

/* Footer (Ô nhập liệu) */
.chat-footer {
    padding: 10px 15px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 0 0 20px 20px;
}
#chat-input {
    flex: 1;
    border: none;
    background: #f3f4f6;
    padding: 10px 15px;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}
#send-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s;
}
#send-btn:hover { transform: scale(1.2); color: var(--accent-dark); }

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-box { width: 300px; height: 400px; }
}


/* --- CSS CHO TIN NHẮN MARKDOWN --- */
.msg-content.markdown-body {
    line-height: 1.5;
    font-size: 14px;
}
.msg-content.markdown-body p {
    margin-bottom: 8px; /* Tách đoạn văn */
}
.msg-content.markdown-body ul, 
.msg-content.markdown-body ol {
    margin-left: 20px; /* Thụt lề cho danh sách */
    margin-bottom: 8px;
}
.msg-content.markdown-body strong {
    font-weight: 700; /* In đậm rõ hơn */
    color: #000;      /* Màu đen cho dễ đọc */
}
.msg-content.markdown-body pre {
    background: #f1f5f9;
    padding: 8px;
    border-radius: 6px;
    overflow-x: auto; /* Cho phép cuộn ngang nếu code dài */
}



/* =========================================
   7. INDEX PAGE STYLES (FIXED & POLISHED)
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Google Sans Flex:wght@300;400;500;600;700;800&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Google Sans Flex', sans-serif; }

/* =========================================
   LOGIN PAGE STYLES (FINAL FIX)
   ========================================= */

/* 1. BACKGROUND & BLOBS (Nền động) */
.login-page-body {
    /* Quan trọng: min-height 100vh để đảm bảo bao phủ toàn bộ chiều cao cửa sổ */
    min-height: 100vh;
    width: 100%;
    
    /* Sử dụng Flexbox để căn giữa cả dọc và ngang */
    display: flex;
    align-items: center; /* Căn giữa dọc */
    justify-content: center; /* Căn giữa ngang */
    
    background-color: #f3f4f6;
    position: relative;
    overflow: hidden; /* Ẩn thanh cuộn nếu blob bay ra ngoài */
    margin: 0; /* Xóa margin mặc định của body */
}

.background-animate {
    position: absolute; inset: 0; z-index: 0;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

.blob {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: 0.6;
    animation: float 15s infinite ease-in-out alternate;
}
.b-1 { top: -10%; left: -10%; width: 600px; height: 600px; background: #cbf3f2; } /* Tím nhạt */
.b-2 { bottom: -10%; right: -10%; width: 500px; height: 500px; background: #d1e6fd; } /* Xanh dương */
.b-3 { top: 40%; left: 30%; width: 300px; height: 300px; background: #fca5a5; opacity: 0.4; } /* Hồng cam */

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, -30px); }
}

/* 2. GLASS CONTAINER (Khung chính) */
.glass-container {
    position: relative; z-index: 10;
    width: 1100px; max-width: 90%; min-height: 650px;
    
    /* Hiệu ứng kính */
    background: rgba(255, 255, 255, 0.2); 
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    
    display: flex;
    overflow: hidden;
}

/* 3. LEFT PANEL (Visual - Bên trái trong suốt) */
.left-panel {
    flex: 1.2;
    padding: 40px;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Giữ nền trong suốt để thấy blob phía sau */
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
}

/* Logo */
.brand-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; 
    padding-left: 20px;
}
.logo-img { height: 65px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.school-name { font-weight: 800; color: var(--primary-color); font-size: 1.1rem; }
.portal-name { font-size: 0.8rem; color: #64748b; letter-spacing: 1px; }

/* Căn giữa nội dung ảnh và chữ */
.left-content-centered {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Căn giữa dọc */
    padding-left: 20px; /* Thụt vào một chút */
}

/* Ảnh học sinh */
.hero-visual {
    position: relative;
    width: fit-content;
    margin-bottom: 30px;
}

.image-mask {
    width: 100%; height: 350px;
    border-radius: 24px;
    overflow: hidden;
    /* Bỏ rotate để giao diện gọn gàng hơn */
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    /* border: 1px solid rgba(255,255,255,0.7); */
}
.image-mask img { width: 100%; height: 100%; object-fit: cover; }

/* Nút Secure Login nổi */
.floating-badge {
    position: absolute;
    bottom: 20px; right: -20px;
    background: #fff;
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    font-size: 0.9rem; font-weight: 700; color: #10b981;
    display: flex; align-items: center; gap: 8px;
    z-index: 2;
}

/* Chữ giới thiệu */
.intro-text h1 {
    font-size: 1.2rem; font-weight: 800;
    color: var(--primary-color);
    /*
    background: linear-gradient(to right, #2563eb, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    */
    margin-bottom: 15px;
    line-height: 1.1;
}
.intro-text p {
    font-size: 1rem; color: #475569; line-height: 1.6; max-width: 90%;
}

/* 4. RIGHT PANEL (Form - Bên phải) */
.right-panel {
    flex: 1;
    background: white;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border-radius: 30px;
}

/* Nút ngôn ngữ */
.lang-switch-absolute {
    position: absolute; top: 15px; right: 15px;
    background: #f1f5f9; padding: 4px; border-radius: 10px;
}
.lang-switch-absolute button {
    border: none; background: transparent; padding: 6px 12px;
    font-size: 12px; font-weight: 700; color: #94a3b8;
    border-radius: 8px; cursor: pointer; transition: 0.2s;
}
.lang-switch-absolute button.active {
    background: white; color: #2563eb; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Form Styles */
.form-header { margin-bottom: 40px; }
.form-header h2 { font-size: 2rem; font-weight: 800; color: var(--primary-color); margin-bottom: 8px; }
.form-header p { color: #64748b; font-size: 1rem; }

/* Input hiện đại */
.input-wrapper {
    position: relative; height: 56px;
    background: #f8fafc; border: 1px solid #cbd5e1;
    border-radius: 12px; margin-bottom: 24px;
    transition: 0.3s;
}
.input-wrapper:focus-within {
    border-color: #2563eb; background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.input-wrapper .icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: 18px;
}
.input-wrapper input {
    width: 100%; height: 100%; border: none; background: transparent;
    padding: 24px 16px 8px 48px; /* Padding để chừa chỗ cho label và icon */
    font-size: 16px; font-weight: 600; color: #334155; outline: none;
}
.input-wrapper label {
    position: absolute; left: 48px; top: 18px;
    font-size: 14px; color: #94a3b8; pointer-events: none; transition: 0.2s;
}
/* Hiệu ứng label trượt lên */
.input-wrapper input:focus ~ label,
.input-wrapper input:not(:placeholder-shown) ~ label {
    top: 8px; font-size: 11px; font-weight: 700; color: #2563eb;
}

/* Checkbox */
.options-row { margin-bottom: 30px; display: flex; align-items: center; }
.custom-checkbox { display: flex; align-items: center; cursor: pointer; font-size: 16px; color: #64748b; }
.custom-checkbox input { display: none; }
.checkmark {
    width: 20px; height: 20px; border: 2px solid #cbd5e1; border-radius: 6px;
    margin-right: 10px; position: relative; transition: 0.2s;
}
.custom-checkbox input:checked ~ .checkmark { background: #2563eb; border-color: #2563eb; }
.checkmark::after {
    content: ""; position: absolute; display: none;
    left: 6px; top: 2px; width: 5px; height: 10px;
    border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.custom-checkbox input:checked ~ .checkmark::after { display: block; }

/* Button Gradient */
.btn-primary-gradient {
    width: 100%; padding: 16px; border: none; border-radius: 12px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white; font-size: 16px; font-weight: 700; cursor: pointer;
    display: flex; justify-content: center; align-items: center; gap: 10px;
    transition: 0.3s; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-primary-gradient:hover {
    transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

#btn-continue {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Giúp màu sắc và icon thay đổi mượt hơn */
}

#btn-icon {
    transition: transform 0.3s ease;
}

/* Footer links */
.support-footer { text-align: center; margin-top: 20px; color: #64748b; font-size: 0.9rem; }
.support-footer a { color: #2563eb; font-weight: 600; text-decoration: none; }

.copyright-text {
    position: absolute; bottom: 20px; width: 100%; text-align: center; left: 0;
    font-size: 1rem; color: #a8aaad;
}

/* Alert Error */
.alert-modern.error {
    background: #fef2f2; color: #991b1b; padding: 12px; border-radius: 8px;
    margin-bottom: 20px; display: flex; align-items: center; gap: 8px; font-size: 0.9rem;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .glass-container { flex-direction: column; height: auto; }
    .left-panel { min-height: 200px; padding: 30px; align-items: center; text-align: center; }
    .hero-visual { display: none; } /* Ẩn ảnh trên mobile */
    .left-content-centered { padding-left: 0; }
    .right-panel { padding: 40px 30px; }
}



/* --- HIỆU ỨNG TYPING (DẤU 3 CHẤM ĐỘNG) --- */

/* Container chứa 3 dấu chấm */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px; /* Khoảng cách giữa các chấm */
    padding: 5px 0; /* Căn chỉnh vị trí */
    min-width: 40px;
}

/* Định dạng từng dấu chấm */
.typing-indicator span {
    display: block;
    width: 8px;
    height: 8px;
    background-color: #6b7280; /* Màu xám của dấu chấm */
    border-radius: 50%; /* Bo tròn thành hình tròn */
    opacity: 0.6;
    animation: bounce 1.4s infinite ease-in-out both; /* Hiệu ứng chuyển động */
}

/* Tạo độ trễ để các chấm nhảy lần lượt (tạo sóng) */
.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Keyframes tạo chuyển động phóng to/thu nhỏ */
@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0); 
    }
    40% { 
        transform: scale(1); 
    }
}

/* =========================================
   8. CUSTOM DROPDOWN (ĐÃ FIX GIAO DIỆN)
   ========================================= */

.custom-select-container {
    position: relative;
    width: 200px; /* Chiều rộng cố định */
    font-family: 'Google Sans', sans-serif;
    margin-left: auto; /* Đẩy sang phải nếu cần */
    margin-right: 10px;
    z-index: 9999; /* Luôn nằm trên cùng */
}

/* --- Nút bấm chính (Trigger) --- */
.custom-select-trigger {
    /* Nền trắng mờ để nổi bật trên nền xanh */
    background: rgba(255, 255, 255, 0.2); 
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 35px; /* Chiều cao cố định cho nút */
}

.custom-select-trigger:hover {
    background: rgba(255, 255, 255, 0.3);
}

.selected-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff; /* Chữ trên nút giữ màu trắng */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arrow {
    font-size: 10px;
    color: #ffffff;
}

/* --- Menu xổ xuống (Phần bị lỗi trong ảnh) --- */
.custom-options {
    position: absolute;
    top: 45px; /* Cách nút bấm một đoạn */
    right: 0; /* Căn phải để không bị tràn ra ngoài màn hình */
    width: 280px; /* Rộng hơn để chứa đủ chữ */
    
    /* QUAN TRỌNG: Màu nền trắng đặc để che nền xanh bên dưới */
    background-color: #ffffff !important; 
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 8px;
    
    /* Animation */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10000; /* Đảm bảo đè lên mọi thứ */
}

/* Khi mở menu */
.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- Từng mục chọn --- */
.option-item {
    display: flex !important; /* Bắt buộc xếp ngang */
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.option-item:last-child {
    border-bottom: none;
}

.option-item:hover {
    background-color: #f3f4f6 !important; /* Màu nền khi di chuột */
}

/* Icon box */
.icon-box {
    width: 32px; height: 32px;
    min-width: 32px; /* Không bị co lại */
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 14px;
}

/* Màu icon */
.hr-color { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.cd-color { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.am-color { background: linear-gradient(135deg, #10b981, #059669); }

/* Text box - QUAN TRỌNG: Ép màu chữ đen */
.text-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Căn trái */
}

.text-box .title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937 !important; /* Màu đen đậm */
    margin-bottom: 2px;
}

.text-box .desc {
    font-size: 11px;
    color: #6b7280 !important; /* Màu xám */
    font-weight: 400;
    line-height: 1.2;
}