/* ==========================================================
 * video-call.css
 * 视频通话窗口（与 voice-call.css 配合使用）
 * 复用 voice-call 的字幕/输入条/控制条逻辑，主要差异是：
 *   - 大画面占满整个窗口（contact 头像/AI 视觉）
 *   - 自己摄像头作为 PIP（画中画）悬浮右上角
 *   - 字幕浮在画面底部，半透明黑底
 *   - 多了"给TA看一眼"按钮（拍照）
 * ========================================================== */

/* ============ 视频通话覆盖层（独立 ID，避免和语音通话冲突） ============ */
.video-call-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  background: #000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.video-call-overlay.show {
  visibility: visible;
  opacity: 1;
  transition: opacity .25s ease;
}

/* 整个视频窗 */
.video-call-window {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  background: #000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============ 主画面（联系人/AI 一侧的画面） ============ */
.video-call-main {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #000;
  overflow: hidden;
}
.video-call-main .vc-main-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 极慢的呼吸缩放，模拟视频信号 */
  animation: vcMainBreath 8s ease-in-out infinite;
  filter: brightness(0.94);
}
@keyframes vcMainBreath {
  0%, 100% { transform: scale(1.02); }
  50% { transform: scale(1.06); }
}
/* 主画面的微妙噪点遮罩，模拟视频压缩感 */
.video-call-main::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 2;
}

