/*
 * Màu chính của nền tảng (Admin hệ thống + trang đăng nhập).
 * Theme Sash suy mọi màu primary từ --primary-rgb; đổi màu thương hiệu chỉ cần sửa ở đây.
 * Nạp ở _LayoutAdmin.cshtml và _LayoutBase.cshtml. Dùng html:root (ưu tiên cao hơn :root) vì style.css và
 * plugins.css của theme đều khai báo lại --primary-rgb, thứ tự nạp không đảm bảo.
 */
html:root {
    --primary-rgb: 0, 69, 255;          /* #0045ff */
    --primary: #0045ff;
    --primary-bg-color: rgb(var(--primary-rgb));
    --primary-bg-hover: rgba(var(--primary-rgb), .9);
    --primary-bg-border: rgb(var(--primary-rgb));
    --primary-transparentcolor: rgba(var(--primary-rgb), .1);
    --primary-strong: #0037cc;          /* hover / nhấn của nút chính */
}

/* ===== Thống nhất màu chính (#0045ff) cho trạng thái chọn, nút, menu ===== */
::selection { background: rgba(var(--primary-rgb), .18); color: rgb(var(--primary-rgb)); }

/* Nút hành động: primary / success / info / warning (Tạo mới, Lưu, Duyệt, Xác nhận...) dùng chung màu chính đậm.
   btn-danger (Xoá) và btn-light (Huỷ/Đóng) giữ nguyên để phân biệt thao tác nguy hiểm / trung tính. */
.btn-primary, .btn-success, .btn-info, .btn-warning {
    color: #fff !important;
    background: rgb(var(--primary-rgb)) !important;
    border-color: rgb(var(--primary-rgb)) !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), .25) !important;
}
.btn-primary:hover, .btn-success:hover, .btn-info:hover, .btn-warning:hover,
.btn-primary:focus, .btn-success:focus, .btn-info:focus, .btn-warning:focus,
.btn-primary:active, .btn-success:active, .btn-info:active, .btn-warning:active,
.btn-primary.active, .btn-success.active, .btn-info.active, .btn-warning.active {
    color: #fff !important;
    background: var(--primary-strong) !important;
    border-color: var(--primary-strong) !important;
    box-shadow: 0 0 0 .2rem rgba(var(--primary-rgb), .25) !important;
}
/* Nút phụ (Quay lại, Khôi phục mặc định): viền + chữ màu chính */
.btn-secondary, .btn-outline-primary {
    color: rgb(var(--primary-rgb)) !important;
    background: #fff !important;
    border: 1px solid rgb(var(--primary-rgb)) !important;
    font-weight: 600;
    box-shadow: none !important;
}
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active,
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active, .btn-outline-primary.active {
    color: #fff !important;
    background: rgb(var(--primary-rgb)) !important;
    border-color: rgb(var(--primary-rgb)) !important;
}
.dark-mode .btn-secondary, .dark-mode .btn-outline-primary { background: transparent !important; }
/* Nút nhẹ (Xoá bộ lọc, Cột hiển thị, Làm mới, Huỷ): nền màu chính nhạt, chữ màu chính */
.btn-light {
    color: rgb(var(--primary-rgb)) !important;
    background: rgba(var(--primary-rgb), .07) !important;
    border: 1px solid rgba(var(--primary-rgb), .22) !important;
    font-weight: 600;
}
.btn-light:hover, .btn-light:focus, .btn-light:active, .btn-light.show {
    color: var(--primary-strong) !important;
    background: rgba(var(--primary-rgb), .14) !important;
    border-color: rgba(var(--primary-rgb), .4) !important;
}
/* Nút chữ trong bảng (Sửa, Duyệt): màu chính; Xoá giữ đỏ */
.btn.text-primary, .btn.text-success, .btn.text-info {
    color: rgb(var(--primary-rgb)) !important;
    font-weight: 600;
}
.btn.text-primary:hover, .btn.text-success:hover, .btn.text-info:hover { background: rgba(var(--primary-rgb), .08); }
.btn.text-danger { font-weight: 600; }
.btn.text-danger:hover { background: rgba(232, 38, 70, .08); }

/* Menu trái: mục đang chọn / hover → chữ + icon màu chính đậm, nền nhạt, vạch nhấn bên trái */
.app-sidebar .side-menu__item.active,
.app-sidebar .side-menu__item.active:hover,
.app-sidebar .side-menu__item.active:focus {
    color: rgb(var(--primary-rgb)) !important;
    background: rgba(var(--primary-rgb), .1) !important;
    font-weight: 600;
    box-shadow: inset 3px 0 0 rgb(var(--primary-rgb));
}
.app-sidebar .side-menu__item.active .side-menu__label,
.app-sidebar .side-menu__item.active .side-menu__icon,
.app-sidebar .side-menu__item:hover .side-menu__label,
.app-sidebar .side-menu__item:hover .side-menu__icon,
.app-sidebar .side-menu__item:focus .side-menu__label,
.app-sidebar .side-menu__item:focus .side-menu__icon,
.app-sidebar .side-menu__item:hover,
.app-sidebar .side-menu__item:focus,
.app-sidebar .slide-item.active,
.app-sidebar .slide-item:hover,
.app-sidebar .slide-item:focus,
.app-sidebar .slide-menu a.active {
    color: rgb(var(--primary-rgb)) !important;
}
.app-sidebar .slide-item.active, .app-sidebar .slide-menu a.active { font-weight: 600; }

