/* 云收银 · 统一交互手感 v5
   只负责「动效与反馈」，不改任何布局、颜色语义；四端页面共用。
   与 assets/style.css 叠加使用，顾客点餐页单独引入也不会串样式。 */
:root {
  --ui-ease: cubic-bezier(.22, .61, .36, 1);
  --ui-ease-out: cubic-bezier(.16, 1, .3, 1);
  --ui-ring: 0 0 0 3px rgba(24, 95, 165, .20);
  --ui-shadow: 0 1px 2px rgba(20, 35, 60, .06), 0 3px 10px rgba(20, 35, 60, .07);
  --ui-shadow-up: 0 2px 5px rgba(20, 35, 60, .08), 0 9px 20px rgba(20, 35, 60, .13);
}

/* 1. 所有可点元素统一过渡曲线 */
button, .btn, [role="button"], a.btn,
.nav-item, .nav-group-head, .nav-sub a, .cat-tab, .goods, .tbl, .pay-opt,
.entry, .mini-tabs > div, .mode-switch button, .form-switch button,
.chip, .tag, select, input[type="checkbox"], .q-card, .delivery-card {
  transition: background-color .2s var(--ui-ease), border-color .2s var(--ui-ease),
              color .2s var(--ui-ease), box-shadow .26s var(--ui-ease),
              transform .18s var(--ui-ease), opacity .18s var(--ui-ease);
  -webkit-tap-highlight-color: transparent;
}
button, .btn, a.btn, [role="button"] { -webkit-user-select: none; user-select: none; }

/* 2. 悬停：轻微抬起 + 柔光，不再瞬间变色 */
button:not(:disabled):not(.ui-loading):hover,
.btn:not(:disabled):not(.ui-loading):hover,
a.btn:not(.ui-loading):hover {
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow);
}
.btn-primary:not(:disabled):not(.ui-loading):hover { box-shadow: 0 6px 18px rgba(12, 68, 124, .25); }
.btn-danger:not(:disabled):not(.ui-loading):hover { box-shadow: 0 6px 18px rgba(163, 45, 45, .18); }
.btn-ghost:not(:disabled):not(.ui-loading):hover { transform: none; box-shadow: none; }

/* 3. 按下：明确回弹感（比 hover 更快） */
button:not(:disabled):not(.ui-loading):active,
.btn:not(:disabled):not(.ui-loading):active,
a.btn:active,
.cat-tab:active, .goods:active, .tbl:active, .pay-opt:active,
.nav-sub a:active, .nav-item:active, .mode-switch button:active,
.form-switch button:active, .mini-tabs > div:active {
  transform: translateY(1px) scale(.975);
  transition-duration: .07s;
  box-shadow: 0 1px 2px rgba(20, 35, 60, .08) inset;
}

/* 4. 键盘焦点环（鼠标点击不显示） */
button:focus-visible, .btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: var(--ui-ring);
  border-color: #185FA5;
}
input:focus, select:focus, textarea:focus { transition: border-color .18s var(--ui-ease), box-shadow .18s var(--ui-ease); }

/* 5. 禁用态：不是简单变灰，去掉阴影并禁止动效 */
button:disabled, .btn:disabled, .ui-loading {
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}
button:disabled { opacity: .48; }

/* 6. 点击涟漪 */
.ui-ripple-host { position: relative; overflow: hidden; }
.ui-ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .16; transform: scale(0);
  animation: uiRipple .5s var(--ui-ease-out) forwards;
  mix-blend-mode: multiply;
}
@keyframes uiRipple { to { transform: scale(2.4); opacity: 0; } }

/* 7. 按钮加载态 */
.ui-loading { position: relative; opacity: .82 !important; }
.ui-spinner {
  display: inline-block; width: 12px; height: 12px; margin-right: 6px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -1px;
  animation: uiSpin .65s linear infinite;
}
@keyframes uiSpin { to { transform: rotate(360deg); } }

