/* UI kit — lớp hoàn thiện: bóng nhiều tầng, chuyển động có chủ đích (phản hồi, mở/đóng, trạng thái), chi tiết thị giác.
   Quy tắc chuyển động: 120–350ms; chỉ opacity / translate / scale (dùng thuộc tính `translate`/`scale` riêng để không đè
   `transform` mà Popper đặt cho dropdown/tooltip/popover); mọi thứ tắt khi người dùng chọn giảm chuyển động (css/base/motion.css). */

@keyframes ui-fade-up { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes ui-pop { from { opacity: 0; translate: 0 -4px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes ui-slide-in { from { opacity: 0; translate: 24px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes ui-pulse-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); } 100% { box-shadow: 0 0 0 .5rem transparent; } }
@keyframes ui-grow { from { width: 0; } }
@keyframes ui-indeterminate { 0% { translate: -100% 0; } 100% { translate: 250% 0; } }
@keyframes ui-shake { 20%, 60% { translate: -3px 0; } 40%, 80% { translate: 3px 0; } }

/* ---- Button: nổi nhẹ, nhấn lún, icon dịch chuyển ---- */
.ui-btn { transition: background-color var(--ui-t) var(--ui-ease), border-color var(--ui-t) var(--ui-ease), color var(--ui-t) var(--ui-ease), box-shadow var(--ui-t) var(--ui-ease), translate var(--ui-t-fast) var(--ui-ease), scale var(--ui-t-fast) var(--ui-ease); }
.ui-btn--primary, .ui-btn--danger { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(16, 24, 40, .14); }
@media (hover: hover) { .ui-btn--primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 14px -4px color-mix(in srgb, var(--ui-brand) 55%, transparent); translate: 0 -1px; } }
@media (hover: hover) { .ui-btn--danger:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 6px 14px -4px color-mix(in srgb, var(--ui-danger) 55%, transparent); translate: 0 -1px; } }
@media (hover: hover) { .ui-btn--secondary:hover,.ui-btn--danger-secondary:hover { box-shadow: var(--ui-shadow-md); translate: 0 -1px; } }
.ui-btn:active:not(:disabled):not(.is-loading) { translate: 0 0; scale: .98; box-shadow: none; }
.ui-btn > svg { transition: translate var(--ui-t) var(--ui-ease), scale var(--ui-t) var(--ui-ease-spring); }
@media (hover: hover) { .ui-btn:hover > svg:last-child:not(:first-child) { translate: 3px 0; } }
@media (hover: hover) { .ui-btn--icon:hover > svg { scale: 1.12; } }

/* ---- Badge: chấm "đang hoạt động" nhấp nháy tuỳ chọn ---- */
.ui-badge { transition: background-color var(--ui-t) var(--ui-ease), color var(--ui-t) var(--ui-ease); }
.ui-badge--pulse .ui-badge-dot { color: var(--b-dot); animation: ui-pulse-ring 1.8s var(--ui-ease) infinite; }

/* ---- Avatar: chấm online toả sóng (nhóm avatar đứng yên khi rê chuột) ---- */
.ui-avatar { transition: translate var(--ui-t) var(--ui-ease), box-shadow var(--ui-t) var(--ui-ease); }
.ui-avatar-status.is-online { color: var(--ui-success); animation: ui-pulse-ring 2.4s var(--ui-ease) infinite; }

/* ---- Featured icon: vòng halo mềm quanh icon ---- */
.ui-featured:not(.ui-featured--outline) { box-shadow: 0 0 0 .3rem color-mix(in srgb, var(--fi-fg) 10%, transparent); }
.ui-featured--outline { transition: box-shadow var(--ui-t) var(--ui-ease); }

/* ---- Alert: nút đóng mờ dần thay vì biến mất đột ngột ---- */
.ui-alert { transition: opacity var(--ui-t) var(--ui-ease), translate var(--ui-t) var(--ui-ease); }
.ui-alert.is-leaving { opacity: 0; translate: 0 -4px; }

