﻿/* --- 1. HỆ THỐNG 3 THEME CHUẨN (ĐÃ FIX CONTRAST & DARKMODE) --- */
:root, body.light-theme {
    --bg: #F1F3F9; /* Nền xám xanh nhẹ để nổi bật Card trắng */
    --surface: #FFFFFF; /* Trắng tinh cho thẻ */
    --primary: #6750A4;
    --on-primary: #FFFFFF;
    --outline: #47454F; /* Đậm hơn để dễ đọc chữ phụ */
    --text-main: #1C1B1F; /* Đen sâu cho tiêu đề */
    --card-border: #E0E0E0; /* Viền rõ nét */
}

body.grey-theme {
    --bg: #1C1B1F;
    --surface: #2B2930;
    --primary: #D0BCFF;
    --on-primary: #381E72;
    --outline: #938F99;
    --text-main: #E6E1E5;
    --card-border: rgba(255,255,255,0.1);
}

body.dark-theme {
    --bg: #000000;
    --surface: #121212; /* Nền tối sâu */
    --primary: #D0BCFF;
    --on-primary: #381E72;
    --outline: #A0A0A0; /* Chữ phụ sáng hơn một chút trong nền tối */
    --text-main: #FFFFFF; /* Trắng tinh */
    --card-border: #2A2A2A; /* Viền tối rõ ràng */
}

    /* --- 2. CƠ CHẾ ÉP MÀU THEME (QUAN TRỌNG NHẤT) --- */
    /* Ép các class Tailwind 'bg-white' và 'bg-xx-50' phải đổi màu theo Theme */
    body.dark-theme .bg-white,
    body.dark-theme .bg-blue-50,
    body.dark-theme .bg-orange-50,
    body.dark-theme .bg-surface,
    body.grey-theme .bg-white,
    body.grey-theme .bg-blue-50,
    body.grey-theme .bg-surface {
        background-color: var(--surface) !important;
        color: var(--text-main) !important;
        border-color: var(--card-border) !important;
    }

/* Sửa lỗi chữ bị mờ - Ép chữ phụ phải đậm hơn */
.text-\[var\(--outline\)\], .text-slate-500, .text-gray-500 {
    color: var(--outline) !important;
    font-weight: 700 !important; /* Đẩy lên 700 cho dễ đọc */
}

/* Ép màu chữ chính */
h1, h2, h3, h4, .text-slate-900, .text-black {
    color: var(--text-main) !important;
}

/* --- 3. CORE STYLE & ANIMATION --- */
body {
    color: var(--text-main);
    background-color: var(--bg);
    transition: background 0.3s ease, color 0.3s ease;
    font-family: 'Google Sans', 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

* {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Hiệu ứng bấm nút "Nội lực" */
.btn-active:active {
    transform: scale(0.95);
    transition: 0.1s;
}

/* Bo góc Card chuẩn App hiện đại */
.rounded-\[32px\] {
    border-radius: 28px !important;
}

/* Viền card và đổ bóng nhẹ */
.border, .border-\[var\(--card-border\)\] {
    border: 1.5px solid var(--card-border) !important;
}

/* Giấu scrollbar */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- 4. CÁC THÀNH PHẦN ĐẶC BIỆT --- */
.timeline-item {
    position: relative;
    padding-left: 24px;
    border-left: 2.5px solid var(--card-border);
    margin-left: 12px;
    padding-bottom: 24px;
}

    .timeline-item::before {
        content: "";
        position: absolute;
        left: -7.5px;
        top: 4px;
        width: 13px;
        height: 13px;
        border-radius: 50%;
        background-color: var(--primary);
        border: 2px solid var(--surface);
        box-shadow: 0 0 0 2px var(--card-border);
    }

/* Material Icons sắc nét hơn */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24 !important;
    display: inline-block;
    vertical-align: middle;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.loader {
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

/* Toast System */
.toast-container {
    z-index: 10000 !important;
}

/* Ép các biểu đồ Canvas không bị lòi nền trắng */
canvas {
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.05));
}


.swal2-container {
    z-index: 999999 !important;
}