/* 8. 浮层提示（替代生硬的静态 notice 跳动） */
.ui-toasts {
  position: fixed; top: 66px; right: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none; max-width: min(380px, calc(100vw - 36px));
}
.ui-toast {
  /* 浮层提示不能挡住下方按钮：只有关闭按钮本身接收点击 */
  pointer-events: none; display: flex; align-items: flex-start; gap: 10px;
  background: #fff; color: #22262E; border: 1px solid #E3E5E9;
  border-left: 3px solid #185FA5; border-radius: 10px;
  padding: 11px 14px; font-size: 12.5px; line-height: 1.55;
  box-shadow: 0 8px 28px rgba(20, 35, 60, .16);
  animation: uiToastIn .3s var(--ui-ease-out) both;
  word-break: break-word;
}
.ui-toast.out { animation: uiToastOut .24s var(--ui-ease) both; }
.ui-toast .ui-ico { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; background: #185FA5; }
.ui-toast.ok { border-left-color: #0F6E56; }
.ui-toast.ok .ui-ico { background: #0F6E56; }
.ui-toast.error { border-left-color: #A32D2D; }
.ui-toast.error .ui-ico { background: #A32D2D; }
.ui-toast.warn { border-left-color: #BA7517; }
.ui-toast.warn .ui-ico { background: #BA7517; }
.ui-toast .ui-close { margin-left: auto; border: 0; background: transparent; color: #99A0AA; padding: 0 2px; font-size: 15px; line-height: 1; pointer-events: auto; }
@keyframes uiToastIn { from { opacity: 0; transform: translateX(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes uiToastOut { to { opacity: 0; transform: translateX(14px) scale(.97); } }

/* 8b. 顶部细进度条：任何 /api 请求进行中都会出现 */
.ui-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 10001;
  background: linear-gradient(90deg, #185FA5, #0F6E56);
  box-shadow: 0 0 8px rgba(24, 95, 165, .5);
  animation: uiProgress 1.1s var(--ui-ease-out) forwards;
  transition: width .2s linear, opacity .3s var(--ui-ease);
}
.ui-progress.done { width: 100% !important; opacity: 0; }
@keyframes uiProgress { 0% { width: 0; } 55% { width: 72%; } 100% { width: 94%; } }

/* 9. 弹窗 / 面板进出 */
.modal-mask { animation: uiFade .2s var(--ui-ease) both; }
.modal-mask .modal { animation: uiPop .26s var(--ui-ease-out) both; }
@keyframes uiFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiPop { from { opacity: 0; transform: translateY(10px) scale(.975); } to { opacity: 1; transform: none; } }
.notice, .card, .kpi, .delivery-card, .q-card { transition: background-color .2s var(--ui-ease), border-color .2s var(--ui-ease), box-shadow .2s var(--ui-ease); }
.card:hover, .kpi:hover { box-shadow: 0 4px 18px rgba(20, 35, 60, .055); }
#content, #leftBody, .pos-scroll { animation: uiFade .18s var(--ui-ease) both; }

/* 10. 数字与状态变化柔化 */
.amount, .k-value, .tag, .badge { transition: color .2s var(--ui-ease), background-color .2s var(--ui-ease); }

/* 11. 滚动条与选中 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #CBD0D7; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #AEB6C0; background-clip: padding-box; }
::selection { background: #CDE4F8; }

/* 12. 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 13. v5.81 触屏单指上下左右滑动
   Windows 触屏默认把单指按下当文本选择 / 页面拖拽，只有双指才平移；
   显式声明 pan-x pan-y 后单指即可上下左右滚动，js/touch-pan.js 再做兜底。 */
html, body { touch-action: pan-x pan-y; }
.pos-scroll, .order-items, #leftBody, .table-wrap, .td-box, .dc-scroll,
.dc-panel-b, .dc-stage, .mp-scroll, .pd-screen, .pd-lib, .pd-props-b,
.pr-list, .sd-body, .mini-scroll, [data-touch-pan] {
  touch-action: pan-x pan-y !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
[draggable="true"] { touch-action: pan-x pan-y; }
.ed-tips { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 12px; }
.ed-tips span { font-size: 11px; color: var(--ed-brand-deep, var(--blue-deep));
  background: var(--ed-soft, var(--blue-soft)); border-radius: 6px; padding: 3px 9px; }
