/* ========================================
   语音通话界面样式
   ======================================== */

/* ---- 全屏遮罩 ---- */
.voice-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  overflow: hidden;
}
.voice-call-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* 毛玻璃背景层 */
.voice-call-overlay__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(60px) brightness(0.3) saturate(1.4);
  transform: scale(1.2);
  z-index: 0;
}

.voice-call-overlay__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-width: 480px;
}

/* ---- 顶部区域 ---- */
.voice-call-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 48px;
  flex-shrink: 0;
}

.voice-call-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.voice-call-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.voice-call-avatar__placeholder {
  font-size: 36px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}

.voice-call-name {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
  text-align: center;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-call-status {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 6px;
}
.voice-call-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: vcPulse 2s ease-in-out infinite;
}
@keyframes vcPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- 中间字幕区（可滚动聊天记录） ---- */
.voice-call-subtitle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  padding: 20px 5% 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
}

.voice-call-subtitle__text {
  font-size: 17px;
  line-height: 1.7;
  color: rgba(255,255,255,0.88);
  text-align: center;
  max-width: 86%;
  word-break: break-word;
  white-space: pre-wrap;
  align-self: center;
}

.voice-call-subtitle__text--empty {
  color: rgba(255,255,255,0.4);
  font-size: 15px;
  margin-top: auto;
  margin-bottom: auto;
}

.voice-call-subtitle__text--error {
  color: rgba(255,120,120,0.85);
  font-size: 14px;
}

/* ---- 通话消息气泡 ---- */
.voice-call-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 用户消息 — 右对齐，黑白灰色调 */
.voice-call-msg--user {
  align-self: flex-end;
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.92);
  border-bottom-right-radius: 4px;
}

/* AI 消息 — 左对齐 */
.voice-call-msg--ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
  border-bottom-left-radius: 4px;
  margin-bottom: 2px;
}

/* AI 回复块容器 */
.voice-call-ai-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* AI 消息内部布局（文本 + 回放按钮） */
.voice-call-msg--ai {
  display: flex;
  align-items: center;
  gap: 6px;
}
.voice-call-msg__text {
  flex: 1;
  min-width: 0;
}

/* 回放按钮 */
.voice-call-msg__replay {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  padding: 0;
}
.voice-call-msg__replay:hover {
  background: rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.9);
}
.voice-call-msg__replay:active {
  transform: scale(0.85);
}
.voice-call-msg__replay.is-playing {
  background: rgba(74,222,128,0.25);
  color: #4ade80;
}
.voice-call-msg__replay.is-loading {
  opacity: 0.5;
  pointer-events: none;
  animation: vcReplayLoading 0.8s ease-in-out infinite;
}
@keyframes vcReplayLoading {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.2; }
}

/* 错误消息 */
.voice-call-msg--error {
  align-self: center;
  background: rgba(255,80,80,0.15);
  color: rgba(255,140,140,0.9);
  font-size: 14px;
  border-radius: 12px;
  text-align: center;
}

/* loading 容器 */
.voice-call-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 0;
}

/* loading 三点动画 */
.voice-call-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}
.voice-call-loading__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  animation: vcBounce 1.4s ease-in-out infinite;
}
.voice-call-loading__dot:nth-child(2) { animation-delay: 0.16s; }
.voice-call-loading__dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes vcBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.voice-call-loading__label {
  font-size: 14px;
  color: rgba(255,255,255,0.45);
  margin-top: 10px;
}

/* ---- 底部按钮区 ---- */
.voice-call-bottom {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 20px 0 12px;
}

.voice-call-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.15s ease;
}
.voice-call-btn:active {
  transform: scale(0.9);
}

.voice-call-btn__circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
}
.voice-call-btn__circle svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-call-btn__label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

