:root {
    --bg-light: #f8fafc; 
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --primary-color: #2563eb; 
    --primary-hover: #1d4ed8;
    --gradient-text: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --text-main: #0f172a; 
    --text-muted: #64748b; 
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 50px -10px rgba(0, 0, 0, 0.1);
    --shadow-selected: 0 0 0 2px var(--primary-color), 0 15px 40px -5px rgba(37, 99, 235, 0.15);
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --transition-bounce: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-main); -webkit-font-smoothing: antialiased; }
body { background-color: var(--bg-light); color: var(--text-main); line-height: 1.6; min-height: 100vh; overflow-x: hidden; position: relative; }

/* Ambient Background */
.ambient-bg-light { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; background: #f8fafc; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(140px); opacity: 0.5; animation: float 20s infinite ease-in-out alternate; will-change: transform; }
.light-orb-1 { width: 55vw; height: 55vw; background: #e0f2fe; top: -15%; left: -10%; } 
.light-orb-2 { width: 45vw; height: 45vw; background: #f3e8ff; bottom: -10%; right: -10%; animation-delay: -5s; } 
.light-orb-3 { width: 35vw; height: 35vw; background: #ffedd5; top: 25%; left: 35%; animation-delay: -10s; opacity: 0.6; } 
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(3%, 3%) scale(1.02); } }

/* Navigation */
.container { max-width: 1250px; margin: 0 auto; padding: 0 24px 100px; }
.top-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; background: rgba(248, 250, 252, 0.85); position: sticky; top: 0; z-index: 100; backdrop-filter: blur(16px); border-bottom: 1px solid rgba(255,255,255,0.9); box-shadow: 0 4px 30px rgba(0,0,0,0.02); }
.brand-identity { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.1rem; letter-spacing: 1.5px; color: var(--text-main); }
.logo-icon { display: flex; color: var(--primary-color); }

.online-badge { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,0.85); border: 1px solid rgba(5,150,105,0.15); border-radius: 100px; padding: 7px 16px; font-size: 0.82rem; font-weight: 700; color: #065f46; box-shadow: 0 2px 12px rgba(5,150,105,0.08); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; flex-shrink: 0; animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); } 50% { box-shadow: 0 0 0 5px rgba(16,185,129,0); } }

.admin-link { font-size: 0.82rem; font-weight: 700; color: #64748b; text-decoration: none; padding: 7px 14px; border-radius: 9px; background: rgba(255,255,255,0.7); border: 1px solid rgba(0,0,0,0.06); transition: all 0.2s; }
.admin-link:hover { background: #f1f5f9; color: #0f172a; }

.docs-menu { position: relative; }
.docs-btn {
    display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 700;
    color: #1d4ed8; background: linear-gradient(135deg, rgba(37,99,235,0.07), rgba(99,102,241,0.07));
    border: 1.5px solid rgba(37,99,235,0.2); padding: 8px 16px; border-radius: 10px;
    cursor: pointer; transition: all 0.22s; font-family: var(--font-main); white-space: nowrap;
    box-shadow: 0 1px 4px rgba(37,99,235,0.08);
}
.docs-btn:hover { background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(99,102,241,0.12)); border-color: rgba(37,99,235,0.35); box-shadow: 0 4px 14px rgba(37,99,235,0.15); }
.docs-btn.open { background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(99,102,241,0.14)); border-color: rgba(37,99,235,0.4); box-shadow: 0 4px 14px rgba(37,99,235,0.18); }
.docs-caret { transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1); flex-shrink: 0; }
.docs-btn.open .docs-caret { transform: rotate(180deg); }

