/* =========================================================
   HIỆU ỨNG CHẠM / CLICK (đi kèm fx-interactions.js)
   Xoá 2 dòng fx-interactions.* trong index.php để tắt toàn bộ.
   ========================================================= */
:root { --fx-ripple: rgba(29,78,216,.22); --fx-ok: #2fb98f; --fx-err: #e5484d; }
[data-theme="dark"] { --fx-ripple: rgba(110,160,255,.25); }

/* Gợn sóng tại chỗ chạm: nằm trong 1 lớp riêng nên không phải đổi overflow của nút gốc */
.fx-ripple-host { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.fx-ripple { position: absolute; border-radius: 50%; background: var(--fx-ripple); transform: scale(0); animation: fxRipple .55s ease-out forwards; }
.btn-pay .fx-ripple, .court-tab.active .fx-ripple, .menu-item.active .fx-ripple, #fab-cart .fx-ripple { background: rgba(255,255,255,.4); }
@keyframes fxRipple { to { transform: scale(1); opacity: 0; } }

/* Lún xuống khi đang bấm */
.product-card, .menu-item, .bk-footer-track button, .ib-actions button { transition: transform .14s ease, box-shadow .14s ease; }
.product-card:active { transform: scale(.95) !important; }
.menu-item:active, .bk-footer-track button:active { transform: scale(.96); }
.ib-actions button:active, #cart-items button:active, #cart-items i:active { transform: scale(.9); }

/* Ô lịch, thẻ hoá đơn, ghi chú: lún nhẹ khi bấm */
.day-cell, .invoice-banner, .sticky-note { transition: transform .14s ease; }
.day-cell:active { transform: scale(.94); }
.invoice-banner:active { transform: scale(.985); }

/* Đã bấm Xoá và xác nhận: dòng mờ đi trong lúc chờ server xoá */
.fx-pending { opacity: .35 !important; filter: grayscale(1); pointer-events: none; transition: opacity .25s ease, filter .25s ease; }
tr.fx-pending td { text-decoration: line-through; }

/* Các kiểu chuyển động dùng lại */
.fx-jelly { animation: fxJelly .55s ease; }
@keyframes fxJelly { 0%{transform:scale(1)} 30%{transform:scale(1.18,.84)} 50%{transform:scale(.9,1.1)} 70%{transform:scale(1.05,.96)} 100%{transform:scale(1)} }
.fx-pop { animation: fxPop .38s cubic-bezier(.3,1.6,.5,1); }
@keyframes fxPop { 0%{transform:scale(1)} 40%{transform:scale(1.35)} 100%{transform:scale(1)} }
.fx-bump { display: inline-block; animation: fxBump .35s ease; }
@keyframes fxBump { 0%{transform:scale(1)} 35%{transform:scale(1.12)} 100%{transform:scale(1)} }
.fx-shake { animation: fxShake .4s ease; }
@keyframes fxShake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.fx-wiggle { display: inline-block; animation: fxWiggle .45s ease; }
@keyframes fxWiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-14deg)} 50%{transform:rotate(10deg)} 75%{transform:rotate(-6deg)} }
.fx-qty-up { animation: fxQtyUp .24s ease-out; }
.fx-qty-down { animation: fxQtyDown .24s ease-out; }
@keyframes fxQtyUp { from { transform: translateY(70%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fxQtyDown { from { transform: translateY(-70%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Nhãn "+1" bay vào giỏ, hạt màu khi thanh toán xong */
.fx-fly { position: fixed; z-index: 9000; pointer-events: none; padding: 4px 12px; border-radius: 999px; background: #FF7A1A; color: #0A1A5C; font: 800 15px 'Outfit', sans-serif; box-shadow: inset 3px 4px 8px rgba(255,255,255,.5), 0 8px 16px -6px rgba(0,0,0,.35); }
.fx-spark { position: fixed; z-index: 9000; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; }

/* Thông báo (toast): thành công thì nảy + vạch xanh, lỗi thì rung + vạch đỏ */
.toast.fx-toast-ok { border-left-color: var(--fx-ok) !important; animation: fxToastIn .32s cubic-bezier(.3,1.4,.5,1); }
.toast.fx-toast-err { border-left-color: var(--fx-err) !important; animation: fxToastIn .32s cubic-bezier(.3,1.4,.5,1), fxShake .4s ease .32s; }
@keyframes fxToastIn { from { transform: translateY(-14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* Thanh "Hoàn tác" khi xoá món khỏi giỏ */
#fx-undo { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(420px, calc(100% - 32px)); z-index: 9500; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; border-radius: 18px; overflow: hidden;
  background: var(--gc-glass-strong, var(--bg-card)); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--gc-edge, var(--border-color));
  box-shadow: var(--gc-clay, 0 10px 30px rgba(0,0,0,.2)); color: var(--text-main); font-weight: 600; font-size: 14px; }
#fx-undo[hidden] { display: none; }
#fx-undo span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#fx-undo button { flex-shrink: 0; padding: 9px 16px; border: 0; border-radius: 12px; font: inherit; font-weight: 800; color: var(--primary); background: var(--gc-glass-soft, var(--bg-subtle)); box-shadow: var(--gc-clay-sm, none); cursor: pointer; }
#fx-undo i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--primary); transform-origin: left; }
@media (max-width: 768px) { #fx-undo { bottom: calc(var(--bk-bottom-height, 0px) + 14px); } }

/* Người dùng bật "Giảm chuyển động": bỏ hết chuyển động, thao tác vẫn chạy bình thường */
@media (prefers-reduced-motion: reduce) {
  .fx-ripple-host, .fx-fly, .fx-spark { display: none !important; }
  .fx-jelly, .fx-pop, .fx-bump, .fx-shake, .fx-wiggle, .fx-qty-up, .fx-qty-down, .toast.fx-toast-ok, .toast.fx-toast-err { animation: none !important; }
  .product-card:active, .menu-item:active, .bk-footer-track button:active, .day-cell:active, .invoice-banner:active { transform: none !important; }
  .fx-pending { transition: none; }
}
