/* ===== Call Styles ===== */

/* ページレイアウト */
.call-page-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.call-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* コンタクトグリッド */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s;
}

.contact-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108,99,255,0.15);
}

.contact-card .user-avatar {
  margin: 0 auto 12px;
}

.contact-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.contact-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.contact-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================
   通話画面（フルスクリーン）
   ============================ */
.call-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}

.call-screen-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #0d0d1f 0%, #1a1040 50%, #0a1a1a 100%);
  z-index: 0;
}

/* ============================
   音声通話レイアウト
   ============================ */
.call-screen-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
}

/* アバターリング */
.call-avatar-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 4px;
  animation: callRingPulse 2s ease-in-out infinite;
}

@keyframes callRingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108,99,255,0.5); }
  50%       { box-shadow: 0 0 0 24px rgba(108,99,255,0); }
}

.call-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-card);
  border: 4px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 700;
  color: white;
  overflow: hidden;
}

.call-avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.call-username {
  font-size: 26px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.call-timer {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

/* ============================
   ビデオ通話レイアウト
   ============================ */
.call-video-fullscreen {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

/* 相手の映像（大きく表示） */
.call-remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

/* 自分の映像（右下にPiP） */
.call-local-pip {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 140px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  background: #222;
  z-index: 10;
  cursor: pointer;
  transition: transform 0.2s;
}

.call-local-pip:hover {
  transform: scale(1.05);
}

/* 映像の上のオーバーレイ（名前・タイマー） */
.call-video-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.call-video-overlay .call-username {
  font-size: 18px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.call-video-overlay .call-timer {
  font-size: 15px;
}

/* ============================
   コントロールバー（共通）
   ============================ */
.call-controls {
  position: relative;
  z-index: 10;
  padding: 20px 24px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.call-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
  background: rgba(255,255,255,0.15);
  color: white;
  backdrop-filter: blur(8px);
}

.call-btn:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,0.25);
}

.call-btn.active {
  background: rgba(255,179,71,0.4);
}

/* 終了ボタン */
.call-btn.end {
  width: 72px;
  height: 72px;
  font-size: 28px;
  background: var(--danger);
  box-shadow: 0 4px 20px rgba(255,71,87,0.5);
}

.call-btn.end:hover {
  background: #ff2040;
  transform: scale(1.12);
}

/* ============================
   着信UI
   ============================ */
.incoming-call {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 18px 20px;
  z-index: 6000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 24px rgba(108,99,255,0.3);
  min-width: 280px;
  animation: slideInRight 0.3s ease;
}

.incoming-call-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-light);
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 12px;
  animation: fadeInOut 1.2s ease infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

.incoming-call-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.incoming-call-name {
  font-size: 17px;
  font-weight: 800;
}

.incoming-call-type {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.incoming-call-actions {
  display: flex;
  gap: 12px;
}

.call-accept-btn {
  flex: 1;
  padding: 12px;
  background: linear-gradient(135deg, var(--success), #2fb88e);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  font-family: inherit;
}

.call-accept-btn:hover { transform: scale(1.04); }

.call-reject-btn {
  flex: 1;
  padding: 12px;
  background: var(--danger);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  font-family: inherit;
}

.call-reject-btn:hover { transform: scale(1.04); }

/* ============================
   レスポンシブ
   ============================ */
@media (max-width: 640px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .call-local-pip {
    width: 100px;
    height: 72px;
    bottom: 12px;
    right: 12px;
  }

  .incoming-call {
    top: auto;
    bottom: 20px;
    right: 12px;
    left: 12px;
    min-width: unset;
  }
}