.docs-dropdown {
    position: absolute; top: calc(100% + 12px); right: 0;
    background: #fff; border: 1px solid rgba(0,0,0,0.07); border-radius: 18px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.06), 0 24px 64px rgba(37,99,235,0.12);
    min-width: 340px; padding: 0; z-index: 200; opacity: 0; pointer-events: none;
    transform: translateY(-10px) scale(0.96); transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.docs-dropdown.show { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }

.docs-dropdown-header {
    display: flex; align-items: center; gap: 9px;
    padding: 16px 20px 12px;
    font-size: 0.68rem; font-weight: 800; color: #6b7280;
    text-transform: uppercase; letter-spacing: 1.5px;
    border-bottom: 1px solid #f3f4f6;
    background: linear-gradient(135deg, #f9fafb, #f0f4ff);
}
.docs-dropdown-header svg { color: #6366f1; flex-shrink: 0; }

.docs-link-item {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px;
    text-decoration: none; color: #111827; transition: background 0.15s; cursor: pointer;
    border-bottom: 1px solid #f9fafb;
}
.docs-link-item:last-child { border-bottom: none; }
.docs-link-item:hover { background: #f8faff; }
.docs-link-item:hover .docs-link-icon { transform: scale(1.08); }
.docs-link-item:hover .docs-link-arrow { opacity: 1; transform: translateX(2px); }

.docs-link-icon {
    width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; transition: transform 0.2s;
}
.docs-icon-blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1d4ed8; }
.docs-icon-red { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #dc2626; }

.docs-link-body { flex: 1; min-width: 0; }
.docs-link-title { font-size: 0.875rem; font-weight: 700; color: #111827; display: block; margin-bottom: 2px; }
.docs-link-desc { font-size: 0.75rem; font-weight: 500; color: #9ca3af; display: block; }
.docs-link-arrow { color: #d1d5db; flex-shrink: 0; opacity: 0.6; transition: all 0.2s; }

.lang-switch-modern { display: flex; background: rgba(255,255,255,0.8); border: 1px solid rgba(0,0,0,0.04); border-radius: 100px; padding: 4px; box-shadow: 0 2px 15px rgba(0,0,0,0.03); }
.lang-switch-modern button { background: transparent; color: var(--text-muted); border: none; padding: 8px 22px; border-radius: 100px; font-weight: 700; font-size: 0.85rem; cursor: pointer; transition: all 0.3s ease; }
.lang-switch-modern button.active { background: var(--primary-color); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }

/* Typography */
.hero-header { text-align: center; margin: 60px 0; }
.title-gradient { font-size: clamp(2rem, 4.5vw, 3.5rem); font-weight: 800; line-height: 1.25; background: var(--gradient-text); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 16px; }
.subtitle { color: var(--text-muted); font-size: clamp(1rem, 2vw, 1.15rem); font-weight: 500; }

.divider-modern { display: flex; align-items: center; text-align: center; margin: 50px 0 40px; color: var(--text-muted); font-size: 0.85rem; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }
.divider-modern::before, .divider-modern::after { content: ''; flex: 1; border-bottom: 1px solid rgba(0,0,0,0.05); }
.divider-modern span { padding: 0 24px; background: transparent; }

/* Exam Tiers & FLEX Layout */
.mt-lg { margin-top: 50px; }
.tier-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.primary-dot { background: var(--primary-color); box-shadow: 0 0 10px rgba(37, 99, 235, 0.4); }
.warning-dot { background: var(--accent-warning); box-shadow: 0 0 10px rgba(217, 119, 6, 0.4); }
.tier-header h3 { font-size: 1.15rem; font-weight: 700; color: var(--text-main); }

.flex-layout { display: flex; flex-wrap: nowrap; gap: 20px; overflow-x: auto; padding: 10px 10px 45px 10px; scroll-snap-type: x mandatory; scroll-behavior: smooth; margin: 0 -10px; }
.flex-layout::-webkit-scrollbar { height: 5px; }
.flex-layout::-webkit-scrollbar-track { background: rgba(0,0,0,0.02); border-radius: 10px; margin: 0 20px; }
.flex-layout::-webkit-scrollbar-thumb { background: rgba(37, 99, 235, 0.2); border-radius: 10px; }

/* Exam Cards */
.exam-card { flex: 0 0 auto; scroll-snap-align: start; background: var(--glass-bg); backdrop-filter: blur(24px); border: 1px solid var(--glass-border); border-radius: 20px; cursor: pointer; transition: var(--transition-bounce); box-shadow: var(--shadow-soft); display: flex; flex-direction: column; text-align: center; justify-content: center; align-items: center; gap: 16px; }
.exam-card.basic { width: 275px; padding: 32px 20px; }
.exam-card.advanced { width: 185px; padding: 32px 14px; }
.exam-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: rgba(255, 255, 255, 1); }
.exam-card.selected { transform: translateY(-4px) scale(1.01); background: #ffffff; box-shadow: var(--shadow-selected); }
.exam-card.disabled { opacity: 0.35; pointer-events: none; filter: grayscale(100%); transform: scale(0.98); box-shadow: none; }

.icon-box { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: 0 6px 16px rgba(0,0,0,0.04); color: var(--text-muted); }
.icon-box.cyan { color: #0ea5e9; background: #f0f9ff; }
.icon-box.green { color: #10b981; background: #ecfdf5; }
.icon-box.red { color: #ef4444; background: #fef2f2; }
.icon-box.gold { color: #f59e0b; background: #fffbeb; }

.card-content h4 { font-size: 1.05rem; font-weight: 700; color: var(--text-main); margin-bottom: 10px; line-height: 1.3; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.meta span { font-size: 0.75rem; padding: 5px 12px; border-radius: 8px; background: rgba(0,0,0,0.03); color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.exam-card.selected .meta span { background: rgba(37, 99, 235, 0.08); color: var(--primary-color); }

/* --- AUTH PANEL (GIAO DIỆN BO GÓC) --- */
.auth-panel { margin-top: 40px; animation: fadeIn 0.5s ease; }
.auth-inner { background: #ffffff; border-radius: 20px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.05); }

.input-label { font-size: 0.9rem; font-weight: 700; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.input-label svg { width: 18px; height: 18px; }
.auth-controls { display: flex; gap: 15px; align-items: flex-start; }
.auth-input-wrapper { flex: 1; display: flex; flex-direction: column; gap: 15px; }

.input-cccd { width: 100%; padding: 18px 20px; font-size: 1.1rem; font-weight: 600; color: var(--text-main); border: 1.5px solid #cbd5e1; border-radius: 12px; outline: none; transition: 0.3s; }
.input-cccd:focus { border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(37,99,235,0.1); }
.input-cccd.is-ready { border-color: var(--accent-success); }
.cccd-input-wrap { position: relative; }
.cccd-ghost { position: absolute; inset: 0; padding: 18px 20px; font-size: 1.1rem; font-weight: 600; color: transparent; white-space: pre; pointer-events: none; overflow: hidden; border: 1.5px solid transparent; border-radius: 12px; display: flex; align-items: center; }
.cccd-ghost .ghost-suffix { color: #b0bec5; }

.status-box { padding: 14px 20px; border-radius: 12px; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; }
.status-box.warning { background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c; }
.status-box.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }

.btn-premium { background: #0f4a7b; color: #fff; border: none; padding: 18px 36px; border-radius: 12px; font-weight: 800; font-size: 1.05rem; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 4px 15px rgba(15,74,123,0.2); white-space: nowrap; height: 60px; }
.btn-premium:disabled { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; box-shadow: none; }
.btn-premium:not(:disabled):hover { background: #0a3356; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,74,123,0.3); }

/* --- HISTORY PANEL (BẢNG THỐNG KÊ LỊCH SỬ) --- */
.history-section-title { text-align: center; font-size: 0.9rem; font-weight: 800; color: var(--text-muted); letter-spacing: 2px; margin: 60px 0 30px; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 15px; }
.history-section-title::before, .history-section-title::after { content: ""; height: 1px; width: 100px; background: rgba(0,0,0,0.05); }

.history-panel { background: transparent; padding: 0; box-shadow: none; border: none; }
.history-empty-state { text-align: center; padding: 40px; background: #fff; border-radius: 16px; border: 1px solid rgba(0,0,0,0.05); color: var(--text-muted); font-weight: 600; }

.history-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; flex-wrap: wrap; gap: 15px;}
.hist-user-id { display: flex; flex-direction: column; gap: 8px; }
.hist-user-id label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.hist-user-id .id-badge { background: #f8fafc; border: 1px solid rgba(0,0,0,0.05); padding: 8px 20px; border-radius: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text-main); display: inline-block; min-width: 120px; }
.hist-total { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); }

/* Responsive Table Container */
.table-wrapper { background: #f8fafc; border: 1px solid rgba(0,0,0,0.05); border-radius: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch;}
.history-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 800px;}
.history-table th { padding: 18px 20px; font-size: 0.9rem; font-weight: 700; color: var(--text-muted); border-bottom: 1.5px solid rgba(0,0,0,0.05); white-space: nowrap; }
.history-table td { padding: 20px; font-size: 0.95rem; font-weight: 600; color: var(--text-main); border-bottom: 1px solid rgba(0,0,0,0.05); }
.exam-name-vi { display: block; font-weight: 700; font-size: 0.9rem; }
.exam-name-en { display: block; font-size: 0.78rem; font-weight: 500; color: #64748b; margin-top: 2px; }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: #f1f5f9; }

.badge-outline { padding: 8px 16px; border-radius: 100px; font-size: 0.8rem; font-weight: 800; display: inline-block; border: 1px solid transparent; }
.badge-outline.pass { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.badge-outline.fail { background: #fef2f2; color: #dc2626; border-color: #fecaca; }

.btn-view { background: #fff; border: 1.5px solid #93c5fd; color: #2563eb; padding: 8px 20px; border-radius: 100px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-view:hover { background: #eff6ff; border-color: #3b82f6; }

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

/* Tối ưu Responsive */
@media (max-width: 1440px) { .container { max-width: 96%; padding: 0 15px 80px; } .exam-card.basic { width: 250px; } .exam-card.advanced { width: 175px; } }
@media (max-width: 1024px) { .title-gradient { font-size: 2.5rem; } .ambient-bg-light .orb { display: none; } .exam-card { backdrop-filter: blur(12px); } }
@media (max-width: 768px) {
    .top-nav { padding: 15px 20px; }
    .title-gradient { font-size: 1.8rem; }
    .flex-layout { gap: 12px; padding-bottom: 30px; margin: 0 -5px; }
    .exam-card.basic { width: 210px; padding: 24px 14px; gap: 12px; }
    .exam-card.advanced { width: 155px; padding: 24px 12px; gap: 12px; }
    .auth-controls { flex-direction: column; }
    .btn-premium { width: 100%; justify-content: center; }
}