@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700;800;900&display=swap');

:root {
    --bg-main: #0B0F19; --bg-sidebar: #111827; --bg-card: #1E293B;
    --primary: #3B82F6; --text-main: #F8FAFC; --text-muted: #94A3B8;
    --border: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Plus Jakarta Sans', sans-serif; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg-main); width: 100%; height: 100%; }
body { background: var(--bg-main); color: var(--text-main); display: flex; width: 100%; height: 100%; overflow: hidden; zoom: 0.9; }

/* ================= OVERLAY & NÚT ĐÓNG ================= */
.overlay { position: fixed; top: 0; left: 0; width: 115vw; height: 115vh; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); z-index: 100; opacity: 0; visibility: hidden; transition: 0.3s; }
.overlay.active { opacity: 1; visibility: visible; }

.btn-close-menu { 
    position: fixed; top: 16px; left: 270px; background: var(--bg-card); 
    border: 1px solid rgba(255,255,255,0.2); border-radius: 20px; padding: 8px 16px; 
    display: flex; justify-content: center; align-items: center; gap: 8px; 
    color: var(--text-main); font-size: 14px; font-weight: 600; z-index: 100000; 
    cursor: pointer; transition: 0.3s; opacity: 0; visibility: hidden; transform: translateX(-20px); outline: none; 
}
.btn-close-menu.active { opacity: 1; visibility: visible; transform: translateX(0); }

/* ================= SIDEBAR ================= */
.sidebar { width: 260px; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: 0.3s; z-index: 101; height: 100%; flex-shrink: 0; }
.sidebar-header { padding: 24px; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; border-bottom: 1px solid var(--border); }
.nav-menu { display: flex; flex-direction: column; padding: 20px 15px; gap: 8px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; color: var(--text-muted); text-decoration: none; font-weight: 600; border-radius: 12px; transition: 0.3s; }
.nav-item:hover, .nav-item.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.nav-item.active { border-left: 4px solid var(--primary); }