/* Trạng thái được chọn chung: phân trang, dropdown, tab, checkbox/radio, ô nhập đang focus */
.page-item.active .page-link {
    color: #fff !important;
    background-color: rgb(var(--primary-rgb)) !important;
    border-color: rgb(var(--primary-rgb)) !important;
    font-weight: 600;
}
.page-link:hover { color: rgb(var(--primary-rgb)); }
.dropdown-item.active, .dropdown-item:active,
.dropdown-item:hover, .dropdown-item:focus {
    color: rgb(var(--primary-rgb)) !important;
    background-color: rgba(var(--primary-rgb), .08) !important;
}
.dropdown-item.active { font-weight: 600; }
.nav-tabs .nav-link.active {
    color: rgb(var(--primary-rgb)) !important;
    border-bottom-color: rgb(var(--primary-rgb)) !important;
    font-weight: 600;
}
.nav-pills .nav-link.active { color: #fff !important; background-color: rgb(var(--primary-rgb)) !important; font-weight: 600; }
.form-check-input:checked,
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: rgb(var(--primary-rgb)) !important;
    border-color: rgb(var(--primary-rgb)) !important;
}
.form-control:focus, .form-select:focus {
    border-color: rgba(var(--primary-rgb), .6) !important;
    box-shadow: 0 0 0 .15rem rgba(var(--primary-rgb), .15) !important;
}

/* Select2: dòng đang trỏ, dòng đã chọn, tag chọn nhiều */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: rgb(var(--primary-rgb)) !important;
    color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: rgba(var(--primary-rgb), .08);
    color: rgb(var(--primary-rgb));
    font-weight: 600;
}
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: rgba(var(--primary-rgb), .6) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(var(--primary-rgb), .1) !important;
    border: 1px solid rgba(var(--primary-rgb), .35) !important;
    color: var(--primary-strong) !important;
    font-weight: 600;
    border-radius: 6px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--primary-strong) !important;
    opacity: .7;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { opacity: 1; }

/* ===== Nhãn trạng thái (badge) rõ nét: nền đậm hơn, chữ tối, viền mảnh, chữ đậm =====
   Giữ nghĩa màu (xanh = tốt, vàng = chờ, đỏ = lỗi/khoá), chỉ tăng độ tương phản. */
