/* ===== روم‌یار — professional dark-glass UI ===== */
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0e1f;
  --glass: rgba(255,255,255,.055);
  --glass-2: rgba(255,255,255,.085);
  --stroke: rgba(255,255,255,.11);
  --txt: #e9edf9;
  --muted: #97a2bd;
  --accent: #5b7cfa;
  --accent2: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #ef4466;
  --radius: 16px;
}
html, body { height: 100%; }
body {
  font-family: 'Vazirmatn', Tahoma, system-ui, sans-serif;
  background:
    radial-gradient(1100px 550px at 85% -12%, rgba(91,124,250,.18) 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34,211,238,.12) 0%, transparent 60%),
    var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  line-height: 1.9;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

.bg-orbs span { position: fixed; border-radius: 50%; filter: blur(110px); opacity: .22; z-index: -1; }
.bg-orbs span:nth-child(1) { width: 480px; height: 480px; background: #3b5bdb; top: -160px; right: -100px; }
.bg-orbs span:nth-child(2) { width: 420px; height: 420px; background: #0ea5b7; bottom: -160px; left: -120px; }
.bg-orbs span:nth-child(3) { width: 280px; height: 280px; background: #7c3aed; top: 45%; left: 35%; }

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 16px 48px rgba(0,0,0,.38);
}

/* ================= NAVBAR / BRAND ================= */
.navbar, .room-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 22px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-box {
  width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px rgba(91,124,250,.4);
}
.logo-box.sm { width: 38px; height: 38px; font-size: 18px; border-radius: 12px; }
.brand-name {
  font-size: 20px; font-weight: 800; letter-spacing: .3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-name.sm { font-size: 17px; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: -4px; }
.nav-meta, .room-meta, .room-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.nav-pill {
  padding: 6px 13px; border-radius: 999px; background: var(--glass-2);
  border: 1px solid var(--stroke); font-size: 12px; color: var(--txt);
}
.nav-pill.ok { color: var(--ok); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--stroke);
  background: var(--glass-2); color: var(--txt); font-size: 16px; cursor: pointer;
  transition: all .25s;
}
.icon-btn:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }

/* ================= JOIN ================= */
#join-view { min-height: 100vh; display: flex; flex-direction: column; gap: 26px; padding: 18px; }
.hero {
  flex: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px;
  max-width: 1060px; width: 100%; margin: 0 auto; align-items: stretch;
}
.hero-form { padding: 34px 32px; display: flex; flex-direction: column; }
.hero-form h1 { font-size: 27px; font-weight: 800; }
.hero-form > .muted { font-size: 13.5px; margin: 6px 0 20px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 12px 15px; border-radius: 13px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,.055); color: var(--txt); font-size: 15px;
  font-family: inherit; outline: none; transition: all .25s;
}
input:focus, select:focus { border-color: var(--accent); background: rgba(91,124,250,.1); }
select option { background: #141a30; color: var(--txt); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.segment { display: flex; gap: 10px; }
.seg {
  flex: 1; padding: 12px; border-radius: 13px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05); color: var(--txt); cursor: pointer;
  font-size: 14px; font-family: inherit; transition: all .25s;
}
.seg:hover { transform: translateY(-2px); }
.seg.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; font-weight: 700; color: #071029;
}