/* ================= HEADER TRÀN VIỀN ================= */
.main-content { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; position: relative; }
.top-header { background: var(--bg-sidebar); height: 60px; width: 100%; display: flex; align-items: center; z-index: 90; flex-shrink: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.4); }
.btn-mobile-menu { width: 60px; height: 100%; background: transparent; border: none; border-right: 1.5px solid rgba(255,255,255,0.25); display: flex; justify-content: center; align-items: center; cursor: pointer; outline: none; flex-shrink: 0; }
.header-status-bar { flex: 1; height: 100%; display: flex; flex-direction: column; background: transparent; }
.status-top { flex: 1; display: flex; width: 100%; align-items: center; }
.status-top-item { flex: 1; display: flex; justify-content: center; align-items: center; font-size: 16px; font-weight: 800; white-space: nowrap; text-shadow: 0px 1px 3px rgba(0,0,0,0.8); }
.status-top-item:not(:last-child) { border-right: 1.5px dashed rgba(255,255,255,0.25); }
.text-yellow { color: #FFD700; } .text-green  { color: #4ADE80; }
.status-bottom { height: 20px; width: 100%; background: rgba(255, 255, 255, 0.05); position: relative; border-top: 1px solid rgba(255,255,255,0.15); }
.exp-fill { position: absolute; top: 0; left: 0; height: 100%; background: #F97316; transition: width 0.3s ease-in-out; }
.exp-text { position: absolute; inset: 0; display: flex; justify-content: center; align-items: center; font-size: 12px; font-weight: 900; color: #7DD3FC; z-index: 2; text-shadow: 0px 1px 2px rgba(0,0,0,0.9); letter-spacing: 0.5px; }
.avatar-square { width: 60px; height: 100%; border: none; border-left: 1.5px solid rgba(255,255,255,0.25); background: linear-gradient(135deg, var(--primary), #A855F7); display: flex; justify-content: center; align-items: center; font-size: 16px; font-weight: 700; color: white; flex-shrink: 0; }

/* ================= BONG BÓNG AVATAR & MENU ACCOUNT ================= */
.avatar-container { position: relative; height: 100%; display: flex; align-items: center; cursor: pointer; }

/* Tăng độ rộng lên 320px, bo góc to hơn, thêm viền và hiệu ứng đổ bóng xịn */
.avatar-dropdown { position: absolute; top: 70px; right: 10px; width: 320px; max-width: calc(100vw - 20px); background: var(--bg-card); border: 1px solid rgba(59, 130, 246, 0.4); border-radius: 16px; box-shadow: 0 15px 50px rgba(0,0,0,0.9), 0 0 20px rgba(59, 130, 246, 0.1); padding: 0; overflow: hidden; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-15px); transition: 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55); }
.avatar-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }

/* KHU VỰC 1: Header (Avatar Mini + Username) */
.dropdown-header { background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(0,0,0,0)); padding: 20px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.dropdown-avatar { width: 45px; height: 45px; background: linear-gradient(135deg, #3B82F6, #A855F7); border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 20px; font-weight: 900; color: #fff; flex-shrink: 0; box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
.dropdown-header-info { display: flex; flex-direction: column; overflow: hidden; }
.dropdown-header-title { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.dropdown-header-name { font-size: 16px; font-weight: 900; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* KHU VỰC 2: Body (Đóng khung Email & SĐT) */
.dropdown-body { padding: 15px 20px; display: flex; flex-direction: column; gap: 12px; }
.dropdown-info-item { display: flex; flex-direction: column; gap: 4px; background: rgba(0,0,0,0.2); padding: 12px; border-radius: 10px; border: 1px dashed rgba(255,255,255,0.05); }
.info-label { font-size: 12px; color: var(--text-muted); font-weight: 700; display: flex; align-items: center; gap: 6px; text-transform: uppercase; }
.info-value { font-size: 14px; font-weight: 800; word-break: break-all; line-height: 1.4; color: #fff; }
.info-value.email { color: #3B82F6; }
.info-value.phone { color: #00FFFF; font-family: monospace; font-size: 15px; }

/* KHU VỰC 3: Footer (Nút Đăng Xuất) */
.dropdown-footer { border-top: 1px solid rgba(255,255,255,0.05); }
.dropdown-item { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px; color: #EF4444; font-weight: 900; font-size: 15px; transition: 0.3s; cursor: pointer; background: rgba(239, 68, 68, 0.05); text-transform: uppercase; letter-spacing: 1px; }
.dropdown-item:hover { background: rgba(239, 68, 68, 0.15); }

/* ================= Nội dung Dashboard ================= */
.dashboard-container { flex: 1; overflow-y: auto; padding: 24px; width: 100%; }
.dashboard-inner { max-width: 1200px; margin: 0 auto; width: 100%; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-box { background: var(--bg-card); padding: 20px; border-radius: 16px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.stat-box-title { color: var(--text-muted); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-box-value { font-size: 24px; font-weight: 800; color: var(--text-main); }
.stat-box-value.highlight { color: #10B981; }
.chart-card { background: var(--bg-card); padding: 24px; border-radius: 16px; border: 1px solid var(--border); margin-bottom: 24px; }
.chart-header { margin-bottom: 20px; font-size: 16px; font-weight: 800; line-height: 1.4; display: flex; align-items: center; gap: 10px; }
.chart-header span.sub { font-size: 13px; color: var(--text-muted); font-weight: 400; display: block; margin-top: 4px; }
.styled-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.styled-table th, .styled-table td { padding: 14px 15px; text-align: center; border-bottom: 1px solid var(--border); }
.styled-table th { color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.styled-table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ================= ICONS CSS THUẦN ================= */
.icon-menu { width: 22px; height: 2px; background: #fff; position: relative; }
.icon-menu::before, .icon-menu::after { content: ''; position: absolute; width: 22px; height: 2px; background: #fff; left: 0; }
.icon-menu::before { top: -7px; } .icon-menu::after { top: 7px; }
.icon-arrow-left { width: 10px; height: 10px; border-top: 2px solid currentColor; border-left: 2px solid currentColor; transform: rotate(-45deg); margin-left: 4px; }
.icon-home { width: 16px; height: 12px; border: 2px solid currentColor; border-top: none; position: relative; margin-top: 4px; }
.icon-home::before { content: ''; position: absolute; top: -11px; left: -4px; width: 14px; height: 14px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(-45deg); }
.icon-mission { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.icon-mission::after { content: ''; position: absolute; top: 4px; left: 4px; width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
.icon-wallet { width: 18px; height: 14px; border: 2px solid currentColor; border-radius: 3px; position: relative; }
.icon-wallet::after { content: ''; position: absolute; top: 3px; right: -2px; width: 4px; height: 4px; background: var(--bg-sidebar); border: 2px solid currentColor; border-right: none; }
.icon-user { width: 16px; height: 16px; position: relative; }
.icon-user::before { content: ''; position: absolute; top: 0; left: 3px; width: 6px; height: 6px; border: 2px solid currentColor; border-radius: 50%; }
.icon-user::after { content: ''; position: absolute; bottom: 0; left: -2px; width: 16px; height: 6px; border: 2px solid currentColor; border-bottom: none; border-radius: 8px 8px 0 0; }
.icon-logout { width: 14px; height: 14px; border: 2px solid currentColor; border-right: none; position: relative; border-radius: 3px 0 0 3px; }
.icon-logout::after { content: ''; position: absolute; right: -6px; top: 4px; width: 8px; height: 2px; background: currentColor; }
.icon-logout::before { content: ''; position: absolute; right: -8px; top: 1px; width: 6px; height: 6px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: rotate(45deg); }
.icon-share { width: 14px; height: 14px; position: relative; margin-right: 2px; }
.icon-share::before { content: ''; position: absolute; top: 0; right: 0; width: 6px; height: 6px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; }
.icon-share::after { content: ''; position: absolute; top: -1px; right: 2px; width: 12px; height: 2px; background: currentColor; transform: rotate(-45deg); transform-origin: top right; }

/* Responsive căn chỉnh vị trí Nút Đóng cho Điện thoại */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -250px; width: 250px; }
    .sidebar.active { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.5); }
    .btn-mobile-menu { display: flex; }
    .btn-close-menu { left: 260px; right: auto; padding: 8px 12px; font-size: 13px; }
}
@media (max-width: 380px) {
    .sidebar { position: fixed; left: -240px; width: 240px; }
    .btn-close-menu { left: 250px; padding: 6px 10px; font-size: 12px; }
}
@media (min-width: 769px) { 
    .overlay, .btn-close-menu { display: none !important; } 
    .btn-mobile-menu { display: none !important; }
}

/* ================= MÀN HÌNH LOADING CHE GIẬT LAG ================= */
#loading-overlay {
    top: 0 !important; left: 0 !important; width: calc(100vw * 1.1112) !important; height: calc(100vh * 1.1112) !important;
    background-color: var(--bg-main) !important; display: flex !important; justify-content: center !important;
    align-items: center !important; z-index: 999999 !important;
    position: fixed; opacity: 1; visibility: visible; transition: opacity 0.3s ease, visibility 0.3s ease;
}
#loading-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader { position: relative; width: 50px; height: 50px; }
@keyframes loader_5191 { from { opacity: 0; } to { opacity: 1; } }
.square { background: var(--primary); width: 10px; height: 10px; position: absolute; top: 50%; left: 50%; margin-top: -5px; margin-left: -5px; border-radius: 2px;}
#sq1 { margin-top: -25px; margin-left: -25px; animation: loader_5191 675ms ease-in-out 0s infinite alternate; }
#sq2 { margin-top: -25px; animation: loader_5191 675ms ease-in-out 75ms infinite alternate; }
#sq3 { margin-top: -25px; margin-left: 15px; animation: loader_5191 675ms ease-in-out 150ms infinite; }
#sq4 { margin-left: -25px; animation: loader_5191 675ms ease-in-out 225ms infinite; }
#sq5 { animation: loader_5191 675ms ease-in-out 300ms infinite; }
#sq6 { margin-left: 15px; animation: loader_5191 675ms ease-in-out 375ms infinite; }
#sq7 { margin-top: 15px; margin-left: -25px; animation: loader_5191 675ms ease-in-out 450ms infinite; }
#sq8 { margin-top: 15px; animation: loader_5191 675ms ease-in-out 525ms infinite; }
#sq9 { margin-top: 15px; margin-left: 15px; animation: loader_5191 675ms ease-in-out 600ms infinite; }

/* ================= ICONS HÌNH ẢNH & MENU CON ================= */
.nav-img-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.has-submenu { display: flex; flex-direction: column; padding: 0 !important; }
.submenu-header { display: flex; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer; border-radius: 12px; transition: 0.3s; color: var(--text-muted); font-weight: 600; }
.submenu-header:hover { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.submenu-arrow { margin-left: auto; transition: 0.3s; }
.has-submenu.open .submenu-arrow { transform: rotate(180deg); }
.has-submenu.open .submenu-header { color: var(--primary); background: rgba(59, 130, 246, 0.05); }

.submenu-items { 
    display: flex !important; max-height: 0; opacity: 0; overflow: hidden; 
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, margin 0.4s ease-in-out;
    margin-top: 0 !important; margin-bottom: 0 !important; 
    flex-direction: column; padding-left: 10px; border-left: 2px solid rgba(255,255,255,0.05); margin-left: 26px; gap: 4px;
}
.has-submenu.open .submenu-items { max-height: 200px; opacity: 1; margin-top: 4px !important; margin-bottom: 8px !important; }

.sub-nav-item { padding: 10px 15px; color: var(--text-muted); text-decoration: none; font-size: 13.5px; font-weight: 600; border-radius: 8px; transition: 0.3s; display: flex; align-items: center; gap: 8px; }
.sub-nav-item:hover, .sub-nav-item.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.sub-nav-icon { width: 16px; height: 16px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }
.btn-mobile-menu svg { width: 28px !important; height: 28px !important; }
/* HIỆU ỨNG LOGO MỚI TOẢ SÁNG */
.magic-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 20px 40px 15px 30px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5), 
                0 0 30px rgba(59, 130, 246, 0.3), 
                inset 0 0 10px rgba(0, 255, 255, 0.2);
    animation: morphing-glow 4s ease-in-out infinite alternate;
}

@keyframes morphing-glow {
    0% {
        border-radius: 20px 40px 15px 30px;
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.4), 0 0 20px rgba(59, 130, 246, 0.2);
    }
    100% {
        border-radius: 40px 15px 30px 20px;
        box-shadow: 0 0 25px rgba(0, 255, 255, 0.8), 0 0 40px rgba(59, 130, 246, 0.6);
    }
}
