/* ============================================================================
   VibzRoom — Pro UI theme & layout.
   DaisyUI provides the components; here we (1) retune the dark/light themes to a
   professional indigo-on-slate palette, and (2) build the meeting-app shell:
   app bars, a Zoom-like bottom control dock, glass panels & bottom sheets, and
   the canvas/stage/joystick — all responsive.
   ============================================================================ */

/* ---- fonts & resets ---- */
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden; overscroll-behavior: none;
  font-family: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
* { -webkit-font-smoothing: antialiased; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(140,150,190,0.28); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,150,190,0.45); }

/* ---- custom dark theme (deep slate + indigo) ---- */
[data-theme='dark'] {
  color-scheme: dark;
  --p: 60% 0.2 277;        /* primary: indigo-violet */
  --pc: 98% 0.01 277;
  --s: 72% 0.13 220;       /* secondary: cyan */
  --sc: 16% 0.03 220;
  --a: 72% 0.16 330;       /* accent: magenta */
  --ac: 14% 0.03 330;
  --n: 30% 0.02 270;
  --nc: 90% 0.01 270;
  --b1: 20% 0.022 268;     /* base surfaces */
  --b2: 24% 0.026 268;
  --b3: 29% 0.03 268;
  --bc: 91% 0.012 268;     /* base text */
  --in: 66% 0.15 240; --inc: 14% 0.02 240;
  --su: 72% 0.15 158; --suc: 13% 0.03 158;
  --wa: 80% 0.13 82;  --wac: 18% 0.03 82;
  --er: 64% 0.21 22;  --erc: 98% 0.01 22;
}
/* shared brand polish for both themes */
[data-theme] {
  --rounded-box: 1rem;
  --rounded-btn: 0.65rem;
  --rounded-badge: 0.5rem;
  --p: 60% 0.2 277; --pc: 98% 0.01 277;
}
[data-theme='light'] { --p: 52% 0.22 277; --pc: 99% 0.01 277; }

/* app background: a subtle aurora behind everything */
body {
  background:
    radial-gradient(1100px 700px at 12% -10%, oklch(60% 0.2 277 / 0.18), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, oklch(72% 0.13 220 / 0.12), transparent 55%),
    oklch(16% 0.02 268);
  color: oklch(92% 0.01 268);
}
[data-theme='light'] body {
  background:
    radial-gradient(1100px 700px at 12% -10%, oklch(60% 0.2 277 / 0.14), transparent 60%),
    radial-gradient(900px 600px at 100% 0%, oklch(72% 0.13 220 / 0.10), transparent 55%),
    oklch(97% 0.005 268);
}

/* ============================ shared components ============================ */