.badge { font-weight: 600; letter-spacing: .01em; }
.badge[class*="-transparent"] { border: 1px solid transparent; font-size: 12px; line-height: 1.2; }
.badge.bg-primary-transparent   { background-color: rgba(var(--primary-rgb), .12) !important; color: var(--primary-strong) !important; border-color: rgba(var(--primary-rgb), .35); }
.badge.bg-success-transparent   { background-color: rgba(9, 173, 149, .15) !important;  color: #04705f !important; border-color: rgba(9, 173, 149, .45); }
.badge.bg-warning-transparent   { background-color: rgba(247, 183, 49, .2) !important;  color: #8a5300 !important; border-color: rgba(247, 183, 49, .6); }
.badge.bg-danger-transparent    { background-color: rgba(232, 38, 70, .13) !important;  color: #b3122c !important; border-color: rgba(232, 38, 70, .4); }
.badge.bg-info-transparent      { background-color: rgba(17, 112, 228, .13) !important; color: #0a4fa3 !important; border-color: rgba(17, 112, 228, .4); }
.badge.bg-secondary-transparent { background-color: rgba(5, 195, 251, .16) !important;  color: #03698a !important; border-color: rgba(5, 195, 251, .5); }
.badge.bg-dark-transparent      { background-color: rgba(40, 44, 60, .1) !important;    color: #232838 !important; border-color: rgba(40, 44, 60, .3); }
.badge.bg-light { border: 1px solid rgba(40, 44, 60, .15); }
.badge.bg-primary { background-color: rgb(var(--primary-rgb)) !important; }

.dark-mode .badge.bg-primary-transparent   { background-color: rgba(var(--primary-rgb), .3) !important; color: #b8ccff !important; }
.dark-mode .badge.bg-success-transparent   { background-color: rgba(9, 173, 149, .25) !important;  color: #6fe3cf !important; }
.dark-mode .badge.bg-warning-transparent   { background-color: rgba(247, 183, 49, .25) !important; color: #ffd27a !important; }
.dark-mode .badge.bg-danger-transparent    { background-color: rgba(232, 38, 70, .25) !important;  color: #ff9aab !important; }
.dark-mode .badge.bg-info-transparent      { background-color: rgba(17, 112, 228, .28) !important; color: #9cc6ff !important; }
.dark-mode .badge.bg-secondary-transparent { background-color: rgba(5, 195, 251, .25) !important;  color: #8fe2ff !important; }
.dark-mode .badge.bg-dark-transparent      { background-color: rgba(255, 255, 255, .12) !important; color: #e6e8f0 !important; }

/* ===== Chế độ tối: màu chính khi làm CHỮ / VIỀN đổi sang sắc sáng cùng tông để đủ tương phản trên nền tối.
   Nút nền đặc (primary/success/info/warning) và phân trang đang chọn giữ #0045ff. ===== */
.dark-mode {
    --primary-soft: #8fb0ff;            /* chữ / icon / link màu chính trên nền tối */
    --primary-soft-strong: #b9ccff;     /* hover */
}
.dark-mode .text-primary { color: var(--primary-soft) !important; }
.dark-mode .main-container a:not(.btn):not(.dropdown-item):not(.page-link):not(.nav-link) { color: var(--primary-soft); }
.dark-mode .main-container a:not(.btn):not(.dropdown-item):not(.page-link):not(.nav-link):hover { color: var(--primary-soft-strong); }
.dark-mode .breadcrumb-item.active { color: var(--primary-soft); }

/* Nút nhẹ / nút phụ / nút chữ */
.dark-mode .btn-light {
    color: var(--primary-soft) !important;
    background: rgba(var(--primary-rgb), .18) !important;
    border-color: rgba(var(--primary-rgb), .55) !important;
}
.dark-mode .btn-light:hover, .dark-mode .btn-light:focus, .dark-mode .btn-light:active, .dark-mode .btn-light.show {
    color: #fff !important;
    background: rgba(var(--primary-rgb), .38) !important;
    border-color: rgba(var(--primary-rgb), .8) !important;
}
.dark-mode .btn-secondary, .dark-mode .btn-outline-primary {
    color: var(--primary-soft) !important;
    border-color: rgba(143, 176, 255, .7) !important;
}
.dark-mode .btn-secondary:hover, .dark-mode .btn-secondary:focus, .dark-mode .btn-secondary:active,
.dark-mode .btn-outline-primary:hover, .dark-mode .btn-outline-primary:focus, .dark-mode .btn-outline-primary:active {
    color: #fff !important;
    background: rgb(var(--primary-rgb)) !important;
    border-color: rgb(var(--primary-rgb)) !important;
}
.dark-mode .btn.text-primary, .dark-mode .btn.text-success, .dark-mode .btn.text-info { color: var(--primary-soft) !important; }
.dark-mode .btn.text-primary:hover, .dark-mode .btn.text-success:hover, .dark-mode .btn.text-info:hover { background: rgba(var(--primary-rgb), .2); }
.dark-mode .btn.text-danger { color: #ff8a9b !important; }

/* Menu trái */
.dark-mode .app-sidebar .side-menu__item.active,
.dark-mode .app-sidebar .side-menu__item.active:hover,
.dark-mode .app-sidebar .side-menu__item.active:focus {
    color: var(--primary-soft-strong) !important;
    background: rgba(var(--primary-rgb), .28) !important;
    box-shadow: inset 3px 0 0 var(--primary-soft);
}
.dark-mode .app-sidebar .side-menu__item.active .side-menu__label,
.dark-mode .app-sidebar .side-menu__item.active .side-menu__icon,
.dark-mode .app-sidebar .side-menu__item:hover .side-menu__label,
.dark-mode .app-sidebar .side-menu__item:hover .side-menu__icon,
.dark-mode .app-sidebar .side-menu__item:focus .side-menu__label,
.dark-mode .app-sidebar .side-menu__item:focus .side-menu__icon,
.dark-mode .app-sidebar .side-menu__item:hover,
.dark-mode .app-sidebar .side-menu__item:focus,
.dark-mode .app-sidebar .slide-item.active,
.dark-mode .app-sidebar .slide-item:hover,
.dark-mode .app-sidebar .slide-item:focus,
.dark-mode .app-sidebar .slide-menu a.active {
    color: var(--primary-soft-strong) !important;
}

/* Trạng thái chọn: dropdown, tab, select2, phân trang (hover) */
.dark-mode .dropdown-item.active, .dark-mode .dropdown-item:active,
.dark-mode .dropdown-item:hover, .dark-mode .dropdown-item:focus {
    color: var(--primary-soft-strong) !important;
    background-color: rgba(var(--primary-rgb), .22) !important;
}
.dark-mode .nav-tabs .nav-link.active { color: var(--primary-soft-strong) !important; border-bottom-color: var(--primary-soft) !important; }
.dark-mode .page-link:hover { color: var(--primary-soft-strong); }
.dark-mode .select2-container--default .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: rgba(var(--primary-rgb), .22);
    color: var(--primary-soft-strong);
}
.dark-mode .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: rgba(var(--primary-rgb), .3) !important;
    border-color: rgba(143, 176, 255, .6) !important;
    color: #dfe7ff !important;
}
.dark-mode .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: #dfe7ff !important; }
.dark-mode ::selection { background: rgba(143, 176, 255, .35); color: #fff; }
.dark-mode .main-container .breadcrumb-item a { color: #b8bddc; }
.dark-mode .main-container .breadcrumb-item a:hover { color: var(--primary-soft-strong); }
