/**
 * Path: /home/lebaopag/metric.lbmedia.vn/css/style.css
 * File: style.css
 * Version: 2.2.0 (Audit: Sửa lỗi khoảng hở rớt Hover Sub-menu & Tương thích 100% v4.2.3)
 */

:root {
    --primary: #2563eb;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.6; }

/* --- 1. COMPONENTS (THÀNH PHẦN CƠ BẢN) --- */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.container.full-width { max-width: 100%; padding: 0 20px; } 

.card { background: var(--card-bg); padding: 20px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border: 1px solid var(--border); }
.btn { padding: 8px 16px; background: var(--primary); color: white; border: none; border-radius: 5px; cursor: pointer; text-decoration: none; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; transition: opacity 0.2s; font-weight: bold; }
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* --- 2. NAVIGATION (ĐIỀU HƯỚNG & HEADER - AUDIT FIX HOVER CHẾT) --- */
.topbar { background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar .logo { font-size: 16px; font-weight: bold; color: var(--primary); text-decoration: none; }
.nav-menu { display: flex; align-items: center; gap: 10px; }
.nav-menu a { margin-left: 15px; color: var(--text-main); text-decoration: none; font-size: 12px; transition: color 0.2s; }
.nav-menu a:hover { color: var(--primary); }
.nav-menu .logout { color: #dc2626; font-weight: bold; margin-left: 5px; }

/* Dropdown Menu Nhanh - Audit Fix: Tạo ranh giới khít 100% để chuột không bị rớt */
.dropdown-quickmenu { display: inline-block; position: relative; }
.dropdown-quickmenu .dropdown-content { 
    display: none; 
    position: absolute; 
    right: 0; 
    background: transparent; /* Đổi nền gốc sang suốt để làm cầu nối */
    min-width: 200px; 
    z-index: 999; 
    top: 100%; /* Ép sát khít mép dưới của thanh header 100% */
    margin-top: 0px; /* Triệt tiêu khoảng hở chết gây ẩn menu */
    padding-top: 8px; /* Dùng khoảng đệm trong suốt này làm cầu nối giữ chuột liên tục */
    text-align: left; 
}
/* Phần hộp chứa nội dung thực tế (bọc bên trong để đổ bóng mượt mà) */
.dropdown-quickmenu .dropdown-content a { 
    background: #ffffff;
    display: block; 
    padding: 10px 15px; 
    color: #1e293b; 
    text-decoration: none; 
    font-size: 11px; 
    border-bottom: 1px solid #f1f5f9; 
    margin: 0; 
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}
.dropdown-quickmenu .dropdown-content a:first-child { 
    border-top: 1px solid #e2e8f0;
    border-top-left-radius: 6px; 
    border-top-right-radius: 6px; 
}
.dropdown-quickmenu .dropdown-content a:last-child { 
    border-bottom: 1px solid #e2e8f0;
    border-bottom-left-radius: 6px; 
    border-bottom-right-radius: 6px; 
}
.dropdown-quickmenu:hover .dropdown-content { 
    display: block; 
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.1)); /* Đổ bóng toàn bộ menu con */
}
.dropdown-quickmenu .dropdown-content a:hover { background: #f8fafc; color: var(--primary); }

/* --- 3. LAYOUTS & GRIDS (CẤU TRÚC TRANG) --- */
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-sidebar { display: grid; grid-template-columns: 260px 1fr; gap: 25px; align-items: start; }
.sidebar-sticky { position: sticky; top: 20px; padding: 15px; height: calc(100vh - 100px); overflow-y: auto; }
.section-title { font-size: 15px; margin-bottom: 15px; }

@media (max-width: 768px) { 
    .grid-main, .grid-sidebar { grid-template-columns: 1fr; } 
    .sidebar-sticky { position: relative; height: auto !important; top: 0; }
}

/* --- 4. EVENT BADGES (NHÃN MÀU SỰ KIỆN - GIAO DIỆN MỚI TINTED) --- */
.badge { 
    display: inline-block; 
    padding: 3px 8px; 
    border-radius: 4px; 
    font-size: 9px; 
    text-transform: uppercase; 
    border: 1px solid transparent;
}
.bg-default { color: #64748b; border-color: #64748b; background-color: rgba(100, 116, 139, 0.1); }
.bg-phone { color: #22c55e; border-color: #22c55e; background-color: rgba(34, 197, 94, 0.1); }
.bg-zalo { color: #3b82f6; border-color: #3b82f6; background-color: rgba(59, 130, 246, 0.1); }
.bg-messenger, .bg-facebook { color: #0ea5e9; border-color: #0ea5e9; background-color: rgba(14, 165, 233, 0.1); }
.bg-form-attempt { color: #f59e0b; border-color: #f59e0b; background-color: rgba(245, 158, 11, 0.1); }
.bg-form-success { color: #10b981; border-color: #10b981; background-color: rgba(16, 185, 129, 0.1); }
.bg-menu { color: #8b5cf6; border-color: #8b5cf6; background-color: rgba(139, 92, 246, 0.1); }

/* --- 5. TOGGLE SWITCH --- */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; font-size: 11px; color: #475569; font-weight: 500; }
.toggle-switch input { display: none; }
.toggle-switch .slider { position: relative; width: 34px; height: 18px; background-color: #cbd5e1; border-radius: 20px; margin-right: 8px; transition: .3s; }
.toggle-switch .slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: white; border-radius: 50%; transition: .3s; box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.toggle-switch input:checked + .slider { background-color: #10b981; }
.toggle-switch input:checked + .slider:before { transform: translateX(16px); }

/* --- 6. MODALS --- */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.modal-content { background: #fff; padding: 25px; border-radius: 10px; width: 100%; max-width: 420px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); }
.modal-content.large { max-width: 650px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.modal-header h3 { margin: 0; font-size: 18px; color: #0f172a; }
.modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #94a3b8; transition: 0.2s; }
.modal-close:hover { color: #ef4444; }

/* --- 7. FORMS & TABLES --- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 13px; font-weight: bold; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; box-sizing: border-box; font-size: 11px; }
.form-group input:focus { outline: none; border-color: var(--primary); }

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; }
th { padding: 14px 15px; background: #f1f5f9; border-bottom: 2px solid var(--border); color: #334155; font-weight: bold; }
td { padding: 12px 15px; border-bottom: 1px solid var(--border); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background-color: #f8fafc; }

/* --- 8. SECURITY EXTENSIONS (BẢN V4.2) --- */
.row-click-ao { background-color: #fef2f2 !important; border-left: 5px solid #ef4444 !important; }
.badge-danger-blink { background-color: #ef4444; color: white; padding: 2px 6px; border-radius: 4px; font-weight: bold; animation: blinker 1.5s linear infinite; }
@keyframes blinker { 50% { opacity: 0.3; } }
.text-behavior { font-size: 11px; margin-top: 4px; display: inline-block; padding: 2px 6px; border-radius: 3px; font-weight: bold; }
.bg-scroll { background-color: #e0f2fe; color: #0369a1; }
.bg-time { background-color: #fef3c7; color: #92400e; }
.bg-click-ao { color: #ef4444; border-color: #ef4444; background-color: rgba(239, 68, 68, 0.15); }

/* --- 9. UTILITY CLASSES --- */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-start { display: flex; align-items: flex-start; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-5 { gap: 5px; }
.gap-10 { gap: 10px; }
.gap-15 { gap: 15px; }
.gap-20 { gap: 20px; }
.grid-stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: bold; }
.font-black { font-weight: 900; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-2xl { font-size: 16px; }
.text-mono { font-family: monospace; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-4 { margin-top: 20px; }
.p-0 { padding: 0 !important; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }
.pb-2 { padding-bottom: 10px; }
.border-b { border-bottom: 1px solid var(--border); }
.rounded-md { border-radius: 6px; }
.badge-code { color: #db2777; background: #fce7f3; padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.link-primary { color: #0284c7; text-decoration: none; }
.link-primary:hover { text-decoration: underline; }
.chart-container { height: 120px; position: relative; margin-top: 10px; }
.table-wrapper { overflow-x: auto; }
.stat-card-inner { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 10px; text-align: center; }
/* --- 10. LOGIN PAGE (RESPONSIVE) --- */
.login-wrapper { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    background-color: var(--bg-color); 
    padding: 20px; 
}
.login-box { 
    background: var(--card-bg); 
    padding: 30px; 
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); 
    width: 100%; 
    max-width: 400px; /* Khống chế chiều rộng trên Desktop, tự co giãn trên Mobile */
    border: 1px solid var(--border); 
}
.login-box h2 { 
    text-align: center; 
    margin-bottom: 25px; 
    color: var(--primary); 
    font-size: 22px;
}
.error-msg {
    background: #fee2e2; 
    color: #b91c1c; 
    padding: 10px; 
    border-radius: 6px; 
    margin-bottom: 15px; 
    font-size: 13px; 
    border: 1px solid #fca5a5;
    text-align: center;
}