/**
 * Стили для страницы видеозвонков
 * Фирменный стиль сайта
 */

/* Контейнер страницы */
.videocall {
  padding: 30px 20px;
  min-height: calc(100vh - 160px);
}

.videocall__title {
  font-family: var(--medium-font);
  font-size: 24px;
  line-height: 32px;
  margin-bottom: 30px;
  color: #232427;
}

/* Форма создания/присоединения */
.videocall__form {
  background-color: #FFF;
  border-radius: 8px;
  padding: 30px;
  max-width: 500px;
  box-shadow: 0 2px 10px rgba(155, 178, 190, .15);
}

.videocall__form-title {
  font-family: var(--medium-font);
  font-size: 18px;
  margin-bottom: 20px;
  color: #232427;
}

.videocall__input-group {
  margin-bottom: 20px;
}

.videocall__input-group label {
  display: block;
  font-family: var(--medium-font);
  font-size: 14px;
  color: #7C90A0;
  margin-bottom: 8px;
}

.videocall__input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #E2E9ED;
  border-radius: 6px;
  font-family: var(--regular-font);
  font-size: 16px;
  transition: border-color .3s;
}

.videocall__input-group input:focus {
  outline: none;
  border-color: var(--main-color);
}

.videocall__buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.videocall__buttons .base-btn {
  flex: 1;
  min-width: 150px;
}

/* Сообщение об ошибке */
.videocall__error {
  background-color: #FEE;
  border: 1px solid #FCC;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #C33;
  font-size: 14px;
}

/* Контейнер видеозвонка */
.videocall__container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.videocall__room-info {
  background-color: #FFF;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(155, 178, 190, .15);
}

.videocall__room-name {
  font-family: var(--medium-font);
  font-size: 16px;
  color: #232427;
}

.videocall__room-name span {
  color: var(--main-color);
  font-family: var(--bold-font);
}

.videocall__participants {
  font-size: 14px;
  color: #7C90A0;
}

.videocall__copy-link {
  color: var(--main-color);
  font-family: var(--medium-font);
  font-size: 14px;
  cursor: pointer;
  transition: color .3s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.videocall__copy-link:hover {
  color: var(--dark-color);
}

/* Видео контейнер */
.videocall__videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.videocall__local-video-container {
  position: relative;
  background-color: #1A1A1A;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
  min-height: 200px;
}

.videocall__local-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  /* Зеркальное отражение для себя */
}

.videocall__local-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, .6);
  color: #FFF;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--medium-font);
  z-index: 15;
}

.videocall__remote-videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

/* Контейнер для удалённого участника */
.videocall__remote-participant {
  position: relative;
  background-color: #1A1A1A;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16/9;
  min-height: 180px;
}

.videocall__remote-video {
  width: 100%;
  height: 100%;
  background-color: #1A1A1A;
  border-radius: 12px;
  object-fit: cover;
}

/* Заглушка для участника без видео */
.videocall__remote-no-video {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #2A2A2A;
  border-radius: 12px;
}

.videocall__remote-no-video-icon {
  width: 80px;
  height: 80px;
  background-color: #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.videocall__remote-no-video-icon svg {
  width: 40px;
  height: 40px;
  fill: #888;
}

/* Метка с именем участника */
.videocall__remote-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, .6);
  color: #FFF;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--medium-font);
}

/* Панель управления */
.videocall__controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 20px;
  background-color: #FFF;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(155, 178, 190, .15);
}

.videocall__control-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
  font-size: 22px;
}

.videocall__control-btn--audio,
.videocall__control-btn--video {
  background-color: #F0F4F7;
  color: #232427;
}

.videocall__control-btn--audio:hover,
.videocall__control-btn--video:hover {
  background-color: #E2E9ED;
}

.videocall__control-btn--muted {
  background-color: #FEE;
  color: #C33;
}

.videocall__control-btn--muted:hover {
  background-color: #FDD;
}

.videocall__control-btn--end {
  background-color: #DC3545;
  color: #FFF;
}

.videocall__control-btn--end:hover {
  background-color: #C82333;
}

/* Состояние подключения */
.videocall__connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.videocall__connecting-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #E2E9ED;
  border-top-color: var(--main-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.videocall__connecting-text {
  font-family: var(--medium-font);
  font-size: 16px;
  color: #7C90A0;
}

/* Нет видео - заглушка для локального видео */
.videocall__no-video {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #2A2A2A;
  border-radius: 12px;
  z-index: 5;
}

.videocall__no-video-icon {
  width: 80px;
  height: 80px;
  background-color: #444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.videocall__no-video-icon svg {
  width: 40px;
  height: 40px;
  fill: #888;
}

/* Адаптив для мобильных */
@media (max-width: 991px) {
  .videocall {
    padding: 20px 15px;
    padding-bottom: 126px;
  }

  .videocall__title {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .videocall__form {
    padding: 20px;
  }

  .videocall__buttons {
    flex-direction: column;
  }

  .videocall__buttons .base-btn {
    width: 100%;
  }

  .videocall__videos {
    grid-template-columns: 1fr;
  }

  .videocall__room-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .videocall__controls {
    position: fixed;
    bottom: 70px;
    left: 20px;
    right: 20px;
    border-radius: 16px;
    z-index: 100;
  }

  .videocall__control-btn {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }
}

@media (max-width: 500px) {
  .videocall__local-video-container {
    min-height: 150px;
  }

  .videocall__remote-video {
    min-height: 120px;
  }
}

/* Настройки устройств */
.videocall__control-btn--settings {
  background-color: #F0F4F7;
  color: #232427;
}

.videocall__control-btn--settings:hover,
.videocall__control-btn--active {
  background-color: #E2E9ED;
  color: var(--main-color);
}

.videocall__settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 200;
  backdrop-filter: blur(2px);
}

.videocall__settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #FFF;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  z-index: 201;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.videocall__settings-header {
  padding: 15px 20px;
  border-bottom: 1px solid #E2E9ED;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.videocall__settings-title {
  font-family: var(--bold-font);
  font-size: 18px;
  color: #232427;
}

.videocall__settings-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #7C90A0;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.videocall__settings-close:hover {
  background-color: #F0F4F7;
  color: #232427;
}

.videocall__settings-body {
  padding: 20px;
}

.videocall__settings-group {
  margin-bottom: 20px;
}

.videocall__settings-group:last-child {
  margin-bottom: 0;
}

.videocall__settings-group label {
  display: block;
  font-family: var(--medium-font);
  font-size: 14px;
  color: #7C90A0;
  margin-bottom: 8px;
}

.videocall__settings-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #E2E9ED;
  border-radius: 8px;
  font-family: var(--regular-font);
  font-size: 16px;
  color: #232427;
  background-color: #FFF;
  outline: none;
  transition: border-color .3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237C90A0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 36px;
}


.videocall__settings-group select:focus {
  border-color: var(--main-color);
}

.videocall__settings-mic-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.videocall__audio-meter {
  height: 4px;
  background-color: #F0F4F7;
  border-radius: 2px;
  overflow: hidden;
  width: 100%;
}

.videocall__audio-level {
  height: 100%;
  background-color: var(--main-color);
  width: 0%;
  transition: width 0.1s linear;
}

/* Индикатор выключенного микрофона у собеседника */
.videocall__remote-mute-indicator {
  position: absolute;
  bottom: 10px;
  right: 50%;
  background-color: rgba(220, 53, 69, 0.85);
  color: #FFF;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 8px;
}

.videocall__remote-mute-indicator svg {
  width: 18px;
  height: 18px;
}