:root {
  --bg-main: #f5f5f7;
  --bg-card: #ffffff;
  --border-subtle: #e0e0e5;
  --text-main: #111111;
  --text-subtle: #6e6e73;
  --primary: #007aff;
  --primary-hover: #0a84ff;
  --danger: #ff3b30;
  --danger-hover: #ff453a;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.08);
  --radius-card: 18px;
  --radius-button: 999px;
  --transition-fast: all 0.2s ease;
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at top left, #fdfbff 0, #f5f5f7 45%, #ececf1 100%);
  color: var(--text-main);
  display: block;
  height: 100vh;
  overflow-x: hidden;
}

#app-root {
  width: 100%;
  height: 100%;
}

.bg-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%230ea5e9' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* 输入框自动填充背景色处理 */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  min-height: 0;
}

.glass-panel-hero {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.softphone-layout {
  background: #f1f5f9;
}

.blob {
  position: absolute;
  filter: blur(90px);
  z-index: -1;
  opacity: 0.6;
}

.dial-btn:active {
  transform: scale(0.96);
}

.dialpad-grid button {
  height: auto !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ================= 移动端样式 ================= */
/* 移动端页面容器 */
.mobile-page {
  display: none !important;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.mobile-page.active {
  display: flex !important;
  flex-direction: column;
}

/* 确保移动端布局只在移动端显示 */
@media (min-width: 1024px) {
  .mobile-page,
  .mobile-page.active {
    display: none !important;
  }
}

/* 确保桌面端布局只在桌面端显示 */
@media (max-width: 1023px) {
  header.hidden.lg\:flex,
  main.hidden.lg\:grid {
    display: none !important;
  }
}

/* 底部导航栏样式 */
.mobile-nav-item {
  color: #64748b;
}

.mobile-nav-item.active {
  color: #0ea5e9;
}

.mobile-nav-item.active svg {
  color: #0ea5e9;
}

.mobile-nav-item.active span {
  color: #0ea5e9;
}

.mobile-nav-item:not(.active) svg {
  color: #94a3b8;
}

.mobile-nav-item:not(.active) span {
  color: #94a3b8;
}

/* 移动端触摸优化 */
@media (max-width: 1023px) {
  .dial-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  
  button {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
}

/* 移动端通话记录卡片样式 */
.mobile-call-log-item {
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.2s;
}

.mobile-call-log-item[data-peer-number]:active {
  background: #f1f5f9;
}

.mobile-call-log-item[data-peer-number]:hover {
  background: #f8fafc;
}

/* 移动端滚动优化 */
@media (max-width: 1023px) {
  /* 确保移动端可以滚动 */
  .mobile-page {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* 通话记录容器滚动优化 */
  #mobileCallLogsContainer {
    min-height: fit-content;
  }
  
  /* 确保移动端页面容器有正确的高度 */
  #mobilePagesContainer {
    position: relative;
    height: 100%;
    overflow: visible;
  }
  
  /* 通话记录滚动区域 */
  #mobilePageLogs .flex-1 {
    position: relative;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ====================================================
   来电弹窗 - 毛玻璃效果
   ==================================================== */

/* 全屏遮罩层 - 毛玻璃背景 */
.incoming-call-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  
  /* 核心：背景模糊处理 */
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  
  display: flex;
  justify-content: center;
  align-items: center;
  
  /* 淡入动画 */
  animation: fadeIn 0.3s ease-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.incoming-call-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 呼叫卡片 - 毛玻璃效果 */
.call-card {
  position: relative;
  width: 360px;
  padding: 40px 30px;
  border-radius: 24px;
  text-align: center;
  
  /* 毛玻璃核心样式 */
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  
  /* 动画 */
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.call-card.active {
  transform: scale(1);
  opacity: 1;
}

/* 头像区域与动画 */
.avatar-container {
  position: relative;
  margin: 0 auto 20px;
  width: 80px;
  height: 80px;
}

.avatar-circle {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0eafc, #cfdef3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 2;
  position: relative;
}

/* 波纹扩散动画 */
.ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: ripple 1.5s infinite;
  z-index: 1;
}

.ripple:nth-child(2) {
  animation-delay: 0.4s;
}

/* 文字信息 */
.caller-info h2.incoming-number {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.caller-info .incoming-label {
  margin: 8px 0 30px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
}

.btn-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  color: white;
}

.btn-circle:active {
  transform: scale(0.95);
}

.btn-circle:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* 拒接按钮 */
.btn-reject {
  background: linear-gradient(135deg, #ff6b6b, #ee5253);
  box-shadow: 0 4px 12px rgba(238, 82, 83, 0.3);
}

/* 接听按钮 */
.btn-answer {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  box-shadow: 0 4px 12px rgba(16, 172, 132, 0.3);
  animation: bounce 2s infinite;
}

.btn-label {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #666;
}

.btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 关键帧动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes ripple {
  0% {
    width: 80px;
    height: 80px;
    opacity: 0.8;
    border: 1px solid rgba(255,255,255,0.5);
  }
  100% {
    width: 160px;
    height: 160px;
    opacity: 0;
    border: 1px solid rgba(255,255,255,0);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
  60% {
    transform: translateY(-3px);
  }
}

/* .hidden 类由 Tailwind CSS 提供，不需要自定义 */
/* 如果需要强制隐藏，可以使用 Tailwind 的 hidden 类 */

.btn {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* 拨号输入框优化样式 */
.dial-input {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0.1em;
  border-bottom-width: 2px;
}

.dial-input:focus {
  border-bottom-width: 3px;
  border-color: #0ea5e9;
  transform: translateY(-1px);
}

.dial-input:focus + .dial-input-underline,
.dial-input:not(:placeholder-shown) + .dial-input-underline {
  opacity: 1;
}

.dial-input::placeholder {
  font-weight: 400;
  letter-spacing: 0.05em;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.dial-input:focus::placeholder {
  opacity: 0.3;
}

/* KPI 卡片样式 */
.kpi-card {
  transition: all 0.3s ease;
  position: relative;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.kpi-card-outbound {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 249, 255, 0.95) 100%);
}

.kpi-card-outbound .kpi-icon-wrapper {
  color: #0ea5e9; /* medical-500 实色 */
}

.kpi-card-rate {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 253, 250, 0.95) 100%);
}

.kpi-card-rate .kpi-icon-wrapper {
  color: #2dd4bf; /* teal-400 实色 */
}

.kpi-card-duration {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
}

.kpi-card-duration .kpi-icon-wrapper {
  color: #8b5cf6; /* purple-500 实色，符合医疗科技风格 */
}

.kpi-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-wrapper svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.kpi-progress-bar {
  position: relative;
  overflow: hidden;
}