/* ---- Progress: thanh dài ra khi hiện; chế độ không xác định ---- */
.ui-progress-bar { animation: ui-grow .8s var(--ui-ease); }
.ui-progress--indeterminate .ui-progress-track { position: relative; }
.ui-progress--indeterminate .ui-progress-bar { position: absolute; inset: 0 auto 0 0; width: 40%; animation: ui-indeterminate 1.4s var(--ui-ease) infinite; }

/* ---- Ô nhập: viền đậm dần khi rê, rung nhẹ khi báo lỗi ---- */
.ui-input { transition: border-color var(--ui-t) var(--ui-ease), box-shadow var(--ui-t) var(--ui-ease), background-color var(--ui-t) var(--ui-ease); }
@media (hover: hover) { .ui-input:hover:not(:focus-within) { border-color: color-mix(in srgb, var(--ui-line-strong) 60%, var(--ui-text-subtle)); } }
.ui-field.has-error .ui-input { animation: ui-shake .35s var(--ui-ease) 1; }
.ui-field-error { animation: ui-fade-up .25s var(--ui-ease); }
.ui-input > svg { transition: color var(--ui-t) var(--ui-ease); }
.ui-input:focus-within > svg { color: var(--ui-brand); }

.ui-file::file-selector-button { transition: background-color var(--ui-t) var(--ui-ease); }

/* ---- Accordion: mũi tên xoay mượt, nội dung hiện dần ---- */
.accordion-button { transition: background-color var(--ui-t) var(--ui-ease), color var(--ui-t) var(--ui-ease), box-shadow var(--ui-t) var(--ui-ease); }
.accordion-button::after { transition: transform var(--ui-t-slow) var(--ui-ease-spring); }
@media (hover: hover) { .accordion-button:hover:not(:not(.collapsed)) { background: var(--ui-brand-bg); } }
@media (hover: hover) { .accordion-button.collapsed:hover { background: var(--ui-surface-2); } }
.accordion-collapse { transition: height var(--ui-t-slow) var(--ui-ease); }
.accordion-collapse.show .accordion-body { animation: ui-fade-up .3s var(--ui-ease); }

/* ---- Tabs: thanh chỉ báo trượt (pills nền trượt, underline gạch trượt); nội dung hiện dần ---- */
.ui-tabs .nav-underline, .ui-tabs .nav-pills { position: relative; --ui-ind-x: 0px; --ui-ind-w: 0px; }
.ui-tabs .nav-underline::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--ui-ind-w); translate: var(--ui-ind-x) 0; background: var(--ui-brand); border-radius: 2px; transition: translate var(--ui-t-slow) var(--ui-ease), width var(--ui-t-slow) var(--ui-ease); }
.ui-tabs .nav-underline .nav-link.active { border-bottom-color: transparent; }
@media (hover: hover) { .ui-tabs .nav-underline .nav-link:hover { border-bottom-color: transparent; } }
.ui-tabs .nav-pills::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--ui-ind-w); translate: var(--ui-ind-x) 0; background: var(--ui-brand); border-radius: var(--ui-radius); transition: translate var(--ui-t-slow) var(--ui-ease-spring), width var(--ui-t-slow) var(--ui-ease); }
.ui-tabs .nav-pills .nav-link { position: relative; z-index: 1; background: transparent; transition: color var(--ui-t) var(--ui-ease); }
.ui-tabs .nav-pills .nav-link.active { background: transparent; }
@media (hover: hover) { .ui-tabs .nav-pills .nav-link:not(.active):hover { color: var(--ui-text); } }
.ui-tabs .nav:not([style*="--ui-ind"]) .nav-link.active { color: var(--ui-brand-text); }
.nav-link { transition: color var(--ui-t) var(--ui-ease), background-color var(--ui-t) var(--ui-ease); }
.tab-pane.active { animation: ui-fade-up .28s var(--ui-ease); }