/* glass surface */
.glass {
  background: oklch(24% 0.026 268 / 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid oklch(80% 0.02 268 / 0.10);
  box-shadow: 0 12px 40px -12px rgba(0,0,0,0.6);
}
[data-theme='light'] .glass {
  background: oklch(100% 0 0 / 0.72);
  border-color: oklch(40% 0.02 268 / 0.12);
}

/* brand logo lockup */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center;
  width: 2.25rem; height: 2.25rem; border-radius: 0.7rem;
  color: #fff;
  background: linear-gradient(135deg, oklch(64% 0.2 277), oklch(70% 0.15 318));
  box-shadow: 0 6px 18px -4px oklch(60% 0.2 277 / 0.7);
}
.brand-mark svg { width: 1.3rem; height: 1.3rem; }
.brand-title { font-size: 1.15rem; letter-spacing: -0.01em; line-height: 1; }
.brand-title .accent {
  background: linear-gradient(90deg, oklch(72% 0.16 318), oklch(78% 0.13 220));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* gradient brand button */
.btn-brand {
  border: none; color: #fff;
  background: linear-gradient(135deg, oklch(60% 0.2 277), oklch(58% 0.19 300));
  box-shadow: 0 8px 22px -8px oklch(60% 0.2 277 / 0.85);
}
.btn-brand:hover { background: linear-gradient(135deg, oklch(64% 0.21 277), oklch(62% 0.2 300)); }

/* a generic icon-button helper to size lucide SVGs */
.ico { display: inline-flex; }
.ico svg { width: 1.15rem; height: 1.15rem; }
.ico-sm svg { width: 1rem; height: 1rem; }
.ico-lg svg { width: 1.4rem; height: 1.4rem; }

/* role badges */
.role-badge { display: inline-flex; align-items: center; gap: 0.25rem; }
.role-badge svg { width: 0.85rem; height: 0.85rem; }

/* live indicator */
.live-dot {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: oklch(72% 0.18 22);
}
.live-dot::before {
  content: ''; width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: oklch(64% 0.21 22); box-shadow: 0 0 0 0 oklch(64% 0.21 22 / 0.7);
  animation: vz-live 1.6s infinite;
}
@keyframes vz-live {
  0% { box-shadow: 0 0 0 0 oklch(64% 0.21 22 / 0.6); }
  70% { box-shadow: 0 0 0 6px oklch(64% 0.21 22 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(64% 0.21 22 / 0); }
}

/* ============================ lobby room cards =========================== */
.room-grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.room-card {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1rem; border-radius: 1rem;
  background: oklch(24% 0.026 268 / 0.6);
  border: 1px solid oklch(80% 0.02 268 / 0.08);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.room-card:hover {
  transform: translateY(-2px);
  border-color: oklch(60% 0.2 277 / 0.5);
  box-shadow: 0 16px 40px -18px oklch(60% 0.2 277 / 0.7);
}
.room-card .cover {
  height: 84px; border-radius: 0.7rem; display: grid; place-items: center;
  background:
    radial-gradient(120px 80px at 30% 20%, oklch(60% 0.2 277 / 0.4), transparent),
    linear-gradient(135deg, oklch(28% 0.04 268), oklch(22% 0.03 300));
  color: oklch(80% 0.12 277);
}
.room-card .cover svg { width: 1.8rem; height: 1.8rem; opacity: 0.85; }

/* ============================ shared stage screen ======================== */
.screen-wrap {
  position: relative; width: 100%; aspect-ratio: 16/9; max-height: 34vh;
  background: #05070d; border-radius: 14px; overflow: hidden;
  border: 1px solid oklch(80% 0.02 268 / 0.10);
  box-shadow: 0 24px 60px -24px oklch(60% 0.2 277 / 0.5);
}
.screen-wrap video, .screen-wrap #yt, .screen-wrap #stage-img, .screen-wrap #share-video {
  width: 100%; height: 100%; object-fit: contain;
}
.screen-wrap #share-video { position: absolute; inset: 0; background: #000; z-index: 5; }
.screen-wrap #stage-img { background: #000; }
.stage-radio {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  color: #cfe0ff; font-size: 14px; letter-spacing: 0.5px;
  background: radial-gradient(circle at 50% 45%, oklch(60% 0.2 277 / 0.3), rgba(0,0,0,0.92));
}
.stage-radio svg { width: 46px; height: 46px; animation: vz-pulse 1.6s ease-in-out infinite; }
@keyframes vz-pulse { 0%,100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.12); opacity: 1; } }

/* host stage toolbar */
.stage-tools { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

/* whiteboard canvas fills the stage; it captures pointer drawing */
.board-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; z-index: 6; }

