/* ==========================================================================
   css/voiceOrder.css   语音点餐悬浮按钮 + 确认弹窗
   独立新文件，不改动 menu.css / base.css 里任何一行既有样式。
   ========================================================================== */
.voice-fab {
  position: fixed;
  right: 16px;
  /* 92px 是留给底部购物车栏的高度，但栏本身用了 env(safe-area-inset-bottom)
     避开 iPhone 底部圆点/横条，栏会跟着变高——这里如果只写死 92px，在有
     safe area 的 iPhone 上麦克风按钮会往下盖住"去结算"按钮一部分，导致
     顾客点结算却点到麦克风、跳回录音界面。加上同一个 safe-area 变量让两边
     一起变化，才能保证按钮永远浮在购物车栏上方、不重叠。 */
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-gold, rgba(246, 184, 63, 0.45));
  background: var(--accent-gradient, linear-gradient(135deg, #ff942c 0%, #ff6b00 100%));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: var(--text-on-accent, #1a1200);
  box-shadow: var(--shadow-gold, 0 0 18px rgba(246, 184, 63, 0.28));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700; /* 必须永远盖在弹窗遮罩(600)之上，不然录音中会点不到它，之前就是卡在这里 */
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  --audio-level: 0; /* 由 voiceOrder.js 实时读麦克风音量写入，0~1 */
}
.voice-fab-icon {
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 1; /* 盖在下面的音量光环之上，图标不能被光环挡住 */
}
.voice-fab.is-recording {
  background: linear-gradient(135deg, #ff6b4a 0%, var(--status-danger, #ff4d4f) 100%);
  color: #fff;
  border-color: transparent;
}
/* 两层光环跟着 --audio-level 实时缩放/变淡，说话声音越大光环跳得越明显，
   跟固定节奏的 CSS 动画不一样——这是真的在跟着麦克风电平走（Siri 那种感觉）。
   没在录音时两层都是 scale(1) + opacity:0，完全不可见，不影响按钮平时的样子。 */
.voice-fab::before,
.voice-fab::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 77, 79, 0.7);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
}
.voice-fab.is-recording::before {
  opacity: calc(0.15 + var(--audio-level) * 0.55);
  transform: scale(calc(1 + var(--audio-level) * 0.35));
  transition: transform 0.06s ease-out, opacity 0.06s ease-out;
}
.voice-fab.is-recording::after {
  opacity: calc((0.15 + var(--audio-level) * 0.55) * 0.5);
  transform: scale(calc(1 + var(--audio-level) * 0.75));
  transition: transform 0.09s ease-out, opacity 0.09s ease-out;
}

.voice-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 600;
}
.voice-modal-mask.is-open { display: flex; }
.voice-modal {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 78vh;
  overflow-y: auto;
}
.voice-modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}
.voice-modal-status {
  font-size: 14px;
  color: #888;
  text-align: center;
  padding: 24px 0;
}
.voice-modal-transcript {
  background: #f6f6f6;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #555;
  margin-bottom: 10px;
}
.voice-modal-reply {
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
  line-height: 1.5;
}
.voice-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
.voice-item-row:last-child { border-bottom: none; }
.voice-item-qty { color: #ff6b4a; font-weight: 600; }
.voice-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.voice-modal-actions button {
  flex: 1;
  padding: 12px 0;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-voice-cancel { background: #f0f0f0; color: #555; }
.btn-voice-confirm { background: #ff3d2e; color: #fff; }


.voice-status-pill {
  position: fixed;
  right: 16px;
  /* 悬浮在麦克风按钮正上方，同样要跟着 safe-area 一起偏移，并且留出比麦克风
     按钮本身更大的间距，避开同样有 safe-area 偏移的 WhatsApp 悬浮按钮。 */
  bottom: calc(210px + env(safe-area-inset-bottom));
  max-width: 240px;
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  z-index: 690; /* 比麦克风按钮低一点，比其他内容高，遮罩关掉时也看得到 */
  display: none;
  text-align: right;
}
.voice-status-pill.is-open { display: block; }
