* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  width: 100%;
  height: 100%;
  background-color: #0b0f17;
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

/* ================================
   RECEIVER / PC VIEW
================================ */
.pc-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  overflow: hidden;
}

/* Khung video fit trọn vẹn màn hình (Cover toàn bộ, không thừa khoảng đen trên dưới) */
.video-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  overflow: hidden;
}

#remoteVideo {
  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
  object-fit: cover; /* Phủ kín toàn bộ khung hình, loại bỏ hoàn toàn viền đen trên dưới */
  display: none; /* Chỉ hiển thị khi có stream */
}

#remoteVideo.active {
  display: block;
}

/* Màn hình chờ kết nối (QR Code) */
.waiting-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(22, 30, 46, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px 40px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  max-width: 440px;
  text-align: center;
  transition: opacity 0.3s ease;
}

.waiting-card.hidden {
  display: none !important;
}

.waiting-card h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #38bdf8;
}

.waiting-card p {
  font-size: 0.92rem;
  color: #94a3b8;
  margin-bottom: 20px;
  line-height: 1.45;
}

.qr-box {
  background: #ffffff;
  padding: 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.qr-box img {
  width: 220px;
  height: 220px;
  display: block;
}

.url-badge {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: monospace;
  font-size: 0.95rem;
  color: #7dd3fc;
  word-break: break-all;
  user-select: all;
}

/* Thông báo click để bật tiếng (nếu browser chặn autoplay âm thanh) */
.audio-unmute-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: none;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ================================
   PHONE / SENDER VIEW
================================ */
.phone-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#localPreview {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Tràn viền phủ kín màn hình điện thoại, không để lại khoảng đen */
}

/* Trạng thái kết nối dạng pill nhỏ ở góc trên */
.status-pill {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #eab308; /* Vàng = đang chờ */
}

.status-dot.connected {
  background: #22c55e; /* Xanh lá = đang stream */
  box-shadow: 0 0 8px #22c55e;
}

/* Nút lật camera trước / sau */
.flip-camera-btn {
  position: absolute;
  bottom: 30px;
  right: 25px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.2s ease, background 0.2s ease;
}

.flip-camera-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.2);
}

.flip-camera-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}
