/* ============ Ekalavya Meeting design system ============ */
:root {
  --bg: #0d1220;
  --bg2: #131a2e;
  --bg3: #1a2340;
  --card: #171f36;
  --line: #26314f;
  --text: #e8ecf8;
  --muted: #97a3c0;
  --accent: #ffb84d;      /* gurukul amber */
  --accent2: #6c8cff;     /* indigo blue */
  --danger: #ff5d6c;
  --ok: #3ddc84;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  font-size: 16px;
}
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg2: #ffffff;
  --bg3: #e9edf7;
  --card: #ffffff;
  --line: #d6ddef;
  --text: #1b2440;
  --muted: #5b6784;
  --shadow: 0 10px 30px rgba(20,30,60,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: var(--bg2); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-name b { color: var(--accent); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), #ff8a3d); color: #201500;
}
.brand-mark.sm { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
#topnav { display: flex; gap: 18px; }
#topnav a { color: var(--muted); padding: 6px 4px; border-bottom: 2px solid transparent; }
#topnav a.active, #topnav a:hover { color: var(--text); border-color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.whoami { color: var(--muted); font-size: 14px; }

/* ---------- generic ---------- */
.view { padding: 28px; max-width: 1100px; margin: 0 auto; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.btn {
  border: none; border-radius: 10px; padding: 11px 20px; cursor: pointer;
  background: var(--accent2); color: #fff; font-size: 15px; font-weight: 600;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #ff8a3d); color: #241600; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--bg3); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 10px; font-size: 15px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  margin-bottom: 12px;
}
.input:focus { outline: 2px solid var(--accent2); border-color: transparent; }
label.field { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0; }
h1 { font-size: 30px; margin: 0 0 6px; }
h2 { font-size: 20px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 0 0 10px; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  background: var(--bg3); color: var(--muted); font-size: 12px;
}
.pill.live { background: rgba(61,220,132,.15); color: var(--ok); }
.pill.scheduled { background: rgba(108,140,255,.15); color: var(--accent2); }
.pill.ended { background: rgba(151,163,192,.12); }
.badge { background: var(--accent); color: #241600; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 700; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 70px 20px 40px; }
.hero h1 { font-size: 44px; }
.hero .sub { color: var(--muted); font-size: 19px; max-width: 640px; margin: 10px auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 40px; }
.feature { padding: 18px; }
.feature .f-ico { font-size: 26px; }
.footer-note { text-align: center; color: var(--muted); font-size: 13px; margin: 50px 0 20px; }

/* ---------- auth / forms ---------- */
.auth-wrap { max-width: 420px; margin: 50px auto; }
.join-box { max-width: 560px; margin: 40px auto; }

/* ---------- dashboard ---------- */
.dash-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.meet-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.meet-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  flex-wrap: wrap;
}
.meet-item .grow { flex: 1; min-width: 200px; }
.meet-item .mid { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button {
  background: var(--bg2); border: 1px solid var(--line); color: var(--muted);
  padding: 8px 16px; border-radius: 99px; cursor: pointer; font-size: 14px;
}
.tabs button.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }

/* ---------- prejoin ---------- */
.prejoin { max-width: 880px; margin: 30px auto; display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; }
.pj-video { background: #000; border-radius: var(--radius); aspect-ratio: 16/10; position: relative; overflow: hidden; }
.pj-video video { width: 100%; height: 100%; object-fit: cover; }
.pj-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 44px; }
.pj-controls { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.pj-side h2 { margin-top: 0; }
@media (max-width: 800px) { .prejoin { grid-template-columns: 1fr; } }

/* ---------- toasts ---------- */
.toast-root { position: fixed; top: 70px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent2);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
  animation: slideIn .25s ease; max-width: 340px; font-size: 14px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--accent); }
.toast.bad { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================= MEETING ROOM ================= */
.room-root { position: fixed; inset: 0; background: #0a0e18; display: flex; flex-direction: column; z-index: 50; }
.room-topbar {
  display: flex; align-items: center; padding: 10px 16px; gap: 12px;
  border-bottom: 1px solid var(--line); background: var(--bg2); color: var(--text);
}
.room-title { display: flex; align-items: center; gap: 10px; font-weight: 600; }
#rTimer { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.room-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lobby-pill { display: flex; align-items: center; gap: 8px; background: rgba(108,140,255,.16); border: 1px solid var(--accent2); color: var(--text); border-radius: 99px; padding: 4px 8px 4px 12px; font-size: 13px; max-width: 420px; }
.lobby-pill .lp-count { font-weight: 700; white-space: nowrap; }
.lobby-pill .lp-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .85; }
.rec-badge { display: flex; align-items: center; gap: 6px; background: rgba(255,72,72,.16); border: 1px solid #ff4848; color: #ffdddd; border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.rec-badge b { font-variant-numeric: tabular-nums; }
.rec-badge::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #ff4848; animation: recBlink 1.2s steps(2, start) infinite; }
@keyframes recBlink { 50% { opacity: .2; } }
#recBtn.on { border-color: #ff4848; color: #ffdddd; background: rgba(255,72,72,.14); }
.rec-menu { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.rec-menu .btn { width: 100%; }
.conn { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.conn.good { background: var(--ok); } .conn.ok { background: var(--accent); } .conn.bad { background: var(--danger); }

.room-body { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; position: relative; display: flex; flex-direction: column; min-width: 0; }
.tiles { flex: 1; display: grid; gap: 10px; padding: 14px; overflow: auto; align-content: center; justify-content: center; }
.tiles.gallery { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tiles.gallery.one { grid-template-columns: 1fr; max-width: 1000px; margin: 0 auto; }
.tiles.speaker { display: flex; flex-direction: column; }
.tiles.speaker .tile.main-tile { flex: 1; min-height: 0; }
.tiles.speaker .strip { display: flex; gap: 8px; overflow-x: auto; padding: 8px 14px; }
.tiles.speaker .strip .tile { width: 180px; height: 110px; flex: none; }

.tile {
  position: relative; background: var(--bg3); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.tile .avatar {
  width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 30px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent2), #9955ff); color: #fff; z-index: 1;
}
.tile .nametag {
  position: absolute; left: 8px; bottom: 6px; z-index: 3; font-size: 12.5px;
  background: rgba(0,0,0,.55); color: #fff; padding: 3px 9px; border-radius: 6px;
  display: flex; gap: 6px; align-items: center; max-width: 90%;
}
.tile .flags { position: absolute; right: 8px; top: 8px; z-index: 3; display: flex; gap: 6px; }
.flag { background: rgba(0,0,0,.55); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.flag.mute { color: #ff8a94; }
.tile.speaking { outline: 3px solid var(--ok); }
.tile.pinned { outline: 2px solid var(--accent); }
.tile .pin-btn {
  position: absolute; right: 8px; top: 34px; z-index: 3; opacity: 0;
  background: rgba(0,0,0,.6); border: none; color: #fff; border-radius: 6px; cursor: pointer; padding: 3px 7px;
}
.tile:hover .pin-btn { opacity: 1; }
.self-tile { position: absolute; right: 18px; bottom: 14px; width: 220px; z-index: 5; box-shadow: var(--shadow); }
@media (max-width: 700px) { .self-tile { width: 120px; } }

.reaction-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 8; }
.fly-emoji { position: absolute; bottom: -40px; font-size: 34px; animation: fly 3.2s ease-out forwards; }
@keyframes fly { to { transform: translateY(-70vh) rotate(15deg); opacity: 0; } }
.hand-toast {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--accent); color: var(--text);
  padding: 8px 18px; border-radius: 99px; z-index: 9; box-shadow: var(--shadow);
}

/* control bar */
.control-bar {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  padding: 8px 12px; background: var(--bg2); border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.ctl {
  background: transparent; color: var(--text); border: none; border-radius: 10px;
  padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; min-width: 66px; font-size: 11.5px;
}
.ctl:hover { background: var(--bg3); }
.ctl .ico { font-size: 19px; }
.ctl.on-red { color: var(--danger); }
.ctl.active-acc { color: var(--accent); }
.ctl-danger { color: #fff; background: var(--danger); border-radius: 12px; }
.ctl-danger:hover { background: #e14858; }
.ctl-menu-wrap { position: relative; }
.menu-btn { min-width: 26px; padding: 8px 6px; flex-direction: row; }
.popup {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); z-index: 30; min-width: 240px;
}
.popup .react-row { display: flex; gap: 6px; font-size: 22px; }
.popup .react-row button { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 8px; }
.popup .react-row button:hover { background: var(--bg3); }
.popup label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 5px 0; }

/* side panel */
.side-panel {
  width: 330px; background: var(--bg2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; flex: none;
}
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); align-items: center; }
.ptab {
  flex: 1; background: none; border: none; color: var(--muted); padding: 12px 4px;
  cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent;
}
.ptab.active { color: var(--text); border-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.pane { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 10px; min-height: 0; }
@media (max-width: 860px) {
  .side-panel { position: absolute; right: 0; top: 46px; bottom: 60px; z-index: 20; box-shadow: var(--shadow); }
}

.plist-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 6px;
  border-radius: 8px; font-size: 14px;
}
.plist-item:hover { background: var(--bg3); }
.plist-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist-item .role { font-size: 11px; color: var(--accent); }
.plist-item .mini { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; color: var(--muted); border-radius: 6px; }
.plist-item .mini:hover { background: var(--line); color: var(--text); }
.plist-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 4px 4px; }

/* chat */
.chat-msg { margin: 6px 0; font-size: 14px; max-width: 95%; }
.chat-msg .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.chat-msg .bubble { background: var(--bg3); padding: 8px 11px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
.chat-msg.me .bubble { background: var(--accent2); color: #fff; margin-left: auto; }
.chat-msg.pm .bubble { border-left: 3px solid var(--accent); }
.chat-msg.file .bubble { display: flex; align-items: center; gap: 10px; }
.file-bar { flex: 1; height: 8px; background: var(--bg3); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.file-bar > span { display: block; height: 100%; background: var(--accent2); border-radius: 99px; transition: width .2s; }
.chat-msg.file a { color: var(--accent); font-weight: 600; text-decoration: none; }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-input select { max-width: 120px; }
.chat-input textarea { flex: 1; resize: none; height: 40px; }

/* breakout panel */
.bo-room {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  margin-bottom: 8px; background: var(--bg2);
}
.bo-room .cnt { color: var(--muted); font-size: 13px; }
.bo-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.bo-timer { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
label.bo-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; }
.bo-assign { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bo-assign .nm { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-assign select { max-width: 150px; }
/* the room-names box grows to fit every line you type so nothing is hidden */
#boNames { field-sizing: content; min-height: 92px; max-height: 280px; line-height: 1.6; resize: vertical; }
/* make the native dropdown option list readable on the dark theme */
select.input option, .bo-move option, .bo-assign option, .chat-input select option {
  background: var(--bg2); color: var(--text); padding: 4px 6px; }
/* compact selects in the breakout panes — .input's 11px padding is too tall for a
   short fixed height, which clipped the closed box (the native dropdown still
   rendered fine). Give these small padding + an auto height that fits the text. */
.sel-sm, .input.sel-sm, select.input.sel-sm { padding: 6px 9px; font-size: 14px; height: auto; min-height: 34px; border-radius: 8px; margin-bottom: 0; }
.rejoin-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--accent2); background: var(--bg2);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; font-size: 14px;
}

/* poll */
.poll-opt { display: flex; align-items: center; gap: 8px; padding: 7px 4px; cursor: pointer; }
.poll-bar { height: 8px; background: var(--accent2); border-radius: 99px; }

/* modals */
.modal-root { position: absolute; inset: 0; background: rgba(5,8,18,.7); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; width: min(480px, 92vw); max-height: 84vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-card h3 { margin-bottom: 14px; }
.kv { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
.kv .k { color: var(--muted); width: 110px; flex: none; }
.kv .v { flex: 1; user-select: all; background: var(--bg2); border-radius: 8px; padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.report { width: 100%; border-collapse: collapse; font-size: 14px; }
table.report th, table.report td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.report th { color: var(--muted); font-weight: 600; }

/* waiting screen */
.wait-screen { position: absolute; inset: 0; background: rgba(8,11,22,.92); display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; z-index: 35; color: var(--text); text-align: center; padding: 20px; }
.spin { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ended screen */
.ended-box { text-align: center; padding: 60px 20px; }
