/* OLIMP CALL — Telegram style */

.call-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
}

.call-modal.active { display: flex; }

.call-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.35);
  transform: scale(1.15);
  z-index: 0;
}

.call-bg.no-img { background: linear-gradient(160deg, #1a3a52 0%, #0a1a2a 100%); }

.call-video-remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  z-index: 1;
  display: none;
}

.call-modal.has-video .call-video-remote { display: block; }

.call-video-local {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 110px;
  height: 160px;
  border-radius: 12px;
  object-fit: cover;
  background: #222;
  z-index: 5;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transform: scaleX(-1);
  display: none;
}

.call-modal.has-video .call-video-local { display: block; }

.call-header {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3;
  pointer-events: none;
}

.call-avatar-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
}

.call-avatar-wrap::before,
.call-avatar-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  animation: callPulse 2s ease-out infinite;
}

.call-avatar-wrap::after { animation-delay: 1s; }

@keyframes callPulse {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0;   }
}

.call-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b5278, #1e3a5f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  font-weight: 300;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  position: relative;
  z-index: 2;
}

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

.call-nick {
  font-size: 26px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.call-status {
  font-size: 15px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.call-timer {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  z-index: 4;
  letter-spacing: 1px;
  display: none;
}

.call-modal.in-call .call-timer { display: block; }

.call-controls {
  position: absolute;
  bottom: 40px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  z-index: 6;
}

.call-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.call-btn:active { transform: scale(0.92); }

.call-btn.green {
  background: #4caf50;
  width: 72px;
  height: 72px;
  font-size: 30px;
}

.call-btn.red {
  background: #f44336;
  width: 72px;
  height: 72px;
  font-size: 30px;
}

.call-btn.off {
  background: #fff;
  color: #000;
}

.call-buttons-row {
  position: absolute;
  bottom: 130px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  z-index: 6;
}

.call-modal.in-call .call-header { top: 50%; transform: translateY(-50%); }

/* В активном звонке — скрываем аватар/ник/статус */
.call-modal.in-call .call-header {
  display: none !important;
}

/* === ИНДИКАТОР КАЧЕСТВА (как в ТГ) === */
.call-quality {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 20px;
  z-index: 7;
  opacity: 0.9;
}

.call-quality span {
  display: block;
  width: 4px;
  background: rgba(255,255,255,0.35);
  border-radius: 1px;
  transition: background 0.3s, opacity 0.3s;
}

.call-quality span:nth-child(1) { height: 6px; }
.call-quality span:nth-child(2) { height: 11px; }
.call-quality span:nth-child(3) { height: 15px; }
.call-quality span:nth-child(4) { height: 20px; }

/* Низкое качество (1 полоска) */
.call-quality[data-bars="1"] span:nth-child(1) { background: #f44336; }
.call-quality[data-bars="1"] span:nth-child(n+2) { opacity: 0.25; background: #fff; }

/* Среднее (2 полоски) */
.call-quality[data-bars="2"] span:nth-child(-n+2) { background: #ff9800; }
.call-quality[data-bars="2"] span:nth-child(n+3) { opacity: 0.25; background: #fff; }

/* Хорошее (3 полоски) */
.call-quality[data-bars="3"] span:nth-child(-n+3) { background: #4caf50; }
.call-quality[data-bars="3"] span:nth-child(n+4) { opacity: 0.25; background: #fff; }

/* Отличное (4 полоски) */
.call-quality[data-bars="4"] span { background: #4caf50; }
