/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 视频容器 */
.video-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #1a1a1a;
}

/* 远程视频（全屏） */
.remote-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #000;
}

/* 本地视频（小窗口） */
.local-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: #333;
  z-index: 10;
}

.local-video.mirrored {
  transform: scaleX(-1);
}

/* 视频位置交换 */
.video-container.swapped .remote-video {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.video-container.swapped .local-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
}


/* 来电界面 */
.incoming-call {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.caller-info {
  text-align: center;
  margin-bottom: 60px;
}

.caller-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 20px;
}

.caller-name {
  font-size: 24px;
  color: #fff;
  margin-bottom: 10px;
}

.call-type-text {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
}

.incoming-actions {
  display: flex;
  justify-content: center;
  gap: 80px;
}

.btn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

.btn-action img {
  width: 60px;
  height: 60px;
  margin-bottom: 8px;
}

.btn-action span {
  font-size: 14px;
  color: #fff;
}

.btn-reject img {
  background-color: #e74c3c;
  border-radius: 50%;
  padding: 15px;
}

.btn-accept img {
  background-color: #27ae60;
  border-radius: 50%;
  padding: 15px;
}

/* 语音通话界面 */
.audio-call-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.audio-caller-info {
  text-align: center;
  margin-bottom: 40px;
}

.audio-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 20px;
}

.audio-name {
  font-size: 24px;
  color: #fff;
  margin-bottom: 10px;
}

.audio-timer {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
}

/* 音频波形动画 */
.audio-wave {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 40px;
  gap: 4px;
}

.audio-wave span {
  width: 4px;
  background-color: #3498db;
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.audio-wave span:nth-child(1) { animation-delay: 0s; height: 10px; }
.audio-wave span:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.audio-wave span:nth-child(3) { animation-delay: 0.2s; height: 30px; }
.audio-wave span:nth-child(4) { animation-delay: 0.3s; height: 20px; }
.audio-wave span:nth-child(5) { animation-delay: 0.4s; height: 10px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2); }
}


/* 连接中界面 */
.connecting-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 80;
}

.connecting-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.connecting-text {
  font-size: 16px;
  color: #fff;
}

/* 通话控制按钮 */
.call-controls {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 20;
}

.control-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.control-row.secondary {
  gap: 30px;
}

.btn-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-control:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-control:active {
  background: rgba(255, 255, 255, 0.3);
}

.btn-control.active {
  background: rgba(231, 76, 60, 0.8);
}

.btn-control img {
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
}

.btn-control span {
  font-size: 12px;
  color: #fff;
}

.btn-hangup-main {
  background: #e74c3c;
}

.btn-hangup-main:hover {
  background: #c0392b;
}

.btn-control-small {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-control-small:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-control-small:active {
  background: rgba(255, 255, 255, 0.3);
}

.btn-control-small img {
  width: 24px;
  height: 24px;
}

/* 通话计时器 */
.call-timer {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 15;
}

/* 状态指示器 */
.status-indicator {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 12px;
  border-radius: 16px;
  z-index: 15;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #27ae60;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 12px;
  color: #fff;
}

/* 调试面板 */
.debug-panel {
  position: absolute;
  top: 60px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  padding: 0;
  border-radius: 8px;
  z-index: 200;
  width: 280px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.debug-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(52, 152, 219, 0.2);
  border-radius: 8px 8px 0 0;
}

.debug-title {
  font-size: 13px;
  font-weight: bold;
  color: #3498db;
  flex: 1;
}

.debug-toggle,
.debug-clear {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 3px;
  margin-left: 4px;
}

.debug-toggle:hover,
.debug-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.debug-status {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-item {
  font-size: 11px;
  color: #fff;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}

.debug-item:last-child {
  margin-bottom: 0;
}

.debug-logs {
  flex: 1;
  overflow-y: auto;
  max-height: 200px;
  padding: 8px;
  font-size: 10px;
}

.debug-log-item {
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 2px;
  word-break: break-all;
  line-height: 1.4;
}

.debug-log-item.log-debug {
  color: rgba(255, 255, 255, 0.7);
}

.debug-log-item.log-warn {
  color: #f39c12;
  background: rgba(243, 156, 18, 0.1);
}

.debug-log-item.log-error {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.debug-log-item .log-time {
  color: rgba(255, 255, 255, 0.4);
  margin-right: 4px;
}

.debug-log-item .log-tag {
  color: #3498db;
  margin-right: 4px;
}

.debug-log-item .log-msg {
  color: inherit;
}

/* 调试面板收起状态 */
.debug-panel.collapsed .debug-logs {
  display: none;
}

.debug-panel.collapsed .debug-toggle {
  transform: rotate(-90deg);
}

/* 调试面板滚动条样式 */
.debug-logs::-webkit-scrollbar {
  width: 4px;
}

.debug-logs::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.debug-logs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.debug-logs::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
