/* --- 1. CORE STYLES & VARIABLES --- */
:root { 
    /* Giao diện Sáng (Mặc định) */
    --primary: #2e7d32; 
    --primary-dark: #1b5e20;
    --accent: #ffca28; 
    --danger: #d32f2f; 
    --info: #0288d1;
    --bg: #f8f9fa; 
    --text: #333; 
    --text-sec: #666;
    --white: #ffffff;
    --card-bg: #ffffff;
    --border: #e0e0e0;
    --input-bg: #fafafa;
    --admin-color: #c62828; 
    --archive-color: #4e342e;
    --nav-height: 65px;
    --ai-color: #6200ea;
    --shadow: rgba(0,0,0,0.05);
}

/* Giao diện Tối (Dark Mode) */
body.dark-mode {
    --primary: #66bb6a; /* Xanh lá sáng hơn, sắc nét trên nền tối */
    --primary-dark: #4caf50;
    --bg: #0f1115; /* Nền tối sâu có chút ánh xanh đen (slate dark) sang trọng */
    --text: #f3f4f6; /* Trắng sáng hơn để tăng độ tương phản, dễ đọc */
    --text-sec: #9ca3af;
    --white: #1e1e1e;
    --card-bg: #191c20; /* Card màu xám đen nổi bật trên nền */
    --border: #2e3238; /* Viền sáng hơn để tách biệt rõ các khối */
    --input-bg: #23272d;
    --shadow: rgba(0,0,0,0.4);
}
/* Fix màu gradient khi ở Dark Mode để không bị chói */
body.dark-mode .featured-section { background: linear-gradient(135deg, #1b5e20, #2e7d32); border-color: #43a047; }
body.dark-mode #pinned-post { background: linear-gradient(135deg, #e65100, #ef6c00); border-color: #ff9800; }
body.dark-mode .featured-content h3 { color: #fff; }
body.dark-mode .featured-badge { color: #fff; }

/* --- TINH CHỈNH CHI TIẾT DARK MODE --- */
/* Thanh điều hướng PC */
body.dark-mode nav.pc-nav { background: var(--card-bg); border-bottom: 1px solid var(--border); box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
body.dark-mode nav.pc-nav ul li a { color: var(--text-sec); }
body.dark-mode nav.pc-nav ul li a:hover, body.dark-mode nav.pc-nav ul li a.active-menu { background-color: rgba(102, 187, 106, 0.1); color: var(--primary); }

/* Thẻ Tra cứu rác (Ghi đè inline style) */
body.dark-mode .trash-card:nth-child(1) { background: rgba(33, 150, 243, 0.1) !important; color: #90caf9 !important; border-color: rgba(33, 150, 243, 0.3) !important; }
body.dark-mode .trash-card:nth-child(2) { background: rgba(76, 175, 80, 0.1) !important; color: #a5d6a7 !important; border-color: rgba(76, 175, 80, 0.3) !important; }
body.dark-mode .trash-card:nth-child(3) { background: rgba(255, 152, 0, 0.1) !important; color: #ffcc80 !important; border-color: rgba(255, 152, 0, 0.3) !important; }

/* Bảng xếp hạng và Sidebar */
body.dark-mode .rank-top-1 { background: rgba(255, 213, 79, 0.15); color: #ffe082; }
body.dark-mode .rank-top-1 .rank-num { background: #ffca28; color: #121212; }
body.dark-mode .locked-overlay { background: rgba(255, 255, 255, 0.03); border-color: var(--border); color: var(--text-sec); }
body.dark-mode .locked-overlay h2 { color: var(--text); }
body.dark-mode .sidebar-header { background: var(--card-bg); }
body.dark-mode .sidebar-item.active-menu { background: rgba(102, 187, 106, 0.15); color: var(--primary); border-left-color: var(--primary); }

/* Các nút tương tác nhúng (Chips) */
body.dark-mode .suggestion-chip { background: transparent; border-color: var(--primary); color: var(--primary); }
body.dark-mode .suggestion-chip:hover { background: var(--primary); color: var(--bg); }
body.dark-mode .quick-chip { background: rgba(102, 187, 106, 0.15); color: var(--primary); border-color: rgba(102, 187, 106, 0.3); }
body.dark-mode .quick-chip:hover { background: var(--primary); color: var(--bg); }

/* Tinh chỉnh thanh cuộn (Scrollbar) cho màn hình tối */
body.dark-mode ::-webkit-scrollbar { width: 8px; height: 8px; }
body.dark-mode ::-webkit-scrollbar-track { background: var(--bg); }
body.dark-mode ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #555; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    font-family: 'Inter', sans-serif; margin: 0; padding: 0; 
    background-color: var(--bg); color: var(--text);
    overscroll-behavior-y: contain; 
    transition: background-color 0.4s ease, color 0.4s ease; /* Hiệu ứng chuyển màu mượt hơn */
    animation: fadeInPage 0.8s ease-out;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.no-scroll { overflow: hidden; }

/* --- SEASONAL EFFECT --- */
#seasonal-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Cho phép click xuyên qua */
    z-index: 999; /* Nằm trên nội dung nền nhưng dưới các popup */
}

/* --- SEASONAL GAME UI --- */
#seasonal-score {
    position: fixed; top: 80px; left: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px; border-radius: 30px;
    font-weight: 800; color: var(--primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1900; display: none;
    border: 2px solid var(--primary);
    backdrop-filter: blur(5px);
    font-size: 1rem;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.floating-score {
    position: fixed; pointer-events: none;
    color: #ff9800; font-weight: 900; font-size: 1.5rem;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 10000; text-shadow: 2px 2px 0 #fff;
    font-family: 'Inter', sans-serif;
}
@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes floatUp {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-60px) scale(1.5); opacity: 0; }
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

.effect-menu {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    z-index: 2000; display: none; overflow: hidden;
    animation: popIn 0.3s ease-out;
    min-width: 200px;
}
.effect-menu.active { display: block; }

/* --- SPLASH SCREEN --- */
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg); /* Trùng màu nền web */
    z-index: 9999999; /* Cao nhất đè lên tất cả */
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}
#splash-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
    /* Tự động chỉnh kích thước: 35% chiều rộng/cao màn hình (tùy cái nào nhỏ hơn) */
    width: 60vmin; height: auto; 
    /* Giới hạn: Không nhỏ quá 120px (điện thoại bé) và không to quá 300px (PC) */
    min-width: 200px; max-width: 600px;
    object-fit: contain;
    animation: pulseLogo 2s infinite ease-in-out;
    margin-bottom: 30px;
    /* Hiệu ứng đổ bóng phát sáng nhẹ giúp logo nổi bật */
    filter: drop-shadow(0 0 15px rgba(46, 125, 50, 0.4));
}
.splash-loader {
    width: 40px; height: 40px; border: 4px solid var(--border);
    border-top: 4px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes pulseLogo { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.effect-menu div { padding: 10px 15px; cursor: pointer; font-size: 0.9rem; color: var(--text); border-bottom: 1px solid var(--border); transition: 0.2s; }
.effect-menu div:last-child { border-bottom: none; }
.effect-menu div:hover { background: var(--input-bg); color: var(--primary); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- WEBVIEW WARNING --- */
#webview-warning {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg); 
    z-index: 999999;
    flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 30px;
}
.wv-icon { font-size: 5rem; color: #ff9800; margin-bottom: 20px; animation: float 2s infinite ease-in-out; }
.wv-title { font-size: 1.6rem; color: var(--text); margin-bottom: 15px; font-weight: 800; font-family: 'Inter', sans-serif; }
.wv-desc { color: var(--text-sec); margin-bottom: 30px; font-size: 1.1rem; line-height: 1.6; max-width: 500px; }
.wv-arrow { font-size: 3rem; color: var(--primary); animation: bounce 1.5s infinite; position: absolute; top: 20px; right: 20px; }
@keyframes float { 0%, 100% {transform: translateY(0);} 50% {transform: translateY(-10px);} }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(20px);} 60% {transform: translateY(10px);} }

/* --- MAINTENANCE OVERLAY --- */
#maintenance-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: var(--bg);
    z-index: 99999;
    flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 20px;
}
#maintenance-overlay h1 { font-size: 2.2rem; margin-bottom: 10px; color: var(--primary); border: none; }
#maintenance-overlay p { font-size: 1.1rem; color: var(--text-sec); margin-bottom: 30px; max-width: 600px; }
#maintenance-overlay i.fa-hammer { font-size: 6rem; color: #ffa000; margin-bottom: 20px; animation: hammer 2s infinite; }
@keyframes hammer { 0% {transform: rotate(0);} 20% {transform: rotate(-15deg);} 40% {transform: rotate(10deg);} 60% {transform: rotate(-5deg);} 100% {transform: rotate(0);} }

/* --- NOTIFICATION POPUP (GLOBAL ADMIN) --- */
#notification-popup {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    background: var(--card-bg); width: 300px; padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow);
    border-left: 5px solid var(--primary);
    display: flex; align-items: flex-start; gap: 12px;
    transform: translateX(150%); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0; visibility: hidden; border: 1px solid var(--border);
}
#notification-popup.show { transform: translateX(0); opacity: 1; visibility: visible; }
.notif-icon { color: var(--primary); font-size: 1.5rem; margin-top: 2px; }
.notif-content h4 { margin: 0 0 5px 0; font-size: 1rem; color: var(--text); }
.notif-content p { margin: 0; font-size: 0.9rem; color: var(--text-sec); line-height: 1.4; }
.notif-close { position: absolute; top: 5px; right: 10px; cursor: pointer; color: var(--text-sec); font-size: 0.8rem; }

/* --- BELL & DROPDOWN (PERSONAL) --- */
.header-bell {
    position: fixed; top: 15px; right: 15px; z-index: 1001;
    width: 42px; height: 42px; 
    background: var(--card-bg); backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px var(--shadow); border: 1px solid var(--border);
    cursor: pointer; transition: all 0.3s; color: var(--text);
}
.header-bell:hover { transform: scale(1.1); }
.bell-dot { position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; background: #ff1744; border-radius: 50%; border: 2px solid var(--card-bg); display: none; }

.notif-dropdown {
    position: fixed; top: 70px; right: 20px; width: 320px;
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow);
    z-index: 1002; display: none; overflow: hidden;
    border: 1px solid var(--border);
    animation: slideDown 0.3s ease-out;
}
.notif-dropdown.active { display: block; }
.notif-header {
    padding: 12px 15px; border-bottom: 1px solid var(--border);
    font-weight: bold; color: var(--primary);
    display: flex; justify-content: space-between; align-items: center; background: var(--card-bg);
}
.notif-list { max-height: 350px; overflow-y: auto; background: var(--card-bg); }
.notif-item {
    padding: 0; border-bottom: 1px solid var(--border);
    display: flex; align-items: stretch;
    transition: 0.2s; position: relative;
}
.notif-content-wrapper {
    flex: 1; padding: 12px 15px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
}
.notif-content-wrapper:hover { background: var(--input-bg); }
.notif-item.unread { background: rgba(46, 125, 50, 0.1); } 
.notif-item.unread::after {
    content: ''; position: absolute; top: 15px; right: 10px;
    width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
}
.notif-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.notif-body { flex: 1; }
.notif-body p { margin: 0; font-size: 0.9rem; color: var(--text); line-height: 1.3; }
.notif-time { font-size: 0.75rem; color: var(--text-sec); margin-top: 4px; display: block; }
.notif-delete-btn {
    width: 40px; background: transparent; border: none; border-left: 1px solid var(--border);
    color: var(--text-sec); cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1rem; transition: 0.2s;
}
.notif-delete-btn:hover {
    background: #ffebee; color: var(--danger);
}
.empty-notif { text-align: center; padding: 20px; color: var(--text-sec); font-size: 0.9rem; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- PULL TO REFRESH --- */
#ptr-loader {
    position: fixed; top: -70px; left: 0; width: 100%; height: 70px;
    display: flex; justify-content: center; align-items: flex-end; padding-bottom: 15px;
    z-index: 9998; transition: top 0.2s ease-out; pointer-events: none;
}
.ptr-icon {
    font-size: 20px; color: var(--primary); background: var(--card-bg); 
    width: 45px; height: 45px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px var(--shadow); transition: transform 0.2s;
    border: 2px solid var(--primary);
}

/* --- NAVIGATION --- */
nav.pc-nav { background: linear-gradient(to right, var(--primary), var(--primary-dark)); padding: 15px 0; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.1); display: block; padding-right: 60px; }
nav.pc-nav ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 10px; }
nav.pc-nav ul li a { color: #ffffff; text-decoration: none; font-weight: 700; text-transform: uppercase; padding: 10px 20px; font-size: 0.9rem; border-radius: 30px; transition: 0.3s; cursor: pointer; }
nav.pc-nav ul li a:hover, nav.pc-nav ul li a.active-menu { background-color: rgba(255,255,255,0.2); color: var(--accent); transform: translateY(-2px); }

/* --- MOBILE MENU (HAMBURGER & SIDEBAR) --- */
.mobile-menu-btn {
    position: fixed; top: 15px; left: 15px; z-index: 1001;
    width: 42px; height: 42px;
    background: var(--card-bg); backdrop-filter: blur(5px);
    border-radius: 50%;
    display: none; /* Hidden by default (PC) */
    align-items: center; justify-content: center;
    box-shadow: 0 4px 15px var(--shadow); border: 1px solid var(--border);
    cursor: pointer; color: var(--text); font-size: 1.2rem;
    transition: transform 0.2s;
}
.mobile-menu-btn:active { transform: scale(0.9); }

.mobile-sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 10000;
    display: none; opacity: 0; transition: opacity 0.3s;
    backdrop-filter: blur(3px);
}
.mobile-sidebar-overlay.active { display: block; opacity: 1; }

.mobile-sidebar {
    position: fixed; top: 0; left: 0; width: 280px; height: 100%;
    background: var(--card-bg); z-index: 10001;
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; border-right: 1px solid var(--border);
}
.mobile-sidebar.active { transform: translateX(0); }

.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--input-bg); }
.sidebar-header h3 { margin: 0; color: var(--primary); font-size: 1.2rem; font-weight: 800; }
.sidebar-close { background: none; border: none; font-size: 1.4rem; color: var(--text-sec); cursor: pointer; }
/* Sidebar Profile Header */
.sidebar-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 1; }
#sb-avatar { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.sb-info { display: flex; flex-direction: column; line-height: 1.3; }
#sb-name { font-weight: 800; color: var(--text); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
#sb-id { font-size: 0.8rem; color: var(--text-sec); }

