/* Stonsys Meet */
:root {
  --brand: #289DD2;
  --brand-dark: #1f7fab;
  --room-bg: #0f1419;
  --tile-bg: #1c232b;
  --panel-bg: #161c22;
}

.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--brand) !important; }
.btn-brand { --bs-btn-color:#fff; --bs-btn-bg:var(--brand); --bs-btn-border-color:var(--brand); --bs-btn-hover-color:#fff; --bs-btn-hover-bg:var(--brand-dark); --bs-btn-hover-border-color:var(--brand-dark); --bs-btn-active-bg:var(--brand-dark); --bs-btn-active-color:#fff; }
.btn-xs { padding: .15rem .45rem; font-size: .75rem; border-radius: .35rem; }
.min-w-0 { min-width: 0; }

.brand-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.brand-dot.sm { width: 28px; height: 28px; font-size: .85rem; }

/* ---------- public pages ---------- */
body.meet-public { background: #f4f7fa; }
.meet-public .card { border-radius: 1rem; }
.meet-public .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(40,157,210,.2); }

/* ---------- room ---------- */
body.meet-room { background: var(--room-bg); color: #e8edf2; height: 100vh; height: 100dvh; overflow: hidden; }
.screen-center { height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center; }
#screen-call { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
#screen-call.d-none { display: none !important; }

.call-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 1rem; }
.rec-badge { background: #d93025; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.call-body { flex: 1; display: flex; min-height: 0; }
.call-main { flex: 1; display: flex; flex-direction: column; gap: .75rem; padding: 0 1rem .5rem; min-height: 0; position: relative; overflow-y: auto; }

/* stage = camera + screen share tiles */
.stage { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); flex: 1 1 60%; min-height: 240px; }
.stage .tile { aspect-ratio: auto; min-height: 200px; }
.stage .tile.screen { grid-column: 1 / -1; min-height: 320px; }
.stage .tile.screen video { object-fit: contain; background: #000; }

/* grid = audio-only people */
.grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; }
.grid:not(.with-stage) { flex: 1; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.with-stage { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.grid.with-stage .tile { aspect-ratio: 4 / 3; }
.grid.with-stage .avatar span { width: 48px; height: 48px; font-size: 1.05rem; }

.tile { position: relative; background: var(--tile-bg); border-radius: .9rem; overflow: hidden; aspect-ratio: 16 / 10; border: 2px solid transparent; transition: border-color .15s; }
.tile.speaking { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(40,157,210,.25); }
.tile.hand-up { border-color: #f5b400; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.tile.has-video video { display: block; }
.tile.local:not(.screen) video { transform: scaleX(-1); }
.tile .avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tile.has-video .avatar { display: none; }
.tile .avatar span { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.4rem; }
.tile.speaking .avatar span { animation: speak 1s infinite; }
@keyframes speak { 50% { box-shadow: 0 0 0 8px rgba(40,157,210,.25); } }
.tile .label { position: absolute; left: .45rem; right: .45rem; bottom: .4rem; display: flex; align-items: center; gap: .35rem; font-size: .8rem; background: rgba(0,0,0,.45); padding: .15rem .5rem; border-radius: .5rem; width: fit-content; max-width: calc(100% - .9rem); }
.tile .label .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label .mic.off { color: #ff6b6b; }
.tile .label .hand { color: #f5b400; display: none; }
.tile.hand-up .label .hand { display: inline; }

.enable-audio { position: absolute; left: 50%; top: 1rem; transform: translateX(-50%); z-index: 5; }

/* side panel */
.panel { width: 340px; background: var(--panel-bg); border-radius: .9rem; margin: 0 1rem .5rem 0; display: flex; flex-direction: column; min-height: 0; }
.panel.d-none { display: none !important; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .75rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.panel-head .nav-link { padding: .3rem .8rem; font-size: .9rem; color: #c5ced8; }
.panel-head .nav-link.active { background: var(--brand); color: #fff; }
.panel-body { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; min-height: 0; }
.panel-body.d-none { display: none !important; }
.lobby-box { background: rgba(40,157,210,.1); border: 1px solid rgba(40,157,210,.35); border-radius: .7rem; padding: .6rem; margin-bottom: .75rem; }
.person { display: flex; align-items: center; gap: .55rem; padding: .4rem .2rem; border-bottom: 1px solid rgba(255,255,255,.05); }
.avatar-sm { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; background: #2c3640; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; }

.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding-bottom: .5rem; }
.chat-msg { background: #222b34; border-radius: .6rem; padding: .45rem .6rem; }
.chat-msg.mine { background: rgba(40,157,210,.18); }
.chat-text { white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.chat-form { display: flex; gap: .4rem; padding-top: .5rem; }

/* control bar */
.call-bar { display: flex; justify-content: center; padding: .6rem 1rem calc(.8rem + env(safe-area-inset-bottom)); }
.bar-group { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: center; }
.ctl { position: relative; height: 48px; min-width: 48px; padding: 0 .9rem; border-radius: 24px; border: 0; background: #2a333d; color: #e8edf2; font-size: 1.15rem; display: inline-flex; align-items: center; justify-content: center; transition: background .15s; }
.ctl:hover { background: #36414d; }
.ctl.on { background: var(--brand); color: #fff; }
#btn-mic:not(.on), #btn-cam:not(.on) { background: #3c2a2a; color: #ff8a80; }
.ctl.rec-on { background: #d93025; color: #fff; }
.ctl-danger { background: #d93025; color: #fff; }
.ctl-danger:hover { background: #b3261e; }
.ctl-danger-outline { background: transparent; border: 1px solid #d93025; color: #ff8a80; font-size: .9rem; }
.ctl .dot { position: absolute; top: 8px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #f5b400; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); display: flex; flex-direction: column; gap: .4rem; z-index: 50; width: min(92vw, 420px); }
.toast-msg { background: #2a333d; color: #fff; padding: .55rem .9rem; border-radius: .6rem; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.35); transition: opacity .35s; }
.toast-msg.hide { opacity: 0; }
.toast-ok { border-left: 4px solid #34a853; }
.toast-warn { border-left: 4px solid #f5b400; }
.toast-error { border-left: 4px solid #d93025; }
.toast-info { border-left: 4px solid var(--brand); }

/* mobile */
@media (max-width: 768px) {
  .call-main { padding: 0 .5rem .5rem; }
  .panel { position: fixed; inset: 0 0 76px 0; width: auto; margin: 0; border-radius: 0; z-index: 30; }
  .grid:not(.with-stage) { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .stage { grid-template-columns: 1fr; }
  .ctl { height: 44px; min-width: 44px; padding: 0 .7rem; font-size: 1.05rem; }
  .ctl-danger-outline { font-size: .8rem; }
  #btn-rec { display: none; } /* recording needs a desktop browser */
}
