/* ---------- base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #121212;
  --bg-elev: #1c1c1e;
  --bg-elev-2: #26262a;
  --blue: #3a76f0;
  --blue-dark: #2f60c9;
  --red: #e5484d;
  --green: #3ecf8e;
  --text: #f2f2f2;
  --text-dim: #a0a0a8;
  --border: #2c2c31;
  --radius: 16px;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px var(--blue);
}

.brand-name { font-weight: 600; letter-spacing: 0.3px; font-size: 15px; }

.status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elev-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f0b400;
  transition: background 0.25s;
}

.status-dot.connected { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.error     { background: var(--red); }

/* ---------- video area ---------- */
.video-area {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

#remoteVideo {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #000;
}

.remote-audio-only {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
}
.remote-audio-only.hidden { display: none; }
.remote-audio-only h3 { color: var(--text); font-weight: 500; }

.avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  border: 2px solid var(--border);
}
.avatar.big { width: 120px; height: 120px; font-size: 52px; }

/* ---------- PiP ---------- */
.pip {
  position: absolute;
  bottom: 20px; right: 20px;
  width: 200px; height: 150px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.12);
  background: #000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 4;
}

#localVideo {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.pip-label {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.55);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* ---------- overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 6;
}
.overlay.hidden { display: none; }
.overlay h3 { font-weight: 500; }
.overlay p  { color: var(--text-dim); font-size: 13px; }

.spinner {
  width: 42px; height: 42px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- controls ---------- */
.controls {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
}

.ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 74px;
  padding: 10px 14px;
  border: none;
  border-radius: 14px;
  background: var(--bg-elev-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.ctrl:hover  { background: #303036; transform: translateY(-1px); }
.ctrl:active { transform: translateY(0); }
.ctrl.active { background: var(--blue); }
.ctrl.danger { background: var(--red); }
.ctrl.danger:hover { background: #c93b40; }

.ctrl-icon  { font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.ctrl-label { font-size: 11px; color: inherit; opacity: 0.85; }

/* ---------- dialog ---------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.2s;
}
.dialog-backdrop.hidden { display: none; }

.dialog {
  width: min(92vw, 400px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 26px 22px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.55);
}

.dialog-logo {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 0 24px rgba(58,118,240,0.5);
}

.dialog h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.dialog p  { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }

.dialog input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.18s;
}
.dialog input:focus { border-color: var(--blue); }

.dialog-actions { display: flex; gap: 10px; }

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.btn:hover  { transform: translateY(-1px); }
.btn.primary   { background: var(--blue); color: #fff; }
.btn.primary:hover   { background: var(--blue-dark); }
.btn.secondary { background: var(--bg-elev-2); color: var(--text); }
.btn.secondary:hover { background: #303036; }

.dialog-hint { margin-top: 14px; font-size: 11px; color: #6c6c74; }

/* ---------- toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  animation: fadeIn 0.2s ease;
}
.toast.error { border-color: var(--red); color: #ffb4b6; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .pip { width: 120px; height: 90px; bottom: 100px; right: 10px; }
  .ctrl-label { display: none; }
  .ctrl { min-width: 58px; padding: 12px; }
}

/* ---------- Font Awesome adjustments ---------- */

.avatar i {
  font-size: 40px;
  color: var(--blue);
}
.avatar.big i { font-size: 52px; }

.dialog-logo i {
  font-size: 26px;
  color: #fff;
}

.ctrl-icon i {
  font-size: 18px;
  line-height: 1;
}

.ctrl.active .ctrl-icon i,
.ctrl.danger .ctrl-icon i {
  color: #fff;
}

.btn i {
  margin-right: 6px;
  font-size: 13px;
}