/* AI 在"说话"时画面边缘微微泛光 */
.video-call-window.speaking .video-call-main::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  box-shadow: inset 0 0 80px 0 rgba(255, 200, 220, 0.35);
  animation: vcSpeakingGlow 1.6s ease-in-out infinite;
}
@keyframes vcSpeakingGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============ 顶栏 ============ */
.video-call-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
  color: #fff;
}
.video-call-topbar .vc-min-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-call-topbar .vc-min-btn svg {
  width: 18px; height: 18px; fill: currentColor;
}
.video-call-topbar .vc-info-center {
  flex: 1;
  text-align: center;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 10px;
}
.video-call-topbar .vc-name {
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.video-call-topbar .vc-status {
  font-size: 12px;
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.video-call-topbar .vc-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}
.video-call-topbar .vc-dot.connecting { background: #fbbf24; animation: vcDotPulse 1.2s infinite; }
.video-call-topbar .vc-dot.ended { background: #888; }
@keyframes vcDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============ PIP 画中画（用户头像 · 视觉装饰） ============ */
.video-call-pip {
  position: absolute;
  top: 70px;
  right: 14px;
  width: 96px;
  height: 130px;
  border-radius: 14px;
  overflow: hidden;
  z-index: 9;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(155deg, #2a2f4a 0%, #1a1c2c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-call-pip .vc-pip-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}
.video-call-pip .vc-pip-avatar-glow {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.18) 0%, transparent 55%),
    radial-gradient(80% 60% at 50% 100%, rgba(124, 138, 212, 0.28) 0%, transparent 60%);
  mix-blend-mode: screen;
  animation: vcPipBreath 3.6s ease-in-out infinite;
}
@keyframes vcPipBreath {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* ============ 字幕（浮在底部，半透明） ============ */
.video-call-subtitle {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 200px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 38vh;
  overflow-y: auto;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 30%);
}
.video-call-subtitle::-webkit-scrollbar { display: none; }
.video-call-subtitle .vc-sub-line {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: #fff;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 90%;
  word-break: break-word;
  align-self: flex-start;
  pointer-events: auto;
}
.video-call-subtitle .vc-sub-line.me {
  align-self: flex-end;
  background: rgba(80, 130, 230, 0.7);
}
.video-call-subtitle .vc-sub-speaker {
  font-size: 11px;
  opacity: 0.7;
  margin-right: 6px;
}

/* ============ 底部输入区（按住说话 / 打字） ============ */
.video-call-input-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 110px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border-radius: 28px;
}
.video-call-input-bar.disabled {
  opacity: 0.6;
  pointer-events: none;
}
.video-call-input-bar.mode-text .vc-hold-talk-btn { display: none; }
.video-call-input-bar.mode-voice .vc-input-text-wrap { display: none; }

.video-call-input-bar .vc-input-mode-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.video-call-input-bar .vc-input-mode-btn svg {
  width: 20px; height: 20px; fill: currentColor;
  display: none;
}
.video-call-input-bar.mode-voice .vc-input-mode-btn .vc-mode-keyboard,
.video-call-input-bar.mode-text .vc-input-mode-btn .vc-mode-voice {
  display: block;
}

.video-call-input-bar .vc-hold-talk-btn {
  flex: 1;
  height: 40px;
  border-radius: 20px;
  background: rgba(255,255,255,0.18);
  border: 0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.video-call-input-bar .vc-hold-talk-btn:active,
.video-call-input-bar .vc-hold-talk-btn.recording {
  background: rgba(80, 130, 230, 0.6);
}
.video-call-input-bar .vc-input-text-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
}
.video-call-input-bar .vc-input-text {
  flex: 1;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.video-call-input-bar .vc-input-text::placeholder {
  color: rgba(255,255,255,0.5);
}
.video-call-input-bar .vc-input-send-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(80, 130, 230, 0.9);
  border: 0;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-call-input-bar .vc-input-send-btn svg {
  width: 16px; height: 16px; fill: currentColor;
}

/* ============ 控制条（挂断 + 拍照 + 切换） ============ */
.video-call-controls {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  z-index: 11;
  padding: 18px 20px 28px;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 60%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.video-call-controls .vc-ctrl-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.18);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
}
.video-call-controls .vc-ctrl-btn svg {
  width: 22px; height: 22px; fill: currentColor;
}
.video-call-controls .vc-ctrl-btn .vc-ctrl-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.video-call-controls .vc-ctrl-btn.hangup {
  background: #ef4444;
}
.video-call-controls .vc-ctrl-btn.hangup svg {
  transform: rotate(135deg);
}
.video-call-controls .vc-ctrl-btn.peek {
  background: linear-gradient(135deg, #ff8a8a, #e85780);
}

/* ============ 拍照预览模态 ============ */
.video-call-peek-modal {
  position: fixed;
  inset: 0;
  z-index: 100040;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.video-call-peek-modal.show { display: flex; }
.video-call-peek-modal .vc-peek-card {
  width: 100%;
  max-width: 360px;
  background: #1f2026;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-call-peek-modal .vc-peek-img-wrap {
  width: 100%;
  aspect-ratio: 3/4;
  background: #000;
  position: relative;
  overflow: hidden;
}
.video-call-peek-modal .vc-peek-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-call-peek-modal .vc-peek-form {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.video-call-peek-modal .vc-peek-caption {
  background: rgba(255,255,255,0.06);
  color: #efeae0;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 60px;
}
.video-call-peek-modal .vc-peek-caption::placeholder {
  color: rgba(255,255,255,0.35);
}
.video-call-peek-modal .vc-peek-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.video-call-peek-modal .vc-peek-actions button {
  border: 0;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
}
.video-call-peek-modal .vc-peek-cancel {
  background: rgba(255,255,255,0.08);
  color: #ddd;
}
.video-call-peek-modal .vc-peek-send {
  background: linear-gradient(135deg, #5fb8ff, #5180e8);
  color: #fff;
}
.video-call-peek-modal .vc-peek-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ 最小化浮窗（WeChat 风格小矩形） ============ */
.video-call-bubble {
  position: fixed;
  top: 80px;
  right: 16px;
  width: 96px;
  height: 128px;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1c2c;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  z-index: 100030;
  cursor: grab;
  display: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease;
}
.video-call-bubble.show { display: block; }
.video-call-bubble.dragging { cursor: grabbing; transition: none; }
.video-call-bubble:active { transform: scale(0.96); }

.video-call-bubble .vcb-avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 极慢的呼吸缩放，让小窗也"活着" */
  animation: vcbBreath 6s ease-in-out infinite;
}
@keyframes vcbBreath {
  0%, 100% { transform: scale(1.04); }
  50%      { transform: scale(1.10); }
}

.video-call-bubble .vcb-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

.video-call-bubble .vcb-info {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.video-call-bubble .vcb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.9);
  animation: vcbDotPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes vcbDotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.video-call-bubble .vcb-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-call-bubble .vcb-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  z-index: 2;
}
.video-call-bubble .vcb-close:hover {
  background: #ef4444;
}

/* "正在拍摄" 闪光特效 */
.video-call-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 100050;
  pointer-events: none;
  opacity: 0;
}
.video-call-flash.flashing {
  animation: vcFlash .35s ease-out;
}
@keyframes vcFlash {
  0% { opacity: 0; }
  10% { opacity: 0.85; }
  100% { opacity: 0; }
}