.btn-primary {
  width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 13px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #071029;
  font-size: 16px; font-weight: 800; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all .25s; box-shadow: 0 10px 30px rgba(91,124,250,.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(91,124,250,.5); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-ghost {
  padding: 11px 18px; border-radius: 13px; border: 1px solid var(--stroke);
  background: var(--glass-2); color: var(--txt); cursor: pointer; font-family: inherit;
  font-size: 14px; transition: all .25s; width: 100%;
}
.btn-ghost:hover { background: rgba(255,255,255,.16); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(7,16,41,.3); border-top-color: #071029;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status { min-height: 20px; font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 10px; }
.status.err { color: var(--danger); }
.join-note {
  margin-top: 18px; padding: 11px 14px; border-radius: 12px; text-align: center;
  background: rgba(34,211,238,.08); border: 1px solid rgba(34,211,238,.18);
  color: var(--muted); font-size: 11.5px;
}

.hero-side { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.feature {
  display: flex; align-items: center; gap: 15px; padding: 18px 20px;
  transition: all .3s;
}
.feature:hover { transform: translateY(-3px); background: var(--glass-2); }
.f-icon {
  width: 50px; height: 50px; flex: 0 0 auto; border-radius: 15px; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(91,124,250,.16); border: 1px solid rgba(91,124,250,.25);
}
.feature h3 { font-size: 15px; font-weight: 700; }
.feature p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.join-footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 6px 0 14px; }

/* ================= ROOM ================= */
#room-view { display: flex; flex-direction: column; gap: 12px; padding: 12px; height: 100vh; height: 100dvh; overflow: hidden; }
.room-header { padding: 10px 20px; }
.live-tag {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: 12px;
  background: rgba(239,68,102,.14); border: 1px solid rgba(239,68,102,.35); color: #ff9daa;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,102,.6); } 50% { box-shadow: 0 0 0 7px rgba(239,68,102,0); } }

.room-layout {
  flex: 1; display: grid; grid-template-columns: 1fr 336px; gap: 12px; min-height: 0;
}
.main-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.stage {
  flex: 1; position: relative; min-height: 200px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-empty { text-align: center; color: var(--muted); }
.stage-empty .wm { font-size: 54px; opacity: .35; margin-bottom: 8px; }
.stage-overlay {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: space-between; padding: 12px;
}
.stage-name {
  padding: 5px 14px; border-radius: 999px; font-size: 12px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px); border: 1px solid var(--stroke);
}
.stage-name:empty { display: none; }
.stage-ctrl { display: flex; gap: 7px; pointer-events: auto; }
.mini-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--stroke);
  background: rgba(0,0,0,.5); color: var(--txt); cursor: pointer; font-size: 14px;
  transition: all .25s;
}
.mini-btn:hover { background: rgba(91,124,250,.5); }

.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; min-height: 92px; }
.strip::-webkit-scrollbar { height: 5px; }
.strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
.tile {
  position: relative; width: 148px; height: 88px; flex: 0 0 auto; border-radius: 13px;
  background: rgba(255,255,255,.06); border: 1px solid var(--stroke); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  transition: all .25s;
}
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .avatar {
  width: 40px; height: 40px; border-radius: 50%; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #071029;
}
.tile .t-name {
  position: absolute; bottom: 4px; right: 5px; left: 5px; font-size: 10.5px;
  background: rgba(0,0,0,.55); border-radius: 8px; padding: 2px 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center;
}
.tile.speaking { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(52,211,153,.45); }
.tile .mic-off { position: absolute; top: 4px; left: 6px; font-size: 11px; }
.tile .role-chip {
  position: absolute; top: 4px; right: 6px; font-size: 9px; padding: 1px 7px;
  border-radius: 99px; background: rgba(91,124,250,.85); color: #fff;
}

/* ---------- TOOLBAR ---------- */
.toolbar {
  display: flex; justify-content: center; gap: 9px; padding: 11px; flex-wrap: wrap;
}
.ctrl {
  min-width: 88px; padding: 9px 14px; border-radius: 13px; border: 1px solid var(--stroke);
  cursor: pointer; background: var(--glass-2); color: var(--txt); font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .25s;
}
.ctrl:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }
.c-icon { font-size: 19px; line-height: 1.5; position: relative; }
.ctrl.off .c-icon::after {
  content: ""; position: absolute; top: 50%; right: -4px; width: 28px; height: 2.5px;
  background: var(--danger); border-radius: 99px; transform: rotate(-42deg);
}
.c-label { font-size: 10.5px; color: var(--muted); }
.ctrl.off { background: rgba(239,68,102,.18); border-color: rgba(239,68,102,.5); }
.ctrl.on { background: rgba(52,211,153,.18); border-color: rgba(52,211,153,.55); }
.ctrl.danger { background: rgba(239,68,102,.85); border-color: transparent; }
.ctrl.danger .c-label { color: rgba(255,255,255,.9); }