/* board toolbar */
.board-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.board-tools .swatch {
  width: 1.5rem; height: 1.5rem; border-radius: 0.45rem; border: 2px solid transparent;
  cursor: pointer; box-shadow: 0 0 0 1px rgba(0,0,0,0.3) inset;
}
.board-tools .swatch.sel { border-color: #fff; transform: scale(1.1); }

/* link preview chip */
.link-preview {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem;
  border-radius: 0.8rem; background: oklch(24% 0.026 268 / 0.6);
  border: 1px solid oklch(80% 0.02 268 / 0.1);
}
.link-preview img { width: 64px; height: 40px; object-fit: cover; border-radius: 0.4rem; background: #000; }

/* floating reactions */
.reactions-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 25; }
.reaction-float {
  position: absolute; bottom: 12%; color: oklch(72% 0.18 18);
  animation: vz-react 2.2s ease-out forwards;
}
.reaction-float svg { width: 2.2rem; height: 2.2rem; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
@keyframes vz-react {
  0% { transform: translateY(0) scale(0.4); opacity: 0; }
  15% { transform: translateY(-10px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-220px) scale(1); opacity: 0; }
}

/* reaction bar (popover above the dock) */
.react-bar { display: flex; gap: 0.25rem; padding: 0.4rem; border-radius: 1rem; }
.react-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 0.7rem;
  background: transparent; border: none; cursor: pointer; color: oklch(85% 0.04 30);
  transition: background 0.15s, transform 0.1s;
}
.react-btn:hover { background: oklch(80% 0.02 268 / 0.12); transform: scale(1.15); }
.react-btn svg { width: 1.5rem; height: 1.5rem; }

/* ============================ room canvas ================================ */
.room-wrap { flex: 1 1 0; position: relative; min-height: 0; touch-action: none; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

.legend {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.5rem;
  background: oklch(18% 0.02 268 / 0.8); border: 1px solid oklch(80% 0.02 268 / 0.08);
  border-radius: 20px; padding: 5px 14px; font-size: 12px;
  white-space: nowrap; max-width: 96vw; overflow: hidden; text-overflow: ellipsis;
}
.legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* ============================ bottom control dock ======================== */
.dock {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  background: oklch(18% 0.02 268 / 0.82);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid oklch(80% 0.02 268 / 0.10);
  overflow-x: auto; scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }
.dock-btn {
  flex: 0 0 auto;
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.2rem;
  min-width: 3.6rem; padding: 0.45rem 0.6rem; border-radius: 0.8rem;
  background: transparent; border: 1px solid transparent; color: oklch(85% 0.02 268);
  font-size: 0.66rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.dock-btn svg { width: 1.35rem; height: 1.35rem; }
.dock-btn:hover { background: oklch(80% 0.02 268 / 0.08); }
.dock-btn.is-active { background: oklch(60% 0.2 277 / 0.2); border-color: oklch(60% 0.2 277 / 0.5); color: oklch(86% 0.1 277); }
.dock-btn.is-on { color: oklch(78% 0.16 158); }
.dock-btn.is-off { color: oklch(70% 0.2 22); }
.dock-btn.danger:hover { background: oklch(64% 0.21 22 / 0.16); color: oklch(78% 0.18 22); }
.dock-sep { width: 1px; align-self: stretch; margin: 0.3rem 0.2rem; background: oklch(80% 0.02 268 / 0.12); }
@media (max-width: 480px) { .dock-btn { min-width: 3rem; font-size: 0; gap: 0; padding: 0.5rem; } .dock-btn svg { width: 1.45rem; height: 1.45rem; } }

/* ============================ audio / person sheet ======================= */
.sheet {
  position: absolute; z-index: 40;
  width: min(320px, 92vw);
  bottom: 14px; right: 14px;
  border-radius: 1rem; overflow: hidden;
}
@media (max-width: 640px) {
  .sheet { left: 8px; right: 8px; bottom: 8px; width: auto; }
}
.sheet .card-body { max-height: min(70vh, 560px); overflow-y: auto; }
.range-row { display: flex; flex-direction: column; gap: 0.15rem; }
.range-row .lbl { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem; }
.range-row .lbl .ttl { display: inline-flex; align-items: center; gap: 0.3rem; }
.range-row .lbl svg { width: 0.85rem; height: 0.85rem; opacity: 0.8; }
.hint { font-size: 0.65rem; opacity: 0.55; }

/* ============================ mobile joystick ============================ */
.joy-base {
  position: absolute; bottom: 18px; left: 18px;
  width: 104px; height: 104px; border-radius: 50%;
  background: oklch(60% 0.06 268 / 0.14); border: 2px solid oklch(70% 0.06 268 / 0.32);
  touch-action: none; user-select: none; display: grid; place-items: center;
  backdrop-filter: blur(3px); z-index: 20;
}
.joy-knob {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, oklch(64% 0.2 277), oklch(60% 0.19 300));
  box-shadow: 0 6px 16px rgba(0,0,0,0.45); pointer-events: none; transition: transform 0.05s linear;
}
@media (min-width: 900px) { .joy-base { opacity: 0.4; } .joy-base:hover { opacity: 0.9; } }
