﻿/* ==========================================
   1. KHAI BÁO BIẾN & THEME (HỖ TRỢ CẢ POS & DASHBOARD)
========================================== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

:root, [data-theme="blue"] {
    --primary: #0D1A63;
    --primary-light: #1A2CA3;
    --accent: #F68048;
    --bg-soft: #f0f4ff;
    --text-main: #0a0e27;
    --sub-bg: #d1d9ff;
}
[data-theme="red"] {
    --primary: #5E0006;
    --primary-light: #9B0F06;
    --accent: #D53E0F;
    --bg-soft: #fdfaf6;
    --text-main: #2D1B1B;
    --sub-bg: #EED9B9;
}

/* ==========================================
   2. BASE & TIỆN ÍCH CHUNG
========================================== */
html, body {
    font-family: 'Nunito', sans-serif !important;
    background-color: var(--bg-soft);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
}

/* Background & Text Colors */
.bg-custom-primary {
    background-color: var(--primary);
}

.bg-custom-light {
    background-color: var(--primary-light);
}

.bg-custom-accent {
    background-color: var(--accent);
}

.bg-custom-soft {
    background-color: var(--bg-soft);
}

.bg-custom-sub {
    background-color: var(--sub-bg);
}

.text-custom-primary {
    color: var(--primary);
}

.text-custom-accent {
    color: var(--accent);
}

.border-custom-sub {
    border-color: var(--sub-bg);
}

/* Unified Custom Scrollbar */
::-webkit-scrollbar, .custom-scrollbar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track, .custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb, .custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
    opacity: 0.5;
}

/* ==========================================
   3. BLAZOR DEFAULTS
========================================== */
.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
    font-size: 0.8rem;
    font-weight: bold;
}

#blazor-error-ui {
    display: none;
    background: #b32121;
    color: white;
    bottom: 0;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .reload {
        margin-left: 0.5rem;
        color: #ffe500;
        font-weight: bold;
    }

/* ==========================================
   4. SIDEBAR & MENU NAVIGATION
========================================== */
aside {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 288px;
}

/* Nav Items */
.nav-item {
    border-left: 4px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

    .nav-item:hover {
        background-color: rgba(255, 255, 255, 0.08);
        border-left-color: var(--accent);
    }

    .nav-item.active, .active-nav {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-left-color: var(--accent) !important;
        opacity: 1 !important;
    }

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0,0,0,0.15);
}

    .submenu.open {
        max-height: 250px;
        transition: max-height 0.4s ease-in;
    }

.submenu-item {
    transition: all 0.2s;
    cursor: pointer;
    display: block;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
}

    .submenu-item:hover {
        padding-left: 2rem;
        background-color: rgba(255, 255, 255, 0.05);
        color: white;
    }

/* Sidebar Mini State */
.sidebar-mini aside {
    width: 80px !important;
}

.sidebar-mini .nav-item {
    justify-content: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.sidebar-mini .nav-text,
.sidebar-mini .menu-arrow,
.sidebar-mini .header-info,
.sidebar-mini .footer-info,
.sidebar-mini .header-slogan,
.sidebar-mini .submenu {
    display: none !important;
}

/* ==========================================
   5. HIỆU ỨNG (ANIMATIONS)
========================================== */
.animate-fade-in-down {
    animation: fadeInDown 0.2s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-pulse-slow {
    animation: pulseSlow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulseSlow {
    0%, 100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.15;
    }
}

/* Loading "MINIPOS" Text */
.minipos-loader {
    font-weight: 900;
    font-size: 2rem;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: -0.05em;
}

    .minipos-loader span {
        opacity: 0;
        transform: translateY(10px);
        display: inline-block;
        animation: miniposAppearDisappear 4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    }

        .minipos-loader span.m {
            animation-delay: 0.00s;
        }

        .minipos-loader span.i1 {
            animation-delay: 0.15s;
        }

        .minipos-loader span.n {
            animation-delay: 0.30s;
        }

        .minipos-loader span.i2 {
            animation-delay: 0.45s;
        }

        .minipos-loader span.p {
            animation-delay: 0.60s;
        }

        .minipos-loader span.o {
            animation-delay: 0.75s;
        }

        .minipos-loader span.s {
            animation-delay: 0.90s;
        }

@keyframes miniposAppearDisappear {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    10%, 60% {
        opacity: 1;
        transform: translateY(0);
    }

    70% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

/*CẤU HÌNH CHỖ IN ẤN*/
/* Trạng thái bình thường: Ẩn vùng in */
.print-only {
    display: none;
}

@media print {
    /* 1. Ẩn mọi thứ có class no-print */
    .no-print {
        display: none !important;
    }

    /* 2. Ép vùng in hiện ra trên cùng */
    .print-only {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 72mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        color: black !important;
        z-index: 999999 !important;
    }

        /* 3. Kẻ bảng và chỉnh màu cho máy in */
        .print-only table {
            border-collapse: collapse;
            width: 100%;
        }

        .print-only th, .print-only td {
            border: 1px solid black !important;
            padding: 4px;
        }

        .print-only th {
            background-color: #f0f0f0 !important;
        }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: 80mm auto;
        margin: 0;
    }
}