.sidebar-content { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-item { display: flex; align-items: center; gap: 15px; padding: 15px 25px; color: var(--text); text-decoration: none; font-weight: 500; transition: 0.2s; border-left: 4px solid transparent; }
.sidebar-item:hover { background: var(--input-bg); }
.sidebar-item.active-menu { background: rgba(46, 125, 50, 0.1); color: var(--primary); border-left-color: var(--primary); font-weight: 700; }
.sidebar-item i { width: 25px; text-align: center; font-size: 1.1rem; }

/* --- LAYOUT --- */
.container { max-width: 1200px; width: 95%; margin: 25px auto; background: var(--card-bg); padding: 30px; border-radius: 20px; box-shadow: 0 10px 40px var(--shadow); min-height: 80vh; border: 1px solid var(--border); flex: 1; }
.page-section { display: none; animation: fadeIn 0.4s ease-out; }
.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.locked-overlay { text-align: center; padding: 60px 20px; background: rgba(255, 253, 231, 0.1); border: 2px dashed var(--accent); border-radius: 15px; color: var(--accent); margin-bottom: 30px; }
h1 { font-family: 'Inter', sans-serif; color: var(--primary); text-align: center; border-bottom: 4px solid var(--accent); display: inline-block; padding-bottom: 8px; margin-bottom: 35px; position: relative; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 2rem; }
h2 { color: var(--primary-dark); margin-top: 0; font-size: 1.4rem; border-left: 5px solid var(--accent); padding-left: 15px; margin-bottom: 20px; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 25px; margin-bottom: 25px; box-shadow: 0 4px 15px var(--shadow); transition: 0.3s; }

/* --- BUTTONS & INPUTS --- */
.btn { background: var(--primary); color: white; border: none; padding: 12px 24px; border-radius: 10px; cursor: pointer; font-weight: bold; font-size: 1rem; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-danger { background: var(--danger); } 
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; border-radius: 6px; }
.btn-ghost-danger { background: transparent; color: var(--text-sec); border: 1px solid var(--border); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: 0.3s; }
.btn-ghost-danger:hover { background: rgba(211, 47, 47, 0.1); color: var(--danger); border-color: var(--danger); }
.btn-ai { background: linear-gradient(135deg, #6200ea, #b388ff); color: white; border: none; box-shadow: 0 4px 10px rgba(98, 0, 234, 0.3); }
.btn-ai:hover { transform: scale(1.05); }

input, textarea, select { width: 100%; padding: 14px; margin: 10px 0; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 1rem; transition: 0.3s; background: var(--input-bg); color: var(--text); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1); }

/* --- EXTRAS & MUSIC --- */
.countdown-container { background: linear-gradient(135deg, #d32f2f, #c62828); color: white; padding: 15px 20px; border-radius: 12px; margin-bottom: 25px; box-shadow: 0 8px 20px rgba(211, 47, 47, 0.3); display: none; text-align: center; border: 1px solid rgba(255,255,255,0.2); }
.timer-display { font-size: 2rem; font-weight: 800; font-family: monospace; letter-spacing: 2px; margin-top: 5px; }

.music-icon { font-size: 35px; color: var(--text); transition: 0.5s; }
.music-icon.playing { animation: spin 3s linear infinite; color: var(--primary); font-size: 24px; } /* Chỉnh lại size icon trong menu nhỏ */
.music-note-badge { position: absolute; top: -5px; right: -5px; background: var(--accent); color: #333; width: 20px; height: 20px; border-radius: 50%; font-size: 10px; display: flex; align-items: center; justify-content: center; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- AI FAB (STANDALONE) --- */
.ai-fab {
    position: fixed; bottom: 160px; right: 10px; z-index: 2000; /* Thẳng hàng với nút Cài đặt */
    width: 55px; height: 55px; border-radius: 50%; /* Đồng bộ kích thước với nút Cài đặt */
    background: linear-gradient(135deg, #6200ea, #b388ff);
    box-shadow: 0 5px 25px rgba(98, 0, 234, 0.5);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    border: 3px solid white; transition: 0.3s; animation: floatAI 3s infinite ease-in-out;
}
.ai-fab:hover { transform: scale(1.1) rotate(10deg); }
.ai-fab img { width: 70%; height: 70%; object-fit: contain; }
@keyframes floatAI { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* --- AI CHATBOT UI (GEMINI STYLE) --- */
.ai-chat-window { 
    position: fixed; bottom: 20px; right: 80px; width: 380px; height: 600px; 
    background: var(--card-bg); border-radius: 24px; box-shadow: 0 10px 40px var(--shadow); 
    z-index: 2001; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); font-family: 'Inter', sans-serif;
    /* Animation States */
    opacity: 0; visibility: hidden; transform: scale(0.5); transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    pointer-events: none;
    min-width: 320px; min-height: 400px; /* Giới hạn nhỏ nhất */
    max-width: 90vw; max-height: 90vh;   /* Giới hạn lớn nhất */
}
.ai-chat-window.active {
    opacity: 1; visibility: visible; transform: scale(1);
    pointer-events: auto;
}

/* Mũi tên chỉ vào Logo (Tạo bằng CSS Triangle) */
.ai-chat-window::after, .ai-chat-window::before {
    content: ''; position: absolute; right: -12px; bottom: 165px; /* Căn chỉnh với vị trí nút FAB */
    border-style: solid; pointer-events: none;
}
/* Mũi tên nền (Màu của card) */
.ai-chat-window::after {
    border-width: 12px 0 12px 12px;
    border-color: transparent transparent transparent var(--card-bg);
}
/* Viền mũi tên (Màu border) */
.ai-chat-window::before {
    right: -13px;
    border-width: 12px 0 12px 12px;
    border-color: transparent transparent transparent var(--border);
}

.ai-header { background: var(--card-bg); color: var(--text); padding: 15px 20px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); font-size: 1.1rem; }
.ai-body { flex: 1; padding: 20px; overflow-y: auto; background: var(--bg); display: flex; flex-direction: column; gap: 24px; scroll-behavior: smooth; }

/* Chat Rows */
.chat-row { display: flex; gap: 12px; width: 100%; align-items: flex-start; animation: fadeIn 0.3s ease-out; }
.chat-row.user { justify-content: flex-end; }
.chat-row.bot { justify-content: flex-start; }

/* Avatar */
.chat-avatar { width: 35px; height: 35px; flex-shrink: 0; border-radius: 50%; background: white; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); margin-top: 2px; }
.chat-avatar img { width: 24px; height: 24px; object-fit: contain; }

/* Bubbles */
.chat-bubble { max-width: 85%; font-size: 0.95rem; line-height: 1.6; position: relative; word-wrap: break-word; }

/* User Bubble (Gemini Style: Light Gray Pill) */
.chat-bubble.user { background: #e9eef6; color: #0b57d0; padding: 12px 18px; border-radius: 20px 4px 20px 20px; font-weight: 500; }
body.dark-mode .chat-bubble.user { background: #444746; color: #a8c7fa; }

/* Bot Bubble (Gemini Style: Clean Text) */
.chat-bubble.bot { background: transparent; color: var(--text); padding: 0; border-radius: 0; width: 100%; }

/* Typography in Bot Message */
.chat-bubble.bot p { margin: 0 0 8px 0; }
.chat-bubble.bot strong { font-weight: 700; color: var(--text); }
.chat-bubble.bot ul { margin: 5px 0 10px 20px; padding: 0; }
.chat-bubble.bot li { margin-bottom: 4px; }

/* AI Feedback Buttons Styles */
.ai-feedback-btns {
    display: flex; gap: 12px; margin-top: 10px; padding-top: 8px;
    border-top: 1px dashed var(--border); justify-content: flex-end;
}
.ai-feedback-btns button {
    background: transparent; border: none; color: var(--text-sec);
    cursor: pointer; font-size: 0.95rem; transition: transform 0.2s, color 0.2s;
    padding: 0;
}
.ai-feedback-btns button:hover { color: var(--primary); transform: scale(1.1); }

/* AI Table Styles */
.chat-bubble.bot table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px var(--shadow);
}
.chat-bubble.bot th, .chat-bubble.bot td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.chat-bubble.bot th { background: var(--bg); font-weight: 700; color: var(--primary); }
.chat-bubble.bot tr:last-child td { border-bottom: none; }
.chat-bubble.bot tr:hover { background-color: var(--bg); }

/* --- TRASH GUIDE STYLES --- */
.trash-card {
    flex: 1; min-width: 140px; padding: 20px; border-radius: 12px;
    text-align: center; cursor: pointer; transition: 0.3s;
    box-shadow: 0 4px 10px var(--shadow);
}
.trash-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px var(--shadow); }
.trash-card i { font-size: 2.5rem; margin-bottom: 10px; display: block; }
.trash-card h3 { margin: 0 0 5px 0; font-size: 1.1rem; }
.trash-card span { font-size: 0.9rem; font-weight: bold; opacity: 0.8; }

/* --- TRASH ITEM CARDS (NEW) --- */
.trash-item-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px; gap: 10px; text-align: center;
    transition: transform 0.2s;
}
.trash-item-card:hover { transform: translateY(-3px); }
.trash-icon-circle {
    width: 60px; height: 60px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: white;
    margin-bottom: 5px; box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.bin-recycle-bg { background: linear-gradient(135deg, #42a5f5, #1976d2); }
.bin-organic-bg { background: linear-gradient(135deg, #66bb6a, #388e3c); }
.bin-other-bg { background: linear-gradient(135deg, #ffa726, #f57c00); }
.bin-recycle-text { color: #1976d2; font-size: 0.85rem; font-weight: bold; }
.bin-organic-text { color: #388e3c; font-size: 0.85rem; font-weight: bold; }
.bin-other-text { color: #f57c00; font-size: 0.85rem; font-weight: bold; }

/* Input Area */
.ai-input-area { padding: 15px; border-top: 1px solid var(--border); display: flex; gap: 10px; background: var(--card-bg); align-items: center; }
.ai-input-area input { margin: 0; padding: 12px 15px; font-size: 0.95rem; border-radius: 24px; background: var(--input-bg); border: 1px solid var(--border); flex: 1; transition: 0.3s; }
.ai-input-area input:focus { background: var(--card-bg); box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-color: var(--primary); }
.btn-ai-send { width: 40px; height: 40px; border-radius: 50%; background: transparent; color: var(--primary); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; transition: 0.2s; }
.btn-ai-send:hover { background: var(--input-bg); transform: rotate(-45deg); }
.btn-ai-send.listening { color: #d32f2f; animation: pulseMic 1.5s infinite; background: rgba(211, 47, 47, 0.1); }
@keyframes pulseMic { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Suggestions */
.chat-suggestions { padding: 10px 15px; gap: 10px; background: var(--bg); display: flex; overflow-x: auto; white-space: nowrap; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.chat-suggestions::-webkit-scrollbar { display: none; }
.chat-chip { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-sec); border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; font-weight: 500; box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer; transition: 0.2s; }
.chat-chip:hover { background: #e9eef6; color: #0b57d0; border-color: #d3e3fd; }
body.dark-mode .chat-chip:hover { background: #444746; color: #a8c7fa; border-color: #444746; }

/* AI Loading Animation */
.ai-loading-dots { display: flex; gap: 4px; padding: 6px 0; align-items: center; }
.ai-loading-dots span { width: 6px; height: 6px; background: var(--text-sec); border-radius: 50%; animation: dotBounce 1.4s infinite ease-in-out both; }
.ai-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dotBounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* Resize Handles Styles */
.resize-handle { position: absolute; background: transparent; z-index: 100; transition: background 0.2s; }
.resize-handle:hover { background: rgba(0,0,0,0.05); } /* Hiệu ứng khi di chuột vào mép */
.resize-left { left: 0; top: 0; bottom: 0; width: 12px; cursor: ew-resize; } /* Mép trái */
.resize-top { top: 0; left: 0; right: 0; height: 12px; cursor: ns-resize; } /* Mép trên */
.resize-corner { top: 0; left: 0; width: 20px; height: 20px; cursor: nwse-resize; z-index: 101; border-top-left-radius: 24px; } /* Góc trên trái */

.ai-msg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px 0; padding-left: 5px; animation: fadeIn 0.5s ease-out; }
.suggestion-chip { background: var(--card-bg); border: 1px solid var(--primary); color: var(--primary); padding: 5px 10px; border-radius: 15px; font-size: 0.75rem; cursor: pointer; transition: 0.2s; }
.suggestion-chip:hover { background: var(--primary); color: white; }

/* --- GALLERY & RANKING --- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.gallery-item { position: relative; border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: 0 4px 10px var(--shadow); background: var(--card-bg); border: 1px solid var(--border); transition: 0.3s; }
.gallery-item:hover { transform: translateY(-5px); box-shadow: 0 12px 30px var(--shadow); }
.gallery-img-container { width: 100%; aspect-ratio: 1/1; overflow: hidden; background: #f0f0f0; }
.gallery-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s, filter 0.3s, opacity 0.3s; opacity: 0; }
.gallery-img.loaded { opacity: 1; }
.gallery-img.lazy-blur { filter: blur(10px); }
.gallery-item:hover .gallery-img { transform: scale(1.1); }
.gallery-info { padding: 12px; background: var(--card-bg); }
.gallery-title { font-weight: bold; font-size: 0.95rem; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.gallery-meta { font-size: 0.8rem; color: var(--text-sec); display: flex; justify-content: space-between; align-items: center; }
.post-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); margin-right: 6px; vertical-align: middle; }
.grid-actions { display:flex; gap:10px; margin-top:5px; padding-top:5px; border-top:1px solid var(--border); font-size:0.8rem; color:var(--text-sec); }
.grid-act-btn { cursor:pointer; background:none; border:none; color:var(--text-sec); transition:0.2s; }
.grid-act-btn:hover { color:var(--primary); }
.owner-controls { position: absolute; top: 10px; right: 10px; display: flex; gap: 8px; z-index: 10; }
.ctrl-btn { background: rgba(255,255,255,0.9); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.9rem; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

.featured-section { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); border: 2px solid var(--primary); border-radius: 20px; padding: 25px; margin-bottom: 30px; display: flex; gap: 25px; align-items: center; position: relative; overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; }
.featured-section:hover { transform: translateY(-5px); }
.featured-badge { position: absolute; top: 0; left: 0; background: var(--accent); color: #333; padding: 5px 20px; font-weight: 800; border-bottom-right-radius: 15px; box-shadow: 2px 2px 5px rgba(0,0,0,0.1); }
.featured-img { width: 160px; height: 160px; object-fit: cover; border-radius: 15px; border: 4px solid white; box-shadow: 0 10px 25px rgba(0,0,0,0.15); }
.featured-content h3 { font-size: 1.5rem; margin: 0 0 10px 0; color: var(--primary-dark); }

/* --- ANIMATIONS FOR FEATURED POSTS --- */
/* 1. Hiệu ứng Radar Pulse cho Bài Ghim (Gây chú ý mạnh) */
@keyframes pinPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 160, 0, 0.7); transform: scale(1); }
    70% { box-shadow: 0 0 0 12px rgba(255, 160, 0, 0); transform: scale(1.01); }
    100% { box-shadow: 0 0 0 0 rgba(255, 160, 0, 0); transform: scale(1); }
}
#pinned-post { animation: pinPulse 2s infinite; }

/* 2. Hiệu ứng Breathing Glow cho Top 1 (Nhẹ nhàng, vinh danh) */
@keyframes topGlow {
    0% { box-shadow: 0 5px 15px rgba(46, 125, 50, 0.2); border-color: var(--primary); }
    50% { box-shadow: 0 10px 30px rgba(46, 125, 50, 0.6); border-color: #66bb6a; }
    100% { box-shadow: 0 5px 15px rgba(46, 125, 50, 0.2); border-color: var(--primary); }
}
#featured-post { animation: topGlow 3s infinite alternate ease-in-out; }

.ranking-wrapper { display: flex; gap: 25px; flex-wrap: wrap; margin-top: 30px; }
.ranking-card { flex: 1; min-width: 320px; background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 5px 15px var(--shadow); }
.ranking-header { background: var(--primary); color: white; padding: 12px; text-align: center; font-weight: bold; font-size: 1.1rem; }
.ranking-header.class-rank { background: var(--info); }
.rank-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.rank-table td { padding: 12px 15px; border-bottom: 1px solid var(--border); color: var(--text); }
.rank-top-1 { background: rgba(255, 253, 231, 0.3); font-weight: bold; color: #f9a825; }
.rank-num { display: inline-flex; width: 26px; height: 26px; background: var(--input-bg); border-radius: 50%; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: bold; color: var(--text-sec); margin-right: 8px; }
.rank-top-1 .rank-num { background: #fbc02d; color: white; }

.archive-controls { display: flex; gap: 10px; margin-bottom: 20px; background: var(--input-bg); padding: 15px; border-radius: 10px; overflow-x: auto; }
.archive-tab { cursor: pointer; padding: 10px 20px; background: var(--border); border-radius: 20px; font-weight: bold; font-size: 0.9rem; white-space: nowrap; color: var(--text-sec); transition: 0.2s; }
.archive-tab.active { background: var(--archive-color); color: white; box-shadow: 0 4px 10px var(--shadow); }

/* --- LIGHTBOX & COMMENTS --- */
.modal { display: none; position: fixed; z-index: 9999; top:0; left:0; width:100%; height:100%; background: #000; overflow: hidden; }
.lb-container { width: 100%; height: 100%; display: flex; flex-direction: column; background: #000; position: relative; }
.lb-image-area { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #000; position: relative; cursor: grab; padding: 0; margin: 0; }
.lb-image-area img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.2s ease-out; transform-origin: center; }
.lb-image-area img.zoomed { cursor: grab; transform: scale(2.5); }
.lb-overlay-top { position: absolute; top: 0; left: 0; width: 100%; padding: 15px; background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent); display: flex; justify-content: flex-end; align-items: center; z-index: 100; pointer-events: none; }
.lb-overlay-top * { pointer-events: auto; }
.lb-close-btn { background: rgba(255,255,255,0.2); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.lb-toggle-details-btn { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.6); color: white; border: 1px solid rgba(255,255,255,0.3); padding: 10px 20px; border-radius: 30px; font-weight: bold; font-size: 0.9rem; backdrop-filter: blur(5px); cursor: pointer; z-index: 50; display: flex; align-items: center; gap: 8px; transition: opacity 0.3s; }
.lb-details { position: absolute; bottom: 0; left: 0; width: 100%; background: var(--card-bg); border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 20px; display: flex; flex-direction: column; height: 60vh; z-index: 60; box-shadow: 0 -5px 50px rgba(0,0,0,0.5); transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lb-details.open { transform: translateY(0); }
.lb-drag-handle { width: 40px; height: 5px; background: var(--border); border-radius: 5px; margin: -10px auto 15px auto; }
.lb-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-shrink: 0; }
.lb-avatar { width: 45px; height: 45px; border-radius: 50%; border: 2px solid var(--primary); object-fit: cover; }
.lb-meta { flex: 1; }
.lb-meta h4 { margin: 0; font-size: 1rem; color: var(--text); }
.lb-meta span { font-size: 0.85rem; color: var(--text-sec); display:block; }
.lb-controls { display:flex; gap:10px; margin-left:auto; }
.lb-btn-icon { background:none; border:none; font-size:1.2rem; cursor:pointer; color:var(--text-sec); width:35px; height:35px; display:flex; align-items:center; justify-content:center; border-radius:50%; transition:0.2s; }
.lb-btn-icon:hover { background:var(--input-bg); }
.lb-btn-pin { color:#ffa000; }
.lb-btn-edit { color:#1976d2; }
.lb-btn-delete { color:#d32f2f; }
.lb-desc { font-size: 1rem; line-height: 1.6; margin-bottom: 15px; max-height: 35vh; overflow-y: auto; color: var(--text); flex-shrink: 0; padding-right: 8px; word-wrap: break-word; }
.lb-desc::-webkit-scrollbar { width: 4px; } .lb-desc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.lb-stats { display: flex; gap: 20px; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; flex-shrink: 0; }
.lb-stat-item { color: var(--text-sec); font-size: 1rem; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.lb-stat-item.active { color: #e53935; }
.lb-comments-list { flex: 1; overflow-y: auto; margin-bottom: 15px; padding-right: 5px; }
.lb-comments-list::-webkit-scrollbar { width: 4px; } .lb-comments-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.lb-comment-item { margin-bottom: 10px; display: flex; align-items: flex-start; gap: 10px; }
.lb-comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--border); }
.lb-comment-bubble { background: var(--input-bg); padding: 8px 12px; border-radius: 15px; display: inline-block; border: 1px solid var(--border); font-size: 0.9rem; line-height: 1.4; }
.quick-replies-container { display: none !important; } /* Đã ẩn phần gợi ý bình luận nhanh */
.quick-chip { background: rgba(46, 125, 50, 0.1); color: var(--primary); border: 1px solid var(--primary); padding: 10px 18px; border-radius: 25px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.quick-chip:active { background: var(--primary); color: white; transform: scale(0.95); }

/* --- ADMIN & MOBILE --- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 10px; }
.admin-table th { text-align: left; padding: 12px; background: var(--input-bg); color: var(--text-sec); }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.switch { position: relative; display: inline-block; width: 46px; height: 24px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

#home-login-area { margin-top: 20px; text-align: center; }
.home-login-btn { background: white; color: var(--primary); border: 2px solid var(--primary); padding: 12px 35px; border-radius: 50px; font-weight: 800; cursor: pointer; transition: 0.3s; box-shadow: 0 5px 15px rgba(0,0,0,0.1); font-size: 1.1rem; z-index: 100; position: relative; }
.home-login-btn:hover { background: var(--primary); color: white; transform: translateY(-3px); }

.key-item { display: flex; justify-content: space-between; align-items: center; background: var(--input-bg); padding: 8px 12px; border-radius: 8px; margin-bottom: 5px; border: 1px solid var(--border); }
.key-name { font-weight: bold; font-size: 0.9rem; }
.key-val { font-size: 0.8rem; color: var(--text-sec); margin-left: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- SETTINGS PAGE STYLES (NEW) --- */
.settings-group { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); background: var(--card-bg); transition: 0.2s; }
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--input-bg); }
.settings-label { display: flex; align-items: center; gap: 15px; font-size: 1rem; color: var(--text); font-weight: 600; }
.settings-icon-box { width: 35px; height: 35px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.1rem; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider-round { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider-round:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider-round { background-color: var(--primary); }
input:checked + .slider-round:before { transform: translateX(24px); }

/* --- SETTINGS BUTTONS --- */
.settings-btn { transition: transform 0.1s; }
.settings-btn:active { transform: scale(0.9); opacity: 0.8; }

/* --- CONFESSIONS STYLE (NEW) --- */
.confession-container { max-height: 400px; overflow-y: auto; margin-top: 15px; border-top: 1px solid var(--border); padding-top: 15px; }
.confess-item { background: var(--input-bg); border-radius: 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); position: relative; }
.confess-content { font-size: 0.95rem; color: var(--text); margin-bottom: 5px; font-style: italic; }
.confess-meta { font-size: 0.75rem; color: var(--text-sec); display: flex; justify-content: space-between; align-items: center; }
.confess-delete { color: var(--danger); cursor: pointer; font-weight: bold; font-size: 0.7rem; }

@media (min-width: 769px) {
    .lb-container { flex-direction: row; max-width: 1100px; height: 90vh; border-radius: 12px; margin: 5vh auto; background: black; box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
    .lb-image-area { flex: 2; height: 100%; border-right: 1px solid #333; border-radius: 12px 0 0 12px; }
    .lb-details { position: static; flex: 1; height: 100%; max-height: 100%; border-radius: 0 12px 12px 0; transform: none; box-shadow: none; max-width: 400px; min-width: 320px; }
    .lb-overlay-top { display: none; } 
    .lb-close-btn { position: absolute; top: 15px; right: 15px; z-index: 100; background: rgba(0,0,0,0.6); }
    .lb-toggle-details-btn { display: none; } 
    .lb-drag-handle { display: none; }
}

@media (max-width: 1024px) {
    .container { margin: 0; border-radius: 0; padding: 15px 10px 110px 10px; box-shadow: none; width: 100%; border: none; }
    nav.pc-nav { display: none; }
    .mobile-menu-btn { display: flex; }
    
    /* Grid ảnh khít hơn để hiển thị nhiều hơn */
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .gallery-info { padding: 8px; }
    .gallery-title { font-size: 0.85rem; }
    
    /* Featured section gọn gàng hơn */
    .featured-section { flex-direction: column; text-align: center; padding: 15px; gap: 15px; }
    .featured-img { width: 100%; height: 180px; border-width: 3px; }
    
    /* Điều chỉnh nút nổi (FAB) tránh che nội dung */
    .ai-fab { bottom: 160px; right: 15px; width: 50px; height: 50px; }
    .fab-container { bottom: 90px; right: 15px; }
    .fab-items { right: 0; bottom: 60px; flex-direction: column-reverse; align-items: center; gap: 15px; transform: translateY(20px) scale(0.8); }
    .fab-container.open .fab-items { transform: translateY(0) scale(1); }
    
    /* Cửa sổ chat AI full màn hình hơn */
    .ai-chat-window { width: 94%; right: 3%; bottom: 80px; height: 60vh; border-radius: 15px 15px 0 0; transform: translateY(100%); transform-origin: center bottom; }
    .ai-chat-window.active { transform: translateY(0); }
    .ai-chat-window::after, .ai-chat-window::before { display: none; } /* Ẩn mũi tên trên mobile */
    
    /* Typography & Input mobile */
    h1 { font-size: 1.5rem; margin-bottom: 20px; }
    h2 { font-size: 1.2rem; }
    .card { padding: 15px; margin-bottom: 15px; border-radius: 12px; }
    input, select, textarea { font-size: 16px; } /* Chống zoom trên iOS */

    /* --- MOBILE BOTTOM SHEET MODAL --- */
    /* Biến Modal thường thành dạng trượt từ dưới lên */
    .modal { align-items: flex-end !important; justify-content: center; }
    .modal .card {
        width: 100% !important; max-width: 100% !important;
        border-bottom-left-radius: 0; border-bottom-right-radius: 0;
        border-top-left-radius: 20px; border-top-right-radius: 20px;
        margin: 0 !important;
        animation: slideUpBottom 0.3s cubic-bezier(0.1, 0.7, 0.1, 1);
        max-height: 85vh !important; /* Không che hết màn hình */
    }
    
    @keyframes slideUpBottom {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Thanh nắm để kéo xuống (Visual cue) */
    .modal .card::before {
        content: ''; display: block; width: 40px; height: 5px;
        background: var(--border); border-radius: 10px;
        margin: 0 auto 15px auto;
    }
}

/* --- GEMINI LIVE VISUALIZER --- */
#live-visualizer-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95); z-index: 100;
    display: none; flex-direction: column; align-items: center; justify-content: center;
    backdrop-filter: blur(10px); border-radius: 24px;
    animation: fadeIn 0.3s ease-out;
}
body.dark-mode #live-visualizer-container { background: rgba(30, 30, 30, 0.95); }
#live-canvas { width: 100%; height: 150px; margin-bottom: 20px; }
.live-status { color: var(--primary); font-weight: 800; font-size: 1.2rem; animation: pulse 1.5s infinite; }

/* --- GEMINI LIVE FULLSCREEN OVERLAY --- */
#gemini-live-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.98);
    z-index: 99999; /* Cao nhất */
    display: none; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.3s ease;
}
body.dark-mode #gemini-live-overlay { background: rgba(18, 18, 18, 0.98); }

.live-header { position: absolute; top: 40px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.live-logo { width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 4px 15px rgba(0,0,0,0.1); animation: float 3s infinite ease-in-out; }
.live-header span { font-weight: 700; font-size: 1.2rem; color: var(--text); }

#live-canvas {
    width: 100%; height: 300px; /* Sóng to hơn */
    max-width: 600px;
    filter: drop-shadow(0 0 10px rgba(66, 133, 244, 0.6)); /* Hiệu ứng phát sáng màu xanh */
}

#live-status {
    margin-top: 20px; font-size: 1.1rem; color: var(--text-sec); font-weight: 500;
    height: 24px; /* Giữ chỗ tránh nhảy layout */
}

#btn-live-interrupt {
    margin-top: 20px;
    padding: 10px 25px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: none; /* Ẩn mặc định */
    align-items: center; gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: 0.2s;
    z-index: 10;
}
#btn-live-interrupt:hover {
    background: #ffebee;
    color: #d32f2f;
    border-color: #d32f2f;
    transform: scale(1.05);
}

.btn-live-close {
    position: absolute; bottom: 50px;
    width: 70px; height: 70px; border-radius: 50%;
    background: #ff5252; color: white; border: none;
    font-size: 1.8rem; cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 82, 82, 0.4);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}
.btn-live-close:active { transform: scale(0.9); }

/* --- CSS VISUALIZER FOR HYBRID LIVE --- */
.live-visualizer-css {
    width: 100%;
    max-width: 300px;
    height: 300px; /* Giữ chiều cao tương tự canvas */
    display: none; /* Ẩn ban đầu */
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.live-visualizer-css.speaking {
    display: flex; /* Hiện khi đang nói */
}
.live-visualizer-css .bar {
    width: 15px;
    height: 10px;
    background: var(--primary);
    border-radius: 8px;
    animation: speaking-anim 1.2s infinite ease-in-out;
}

/* Hiệu ứng động cho các thanh */
@keyframes speaking-anim {
    0%, 100% { height: 10px; opacity: 0.5; }
    50% { height: 120px; opacity: 1; }
}

/* Tạo độ trễ khác nhau cho mỗi thanh để tạo hiệu ứng lượn sóng */
.live-visualizer-css .bar:nth-child(1) { animation-delay: 0s; }
.live-visualizer-css .bar:nth-child(2) { animation-delay: 0.2s; }
.live-visualizer-css .bar:nth-child(3) { animation-delay: 0.4s; }
.live-visualizer-css .bar:nth-child(4) { animation-delay: 0.1s; }
.live-visualizer-css .bar:nth-child(5) { animation-delay: 0.3s; }

/* --- FLIP CARD STYLES (TRASH GUIDE) --- */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
    height: 240px; /* Chiều cao cố định cho thẻ */
    margin-bottom: 0;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 10px var(--shadow);
    border-radius: 12px;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
}

.flip-card-front { z-index: 2; }
.flip-card-back { transform: rotateY(180deg); background: var(--input-bg); justify-content: space-between; }

.flip-card-icon { font-size: 2.5rem; margin-bottom: 10px; }
.bin-recycle { color: #1976d2; }
.bin-organic { color: #388e3c; }
.bin-other { color: #f57c00; }

/* --- SKELETON LOADING --- */
.skeleton {
    background: #eee;
    background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
    background-size: 200% 100%;
    animation: 1.5s shine linear infinite;
}
body.dark-mode .skeleton {
    background: linear-gradient(110deg, #333 8%, #444 18%, #333 33%);
}
@keyframes shine { to { background-position-x: -200%; } }

.skeleton-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1.3; /* Tỉ lệ gần giống card thật */
}
.skeleton-img { width: 100%; aspect-ratio: 1/1; }
.skeleton-info { padding: 12px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; width: 100%; }
.skeleton-text.short { width: 60%; }

/* --- SITE FOOTER --- */
.site-footer {
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    color: white;
    padding: 50px 0 0 0;
    margin-top: 50px;
    font-size: 0.95rem;
    position: relative;
    z-index: 10;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
}
body.dark-mode .site-footer {
    background: linear-gradient(135deg, #051a10, #1b5e20);
    border-top: 1px solid #333;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 20px;
    gap: 30px;
}

.footer-section { flex: 1; min-width: 250px; margin-bottom: 20px; }
.footer-section.about { flex: 1.5; } /* Cột giới thiệu rộng hơn chút */

.footer-logo {
    width: 50px; height: 50px;
    background: white; border-radius: 50%;
    padding: 5px; object-fit: contain;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.footer-section h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 1.2rem;
    border-left: 4px solid var(--accent);
    padding-left: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.contact-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: rgba(255,255,255,0.9); }
.contact-row i { width: 20px; color: var(--accent); text-align: center; }

.footer-section ul { list-style: none; padding: 0; margin: 0; }
.footer-section ul li { margin-bottom: 10px; }
.footer-section ul li a {
    color: rgba(255,255,255,0.8); text-decoration: none;
    transition: 0.3s; display: inline-block;
}
.footer-section ul li a:hover { color: var(--accent); transform: translateX(5px); }

.social-icons { display: flex; gap: 10px; margin-top: 15px; }
.social-icons a {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    color: white;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    text-decoration: none;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
}
.social-icons a:hover { background: var(--accent); color: #333; transform: translateY(-3px); }

.footer-bottom {
    background: rgba(0,0,0,0.2);
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
    .footer-content { flex-direction: column; gap: 40px; }
    .site-footer { padding-bottom: 80px; /* Chừa chỗ cho menu mobile nếu cần */ }
}