/* 说话按钮 */
.voice-call-btn--speak .voice-call-btn__circle {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.voice-call-btn--speak.is-loading .voice-call-btn__circle {
  opacity: 0.5;
  pointer-events: none;
}

/* 挂断按钮 */
.voice-call-btn--hangup .voice-call-btn__circle {
  background: #ef4444;
  box-shadow: 0 4px 16px rgba(239,68,68,0.4);
}
.voice-call-btn--hangup .voice-call-btn__circle svg {
  transform: rotate(135deg);
}

/* 重新生成按钮 */
.voice-call-btn--regen .voice-call-btn__circle {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.voice-call-btn--regen.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ---- 输入面板 ---- */
.voice-call-input-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: rgba(28,28,30,0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  display: none;
}
.voice-call-input-panel.is-active {
  transform: translateY(0);
}

.voice-call-input-panel__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.voice-call-input-panel__field {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 15px;
  color: #fff;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  font-family: inherit;
}
.voice-call-input-panel__field::placeholder {
  color: rgba(255,255,255,0.3);
}

.voice-call-input-panel__send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #3b82f6;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}
.voice-call-input-panel__send:active {
  transform: scale(0.9);
}
.voice-call-input-panel__send:disabled {
  opacity: 0.4;
  pointer-events: none;
}
.voice-call-input-panel__send svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-call-input-panel__cancel {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 4px;
  margin-top: 6px;
  text-align: center;
  width: 100%;
}

/* ---- 逐句显示动画行 ---- */
.voice-call-subtitle__line {
  margin-bottom: 6px;
}

/* ---- 聊天气泡中的语音通话结束卡片 ---- */
.chat-voicecall-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-width: 160px;
}
.chat-voicecall-card__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.7;
}
.chat-voicecall-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-voicecall-card__label {
  font-size: 14px;
  font-weight: 500;
}
.chat-voicecall-card__duration {
  font-size: 12px;
  opacity: 0.55;
}

/* ========================================
   视频通话模式差异化样式
   ======================================== */

/* 视频模式背景 — 偏暖色调 */
.voice-call-overlay.is-video-mode {
  background: linear-gradient(145deg, #1a1520 0%, #2d1b3e 40%, #3b1f5e 100%);
}

/* 视频模式状态点 — 蓝色 */
.voice-call-overlay.is-video-mode .voice-call-status__dot {
  background: #60a5fa;
}

/* 视频模式头像 — 稍大 + 视频边框 */
.voice-call-overlay.is-video-mode .voice-call-avatar {
  width: 110px;
  height: 110px;
  box-shadow: 0 4px 24px rgba(100,60,180,0.35), 0 0 0 2px rgba(139,92,246,0.3);
}

/* 视频模式发送按钮 — 紫色调 */
.voice-call-overlay.is-video-mode .voice-call-input-panel__send {
  background: #7c3aed;
}

/* 视频模式画面描写（括号内容）— 斜体、柔和色调 */
.voice-call-msg--scene {
  font-style: italic;
  color: rgba(200,180,255,0.75) !important;
  background: rgba(139,92,246,0.08) !important;
  border-left: 2px solid rgba(139,92,246,0.3);
  padding-left: 12px;
  font-size: 14px;
  line-height: 1.7;
}

/* ========================================
   来电接听界面
   ======================================== */
.voice-call-incoming {
  position: fixed;
  inset: 0;
  z-index: 8100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow: hidden;
}
.voice-call-incoming.is-active {
  opacity: 1;
  pointer-events: auto;
}
.voice-call-incoming.is-video-mode {
  background: linear-gradient(160deg, #1a1520 0%, #2d1b3e 50%, #1a1520 100%);
}

.voice-call-incoming__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(80px) brightness(0.2) saturate(1.2);
  transform: scale(1.3);
  z-index: 0;
}

.voice-call-incoming__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* 头像 + 呼吸动画 */
.voice-call-incoming__avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 0 rgba(59,130,246,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: vcIncomingPulse 2s ease-in-out infinite;
}
.voice-call-incoming.is-video-mode .voice-call-incoming__avatar {
  box-shadow: 0 0 0 0 rgba(139,92,246,0.4);
  animation: vcIncomingPulseVideo 2s ease-in-out infinite;
}
@keyframes vcIncomingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
  50% { box-shadow: 0 0 0 18px rgba(59,130,246,0); }
}
@keyframes vcIncomingPulseVideo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,92,246,0.4); }
  50% { box-shadow: 0 0 0 18px rgba(139,92,246,0); }
}
.voice-call-incoming__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.voice-call-incoming__avatar-ph {
  font-size: 40px;
  color: rgba(255,255,255,0.6);
  font-weight: 600;
}