/* ---- Dropdown / popover / tooltip: mở bằng pop nhẹ, mục menu có nền trượt ---- */
.ui-dropdown .dropdown-menu { padding: .35rem; border-color: var(--ui-line); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-lg); transform-origin: top; }
.ui-dropdown .dropdown-menu.show { animation: ui-pop .16s var(--ui-ease); }
.ui-dropdown .dropdown-item { border-radius: var(--ui-radius-sm); padding: .45rem .65rem; font-size: .875rem; transition: background-color var(--ui-t-fast) var(--ui-ease), color var(--ui-t-fast) var(--ui-ease), padding var(--ui-t) var(--ui-ease); }
@media (hover: hover) { .ui-dropdown .dropdown-item:hover:not(.active):not(.disabled) { background: var(--ui-el); } }
@media (hover: hover) { .ui-dropdown .dropdown-item.text-danger:hover { background: var(--ui-danger-bg); } }
.ui-dropdown .dropdown-item > svg { width: 1.05em; height: 1.05em; flex: none; color: var(--ui-text-subtle); }
.popover.show { animation: ui-pop .16s var(--ui-ease); }
.tooltip.show { animation: ui-pop .12s var(--ui-ease); }

/* ---- Modal / offcanvas: mở trượt + phóng nhẹ, nền mờ ---- */
.ui-modal .modal-content { border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-lg); background: var(--ui-surface); }
.ui-modal.fade .modal-dialog { transform: none; translate: 0 14px; scale: .97; opacity: 0; transition: translate var(--ui-t-slow) var(--ui-ease), scale var(--ui-t-slow) var(--ui-ease), opacity var(--ui-t) var(--ui-ease); }
.ui-modal.show .modal-dialog { translate: 0 0; scale: 1; opacity: 1; }
.ui-modal .modal-header { border-bottom-color: var(--ui-line); padding: 1rem 1.25rem; }
.ui-modal .modal-title { font-family: var(--ui-font-heading); font-size: 1.0625rem; font-weight: 700; }
.ui-modal .modal-footer { border-top-color: var(--ui-line); background: var(--ui-surface-2); border-radius: 0 0 var(--ui-radius-lg) var(--ui-radius-lg); gap: .5rem; }
.modal-backdrop { --bs-backdrop-opacity: .42; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.ui-offcanvas { border-color: var(--ui-line); box-shadow: var(--ui-shadow-lg); background: var(--ui-surface); transition: transform var(--ui-t-slow) var(--ui-ease); }
.ui-offcanvas .offcanvas-title { font-family: var(--ui-font-heading); font-weight: 700; }

/* ---- Toast: trượt vào từ phải ---- */
.toast.show { animation: ui-slide-in .3s var(--ui-ease); }

/* ---- Card, list-group, pagination, breadcrumb, carousel ---- */
.card { box-shadow: var(--ui-shadow-sm); transition: box-shadow var(--ui-t) var(--ui-ease), translate var(--ui-t) var(--ui-ease), border-color var(--ui-t) var(--ui-ease); }
.card.is-interactive { cursor: pointer; }
@media (hover: hover) { .card.is-interactive:hover { box-shadow: var(--ui-shadow-md); translate: 0 -2px; border-color: var(--ui-brand-line); } }
.list-group-item { transition: background-color var(--ui-t-fast) var(--ui-ease), color var(--ui-t-fast) var(--ui-ease), padding var(--ui-t) var(--ui-ease); }
@media (hover: hover) { .list-group-item-action:hover:not(.active):not(.disabled) { padding-left: 1.2rem; } }
.page-link { transition: background-color var(--ui-t) var(--ui-ease), color var(--ui-t) var(--ui-ease), scale var(--ui-t-fast) var(--ui-ease); }
.page-link:active { scale: .94; }
.breadcrumb-item a { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color var(--ui-t) var(--ui-ease); }
@media (hover: hover) { .breadcrumb-item a:hover { text-decoration-color: currentColor; } }
.carousel-indicators [data-bs-target] { width: .5rem; height: .5rem; margin-inline: .25rem; border: 0; border-radius: 99px; opacity: .6; transition: width var(--ui-t-slow) var(--ui-ease), opacity var(--ui-t) var(--ui-ease); }
.carousel-indicators .active { width: 1.5rem; opacity: 1; }
.carousel-control-prev, .carousel-control-next { transition: opacity var(--ui-t) var(--ui-ease); }
.placeholder-glow .placeholder { animation-duration: 1.6s; }
