/* Classario WebRTC — themed to match classario.com (Inter + brand blue) */
:root {
  --brand: #126dfb;          /* classario primary blue */
  --brand-bright: #0099ff;   /* brighter accent */
  --brand-hover: #0765e8;
  --danger: #ff4726;         /* classario accent red */
  --danger-hover: #e03e1f;

  --lobby-bg: #e6efff;       /* soft blue background */
  --card: #ffffff;
  --text: #0c0c0c;
  --muted: #575757;
  --border: #e1eaf8;
  --input-bg: #f8f8f8;

  --stage: #0b1220;          /* dark video stage (video reads best on dark) */
  --tile: #000;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--stage);
}

#app, .lobby, .call { height: 100%; }
.hidden { display: none !important; }

/* ---------- Lobby (light, brand-matched) ---------- */
.lobby {
  background: var(--lobby-bg);
  display: flex;
  align-items: safe center;       /* center, but never clip when taller than viewport */
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.lobby-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(18, 109, 251, .12);
}
#preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 30vh;
  background: #000;
  border-radius: 14px;
  object-fit: cover;
  transform: scaleX(-1); /* mirror your own preview */
}
.field { margin-top: 11px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}
.btn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.lobby-loading {
  margin: 0;
  padding: 28px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

/* ---------- Call (dark stage, floating controls) ---------- */
.call {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--stage);
}

/* Video grid fills ALL available space and divides it evenly. */
.videos {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  padding: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  grid-auto-rows: 1fr;
}

.tile {
  position: relative;
  min-height: 0;
  background: var(--tile);
  border-radius: 14px;
  overflow: hidden;
}
.tile.sharing { outline: 3px solid var(--brand); outline-offset: -3px; }
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile.local video { transform: scaleX(-1); }      /* mirror your own camera */
.tile.sharing video { object-fit: contain; background: #000; } /* show whole screen */
.tile.sharing.local video { transform: none; }    /* don't mirror a shared screen */

.tile .name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

/* Per-tile expand / fullscreen button */
.tile .expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s, background .15s;
  backdrop-filter: blur(4px);
}
.tile .expand:hover { background: rgba(0, 0, 0, .7); }
.tile:hover .expand { opacity: 1; }
@media (hover: none) { .tile .expand { opacity: .9; } } /* always visible on touch */
.tile .expand svg { width: 17px; height: 17px; }

/* ---------- Floating toolbar ---------- */
.toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(20, 28, 46, .72);
  backdrop-filter: blur(14px);
  border-radius: 999px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45);
  z-index: 10;
}
.btn-round {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 19px;
  cursor: pointer;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.btn-round:hover { background: rgba(255, 255, 255, .26); }
.btn-round.off { background: var(--danger); }
.btn-leave { background: var(--danger); }
.btn-leave:hover { background: var(--danger-hover); }

.status {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  text-align: center;
  color: #cbd5e1;
  font-size: 13px;
  pointer-events: none;
}
.status:empty { display: none; }

@media (max-width: 480px) {
  .toolbar { gap: 9px; padding: 9px 12px; bottom: 14px; }
  .btn-round { width: 44px; height: 44px; font-size: 17px; }
}