/* ---------- SIDEBAR ---------- */
.side { display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--stroke); }
.tab {
  flex: 1; padding: 13px 8px; background: transparent; border: 0;
  border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer;
  font-size: 12.5px; font-family: inherit; transition: all .25s;
}
.tab.active { color: var(--txt); border-bottom-color: var(--accent2); background: rgba(34,211,238,.06); }
.tab-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-box { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-box:empty::after {
  content: "هنوز پیامی ثبت نشده — گفتگو را آغاز کنید 💬";
  margin: auto; color: var(--muted); font-size: 12px; opacity: .8;
}
.chat-box::-webkit-scrollbar { width: 5px; }
.chat-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
.msg { font-size: 12.5px; line-height: 2; }
.msg .bubble {
  background: rgba(255,255,255,.06); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 8px 12px; margin-top: 3px;
}
.msg.own .bubble { background: rgba(91,124,250,.18); border-color: rgba(91,124,250,.3); }
.msg .who { color: var(--accent2); font-size: 10.5px; font-weight: 700; }
.msg .time { color: var(--muted); font-size: 9.5px; margin-right: 8px; }
.msg.sys {
  text-align: center; color: var(--muted); font-size: 11px;
  background: rgba(255,255,255,.035); border-radius: 99px; padding: 4px 12px;
}
.chat-form { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--stroke); }
.chat-form input { flex: 1; padding: 10px 13px; }
.send-btn {
  padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #071029;
  font-weight: 700; font-family: inherit; font-size: 13px;
}

.people-head { padding: 12px 16px 6px; font-size: 11.5px; color: var(--muted); }
.people-box { flex: 1; overflow-y: auto; padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid var(--stroke); font-size: 12.5px;
}
.p-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #071029;
}
.p-info { flex: 1; min-width: 0; }
.p-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  font-size: 9.5px; padding: 1px 8px; border-radius: 99px;
  background: rgba(91,124,250,.2); color: #9db3ff; border: 1px solid rgba(91,124,250,.3);
}
.badge.host { background: rgba(251,191,36,.16); color: var(--warn); border-color: rgba(251,191,36,.3); }
.p-icons { display: flex; gap: 6px; font-size: 13px; }
.p-mute-btn {
  width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--stroke);
  background: var(--glass-2); color: var(--txt); cursor: pointer; font-size: 11px;
}
.p-mute-btn:hover { background: rgba(239,68,102,.3); }

.settings-box { padding: 16px; overflow-y: auto; }
.settings-box .field { margin-bottom: 16px; }

/* ---------- TOASTS / MODAL ---------- */
#toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 90;
}
.toast {
  padding: 11px 20px; border-radius: 13px; font-size: 12.5px; text-align: center;
  background: rgba(20,27,50,.92); border: 1px solid var(--stroke);
  backdrop-filter: blur(14px); animation: toastIn .3s ease;
  box-shadow: 0 12px 36px rgba(0,0,0,.4);
}
.toast.ok { border-color: rgba(52,211,153,.45); }
.toast.err { border-color: rgba(239,68,102,.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

.modal {
  position: fixed; inset: 0; background: rgba(4,8,20,.66); z-index: 100;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px);
}
.modal-card { padding: 28px; width: min(400px, 92vw); text-align: center; }
.modal-card h3 { font-size: 19px; margin-bottom: 8px; }
.modal-card .muted { font-size: 13px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-primary { margin: 0; }

/* ================= RESPONSIVE ================= */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-side { display: none; }
}
@media (max-width: 900px) {
  .room-layout { grid-template-columns: 1fr; }
  .side { max-height: 300px; }
  .ctrl { min-width: 64px; padding: 8px 9px; }
  .c-label { font-size: 9px; }
  .nav-meta .nav-pill:nth-child(1) { display: none; }
}