.voice-call-incoming__name {
  font-size: 22px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  margin-top: 8px;
}

.voice-call-incoming__label {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 40px;
}

/* 按钮区 */
.voice-call-incoming__actions {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.voice-call-incoming__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.15s ease;
}
.voice-call-incoming__btn:active {
  transform: scale(0.9);
}

.voice-call-incoming__btn-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
}
.voice-call-incoming__btn-circle svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-call-incoming__btn-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}

/* 挂断 — 红色 */
.voice-call-incoming__btn--decline .voice-call-incoming__btn-circle {
  background: #ef4444;
  box-shadow: 0 4px 20px rgba(239,68,68,0.4);
}
.voice-call-incoming__btn--decline .voice-call-incoming__btn-circle svg {
  transform: rotate(135deg);
}

/* 接听 — 绿色 */
.voice-call-incoming__btn--accept .voice-call-incoming__btn-circle {
  background: #22c55e;
  box-shadow: 0 4px 20px rgba(34,197,94,0.4);
}

/* ========================================
   呼叫中界面（复用 incoming 样式）
   ======================================== */
.voice-call-outgoing .voice-call-incoming__label {
  animation: vcOutgoingDots 1.5s steps(4, end) infinite;
}
@keyframes vcOutgoingDots {
  0% { content: '正在呼叫'; }
  25% { content: '正在呼叫.'; }
  50% { content: '正在呼叫..'; }
  75% { content: '正在呼叫...'; }
}

/* ========================================
   通话卡片 — 拒绝/取消状态
   ======================================== */
.chat-voicecall-card--declined .chat-voicecall-card__icon,
.chat-voicecall-card--cancelled .chat-voicecall-card__icon {
  opacity: 0.45;
}
.chat-voicecall-card--declined .chat-voicecall-card__duration,
.chat-voicecall-card--cancelled .chat-voicecall-card__duration {
  opacity: 0.55;
}

/* ========================================
   小窗缩小按钮
   ======================================== */
.voice-call-minimize-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.voice-call-minimize-btn:hover {
  background: rgba(255,255,255,0.2);
}
.voice-call-minimize-btn:active {
  transform: scale(0.9);
}

/* ========================================
   小窗模式 — 全屏 overlay 隐藏
   ======================================== */
.voice-call-overlay.is-minimized {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ========================================
   小窗悬浮组件
   ======================================== */
.voice-call-mini-widget {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(20, 20, 30, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 48px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: box-shadow 0.2s, transform 0.15s;
  animation: vcMiniSlideIn 0.35s ease;
}
.voice-call-mini-widget:hover {
  box-shadow: 0 6px 32px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.12);
}
@keyframes vcMiniSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.voice-call-mini-widget__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
}
.voice-call-mini-widget__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.voice-call-mini-widget__avatar--group {
  background: rgba(59,130,246,0.2);
  color: rgba(59,130,246,0.9);
}

.voice-call-mini-widget__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.voice-call-mini-widget__name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.voice-call-mini-widget__status {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 4px;
}
.voice-call-mini-widget__status svg {
  color: #4ade80;
  flex-shrink: 0;
}

.voice-call-mini-widget__expand,
.voice-call-mini-widget__hangup {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.voice-call-mini-widget__expand {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}
.voice-call-mini-widget__expand:hover {
  background: rgba(255,255,255,0.18);
}
.voice-call-mini-widget__expand:active {
  transform: scale(0.9);
}
.voice-call-mini-widget__hangup {
  background: #ef4444;
  color: #fff;
}
.voice-call-mini-widget__hangup:hover {
  background: #dc2626;
}
.voice-call-mini-widget__hangup:active {
  transform: scale(0.9);
}
.voice-call-mini-widget__hangup svg {
  transform: rotate(135deg);
}

/* 小窗呼吸动画 — 表示通话进行中 */
.voice-call-mini-widget::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50px;
  background: linear-gradient(135deg, rgba(74,222,128,0.3), rgba(59,130,246,0.3));
  z-index: -1;
  animation: vcMiniGlow 3s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes vcMiniGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.02); }
}
