/* ==========================================
   1. ОБЩИЙ СБРОС И БАЗОВЫЕ СТИЛИ СТРАНИЦЫ
   ========================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* ==========================================
   2. КОНТЕЙНЕР МЕНЮ И АВТОРИЗАЦИИ
   ========================================== */
.container {
  width: 100%;
  max-width: 440px;
  background: #1e293b;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

h1, h2 {
  text-align: center;
  margin-bottom: 18px;
}

input, select {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #fff;
  font-size: 16px;
}

/* ==========================================
   3. КНОПКИ И ВКЛАДКИ МЕНЮ
   ========================================== */
.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 10px;
}

.btn-primary { background: #3b82f6; color: #fff; }
.btn-audio { background: #10b981; color: #fff; font-size: 19px; padding: 20px; }
.btn-video { background: #6366f1; color: #fff; font-size: 19px; padding: 20px; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-secondary { background: #334155; color: #fff; }

.btn:active { transform: scale(0.98); }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.hidden { display: none !important; }

/* ==========================================
   4. ВЕРХНЯЯ ПАНЕЛЬ СТАТУСА И ВХОДЯЩИЙ ЗВОНОК
   ========================================== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: #94a3b8;
}

.incoming-box {
  position: fixed;
  top: 20px;
  left: 16px;
  right: 16px;
  z-index: 9998;
  background: #0f172a;
  border: 2px solid #10b981;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  margin-bottom: 16px;
}


.incoming-box .call-controls {
  display: flex;
  gap: 10px;
}

.error {
  color: #f87171;
  text-align: center;
  margin-top: 8px;
  font-size: 14px;
}

/* ==========================================
   5. ПОЛНОЭКРАННЫЙ ЗВОНОК (КАК В WHATSAPP)
   ========================================== */
#callScreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: #000;
  z-index: 9999;
}

.videos {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Главное видео на весь экран */
.video-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

/* Маленькое окошко в углу (нажимаешь — меняется с большим) */
.video-pip {
  position: absolute;
  top: 24px;
  right: 16px;
  width: 112px;
  height: 156px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  background: #1e293b;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.2s;
}

/* Зеркальное отражение только для фронтальной камеры */
#localVideo.mirror {
  transform: scaleX(-1);
}

/* ==========================================
   6. ПАНЕЛЬ КНОПОК УПРАВЛЕНИЯ ЗВОНКОМ ВНИЗУ
   ========================================== */
#callScreen .call-controls {
  position: absolute;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 3;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 18px;
  border-radius: 999px;
}

#callScreen .call-controls .btn {
  width: 54px;
  height: 54px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
