:root {
  --bg-main: #07080c;
  --bg-card: #0f1219;
  --bg-card-elevated: #151924;
  --bg-input: #090c12;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.4);
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-main: 0 16px 36px -8px rgba(0, 0, 0, 0.7);

  /* Subtitle Custom Variables */
  --sub-font: 'Vazirmatn', sans-serif;
  --sub-font-size: 20px;
  --sub-color: #fde047;
  --sub-bg: rgba(0, 0, 0, 0.75);
  --sub-shadow: 0 2px 4px rgba(0,0,0,0.95), 0 0 2px rgba(0,0,0,0.95);
  --sub-bottom: 36px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }

/* ====================================================
   MODALS & OVERLAYS (FULLSCREEN COMPATIBLE)
==================================================== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.2), transparent 70%), rgba(7, 8, 12, 0.94);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

body > .modal-overlay {
  position: fixed;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-main);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-bottom: 10px;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.brand h1 { font-size: 22px; font-weight: 800; }
.brand p { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; margin-bottom: 18px; }

.input-group {
  margin-bottom: 14px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label { font-size: 12px; font-weight: 500; color: var(--text-muted); }

.input-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  transition: all 0.2s;
}

.input-field.compact { padding: 6px 10px; border-radius: var(--radius-sm); }
.input-field:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }
.input-field i { color: var(--text-dim); width: 15px; height: 15px; flex-shrink: 0; }
.input-field input { background: transparent; border: none; color: var(--text-main); font-size: 13px; outline: none; width: 100%; }

.input-with-button { display: flex; gap: 6px; }

.btn-secondary {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--primary); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:hover { transform: translateY(-1px); }

/* ====================================================
   APP SHELL & HEADER
==================================================== */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: rgba(15, 18, 25, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 46px;
  flex-shrink: 0;
  z-index: 80;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
  white-space: nowrap;
}
.brand-logo i { width: 18px; height: 18px; }

.room-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  max-width: 140px;
}

.tag-code { font-weight: 600; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-copy-tag {
  background: transparent;
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
}
.btn-copy-tag i { width: 12px; height: 12px; }

.btn-voice-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-voice-pill i { width: 13px; height: 13px; }
.btn-voice-pill.in-voice {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-head-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-head-icon i { width: 13px; height: 13px; }
.btn-head-icon.muted { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); border-color: var(--accent-red); }
.btn-head-icon.danger:hover { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

.users-counter {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-muted);
}
.users-counter i { width: 12px; height: 12px; }

/* ====================================================
   APP MAIN GRID (DESKTOP THEATER + SIDEBAR)
==================================================== */
.app-main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 46px);
  height: calc(100dvh - 46px);
  overflow: hidden;
}

/* THEATER COLUMN */
.theatre-column {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  gap: 10px;
  overflow: hidden;
  background: var(--bg-main);
}

/* VIDEO PLAYER */
.custom-player {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: black;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-main);
}

#main-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: black;
}

/* SUBTITLE OVERLAY */
.custom-subtitle-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: var(--sub-bottom);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 24;
  text-align: center;
  direction: rtl;
}

.custom-subtitle-overlay span {
  font-family: var(--sub-font);
  font-size: var(--sub-font-size);
  color: var(--sub-color);
  background-color: var(--sub-bg);
  text-shadow: var(--sub-shadow);
  padding: 3px 10px;
  border-radius: 6px;
  line-height: 1.45;
  white-space: pre-line;
  max-width: 95%;
  display: inline-block;
}
.custom-subtitle-overlay span:empty { display: none; }

/* FULLSCREEN FLOATING VOICE PILL */
.fullscreen-voice-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 18, 25, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 40;
}
.fs-pill-btn {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.fs-pill-btn.muted {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--accent-red);
  color: var(--accent-red);
}
.fs-speakers-avatars { display: flex; align-items: center; gap: 4px; }
.fs-speaker-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fs-speaker-chip.speaking {
  border-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green-glow);
}

/* FULLSCREEN ON-SCREEN CHAT OVERLAY */
.fullscreen-chat-overlay {
  position: absolute;
  top: 60px;
  right: 14px;
  width: 280px;
  max-height: 240px;
  overflow-y: hidden;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 38;
}
.fs-chat-bubble {
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: white;
  animation: fsBubbleFade 6s forwards;
  max-width: 90%;
  align-self: flex-start;
}
@keyframes fsBubbleFade {
  0% { opacity: 0; transform: translateY(10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}
.fs-chat-username { font-weight: 700; color: var(--primary); margin-left: 4px; }

/* FULLSCREEN CHAT INPUT BAR */
.fullscreen-chat-bar {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 480px;
  background: rgba(15, 18, 25, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  z-index: 45;
}
.fullscreen-chat-bar form { display: flex; gap: 6px; }
.fullscreen-chat-bar input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: white;
  font-size: 13px;
  outline: none;
}
.btn-fs-send {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Double-Tap Touch Seek */
.touch-seek-zone {
  position: absolute;
  top: 0;
  bottom: 50px;
  width: 35%;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
}
.touch-seek-zone.left { right: 0; }
.touch-seek-zone.right { left: 0; }

.seek-ripple-indicator {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.seek-ripple-indicator.active { opacity: 1; transform: scale(1.1); }

/* Center Splash */
.center-play-splash {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 25;
  pointer-events: none;
}

/* Empty Placeholder */
.video-placeholder {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #121520, #08090e);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 16px;
  z-index: 10;
}
.placeholder-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 2px;
}
.video-placeholder h3 { font-size: 15px; font-weight: 700; }
.video-placeholder p { font-size: 12.5px; color: var(--text-dim); max-width: 320px; line-height: 1.5; }

/* Floating reactions bar */
.floating-emojis-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(16, 19, 27, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 30;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.custom-player:hover .floating-emojis-bar,
.floating-emojis-bar:hover { opacity: 1; }

.quick-react-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 3px;
  transition: transform 0.15s;
}
.quick-react-btn:hover { transform: scale(1.3); }

.reaction-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.floating-reaction { position: absolute; bottom: 40px; font-size: 28px; animation: floatUp 1.8s forwards; }
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(0.6); }
  50% { opacity: 0.9; transform: translateY(-100px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-200px) scale(1.3); }
}

/* PLAYER CONTROLS OVERLAY */
.player-controls-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 35;
  direction: ltr;
  transition: opacity 0.3s, transform 0.3s;
}
.player-controls-overlay.autohide { opacity: 0; pointer-events: none; transform: translateY(8px); }

.timeline-container { position: relative; height: 5px; background: rgba(255, 255, 255, 0.25); border-radius: 999px; cursor: pointer; transition: height 0.15s; }
.timeline-container:hover { height: 8px; }
.timeline-buffer { position: absolute; top: 0; left: 0; height: 100%; width: 0%; background: rgba(255, 255, 255, 0.35); border-radius: 999px; }
.timeline-progress { position: absolute; top: 0; left: 0; height: 100%; width: 0%; background: var(--primary); border-radius: 999px; }
.timeline-thumb { position: absolute; top: 50%; left: 0%; width: 12px; height: 12px; border-radius: 50%; background: white; transform: translate(-50%, -50%) scale(0); transition: transform 0.15s; }
.timeline-container:hover .timeline-thumb { transform: translate(-50%, -50%) scale(1); }
.timeline-tooltip { position: absolute; bottom: 14px; left: 0; transform: translateX(-50%); background: rgba(16, 19, 27, 0.95); border: 1px solid rgba(255, 255, 255, 0.15); padding: 2px 6px; border-radius: 4px; font-size: 11px; color: white; display: none; }

.controls-row { display: flex; align-items: center; justify-content: space-between; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 4px; }

.btn-ctrl-touch {
  background: transparent;
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-ctrl-touch:hover { background: rgba(255, 255, 255, 0.15); }

.volume-container { display: flex; align-items: center; gap: 4px; }
.volume-slider { width: 0px; height: 4px; accent-color: var(--primary); cursor: pointer; transition: width 0.2s; opacity: 0; }
.volume-container:hover .volume-slider { width: 60px; opacity: 1; }

.time-display { font-size: 11.5px; font-weight: 500; color: rgba(255, 255, 255, 0.9); margin-left: 4px; display: flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.time-sep { color: var(--text-dim); }

.sub-menu-wrapper, .speed-menu-wrapper { position: relative; }
.speed-btn { font-size: 11.5px; font-weight: 700; width: auto; padding: 0 5px; }

.sub-popover {
  position: absolute;
  bottom: 42px;
  right: 0;
  background: rgba(16, 19, 27, 0.97);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-main);
  z-index: 45;
  direction: rtl;
}

.sub-popover-header { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.btn-text-action { background: transparent; border: none; color: var(--primary); font-size: 11px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 4px; }

.popover-row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); }
.btn-toggle-active { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-dim); padding: 2px 8px; border-radius: 999px; font-size: 11px; cursor: pointer; }
.btn-toggle-active.active { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); border-color: var(--accent-green); }

.offset-controls { display: flex; align-items: center; gap: 5px; }
.offset-controls button { background: var(--bg-card-elevated); border: 1px solid var(--border); color: var(--text-main); padding: 2px 6px; border-radius: 4px; font-size: 11px; cursor: pointer; }

.speed-dropdown { position: absolute; bottom: 42px; right: 0; background: rgba(16, 19, 27, 0.95); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 5px; display: flex; flex-direction: column; gap: 2px; min-width: 90px; z-index: 40; }
.speed-dropdown button { background: transparent; border: none; color: var(--text-muted); padding: 5px 8px; font-size: 11.5px; border-radius: 4px; text-align: right; cursor: pointer; }
.speed-dropdown button:hover, .speed-dropdown button.active { background: var(--primary); color: white; }

/* ====================================================
   DESKTOP SINGLE-LINE COMPACT MEDIA BAR
==================================================== */
.desktop-media-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.media-bar-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.btn-action-icon {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
  height: 33px;
}
.btn-action-icon:hover { border-color: var(--primary); background: rgba(255, 255, 255, 0.08); }
.btn-action-icon i { width: 14px; height: 14px; color: var(--primary); }

.media-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.proxy-switch-compact {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
.proxy-switch-compact input { display: none; }
.proxy-switch-compact input:checked + .switch-slider-sm { background: var(--accent-green); }
.proxy-switch-compact input:checked + .switch-slider-sm::before { transform: translateX(12px); background: white; }

.switch-slider-sm { width: 28px; height: 16px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 999px; position: relative; transition: all 0.2s; }
.switch-slider-sm::before { content: ''; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; background: var(--text-muted); border-radius: 50%; transition: all 0.2s; }
.switch-label-sm { font-size: 11px; color: var(--text-muted); }

.btn-play-compact {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px var(--primary-glow);
  height: 33px;
  white-space: nowrap;
}
.btn-play-compact i { width: 14px; height: 14px; }
.btn-play-compact:hover { transform: translateY(-1px); }

/* ====================================================
   RIGHT COLUMN: SIDEBAR
==================================================== */
.sidebar-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  height: 100%;
  overflow: hidden;
}

.sidebar-nav-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border);
  height: 42px;
  flex-shrink: 0;
}

.side-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  height: 100%;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}
.side-tab-btn i { width: 15px; height: 15px; }
.side-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.mobile-only-tab { display: none; }

.unread-badge, .voice-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  position: absolute;
  top: 8px;
  left: 18%;
}
.unread-badge { background: var(--accent-red); }
.voice-badge-dot { background: var(--accent-green); }

.sidebar-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
}

/* CHAT STYLES */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 85%;
  animation: bubbleIn 0.2s ease-out;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.chat-bubble.mine { align-self: flex-start; }
.chat-bubble.other { align-self: flex-end; }

.msg-info { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text-dim); }
.chat-bubble.mine .msg-info { flex-direction: row; }
.chat-bubble.other .msg-info { flex-direction: row-reverse; }
.msg-username { font-weight: 600; color: var(--text-muted); }

.msg-text {
  padding: 7px 11px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-bubble.mine .msg-text { background: var(--primary); color: white; border-bottom-right-radius: 2px; }
.chat-bubble.other .msg-text { background: var(--bg-card-elevated); color: var(--text-main); border: 1px solid var(--border); border-bottom-left-radius: 2px; }

.system-msg { text-align: center; margin: 2px 0; }
.system-msg span { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; font-size: 10.5px; color: var(--text-muted); }

.chat-emojis-scroll {
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  scrollbar-width: none;
  background: var(--bg-card);
}
.chat-emojis-scroll::-webkit-scrollbar { display: none; }

.emoji-chip {
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.chat-bar-form {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  background: var(--bg-card);
}

.chat-bar-form input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}
.chat-bar-form input:focus { border-color: var(--border-focus); }

.btn-send-chat {
  background: var(--primary);
  border: none;
  color: white;
  border-radius: var(--radius-md);
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-send-chat i { width: 14px; height: 14px; }

/* VOICE & MIXER STYLES */
.voice-tab-wrapper {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.voice-card-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.voice-mixer-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mixer-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.mixer-card-header i { width: 14px; height: 14px; }

.mixer-control-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mixer-label-val {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mixer-label-val label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.mixer-label-val label i { width: 13px; height: 13px; }

.voice-box-header { display: flex; align-items: center; justify-content: space-between; }
.voice-status-indicator { display: flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-green); animation: pulseGreen 1.8s infinite; }
@keyframes pulseGreen { 0% { transform: scale(0.95); } 70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 100% { transform: scale(0.95); } }
.live-label { font-size: 12.5px; font-weight: 700; color: var(--accent-green); }
.member-count-badge { font-size: 11px; color: var(--text-dim); }

.voice-members-grid { display: flex; flex-direction: column; gap: 8px; }
.empty-voice-msg { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); padding: 4px 0; }

.voice-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  gap: 8px;
}
.voice-member-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  flex: 1;
}
.voice-member-info.speaking {
  color: var(--accent-green);
  font-weight: 700;
}
.voice-user-volume-box {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 130px;
}
.voice-user-volume-slider {
  width: 90px;
  height: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}
.voice-user-volume-val {
  font-size: 10px;
  color: var(--text-dim);
  width: 28px;
  text-align: left;
}

.btn-voice-big {
  width: 100%;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-voice-big.in-voice {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

/* MOBILE MEDIA PANE */
.mobile-media-pane {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mobile-card-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.mobile-card-box h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.mobile-card-box h4 i { width: 14px; height: 14px; }
.mobile-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* ====================================================
   SUBTITLE CUSTOMIZATION MODAL
==================================================== */
.subtitle-settings-card { max-width: 440px; text-align: right; }
.modal-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.title-with-icon { display: flex; align-items: center; gap: 6px; color: var(--primary); }
.title-with-icon h2 { font-size: 15px; font-weight: 800; color: var(--text-main); }
.btn-close-modal { background: transparent; border: none; color: var(--text-dim); cursor: pointer; display: flex; align-items: center; }

.sub-preview-box {
  position: relative;
  height: 70px;
  background: radial-gradient(circle at 50% 50%, #1e293b, #090d16);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 12px;
}
.sub-preview-text {
  font-family: var(--sub-font);
  font-size: var(--sub-font-size);
  color: var(--sub-color);
  background-color: var(--sub-bg);
  text-shadow: var(--sub-shadow);
  padding: 3px 10px;
  border-radius: 6px;
  text-align: center;
}

.sub-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.sub-setting-item { display: flex; flex-direction: column; gap: 3px; }
.sub-setting-item label { font-size: 11px; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.label-with-value { display: flex; align-items: center; justify-content: space-between; }
.setting-value-badge { font-size: 10.5px; background: var(--bg-input); border: 1px solid var(--border); padding: 1px 4px; border-radius: 4px; color: var(--primary); }

.sub-select { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; color: var(--text-main); font-size: 11.5px; outline: none; }
.sub-slider { width: 100%; accent-color: var(--primary); cursor: pointer; }

.color-presets { display: flex; align-items: center; gap: 5px; }
.color-chip { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-chip.active { border-color: white; transform: scale(1.15); }

.modal-footer-actions { display: flex; gap: 6px; }

/* TOAST */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--accent-green); color: var(--accent-green); padding: 7px 14px; border-radius: 999px; font-size: 11.5px; font-weight: 500; box-shadow: var(--shadow-main); z-index: 2000; animation: toastIn 0.3s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 15px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ====================================================
   MOBILE RESPONSIVENESS (Screens <= 900px)
==================================================== */
@media (max-width: 900px) {
  /* HIDE HEADER TEXTS ON MOBILE SO ICONS & BUTTONS FIT CLEANLY */
  .brand-text, .tag-title {
    display: none !important;
  }

  .app-header {
    padding: 0 8px;
  }

  .room-tag {
    max-width: 95px;
  }

  .app-main-grid {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }

  .theatre-column {
    padding: 0;
    gap: 0;
    overflow: visible;
  }

  .custom-player {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    position: sticky;
    top: 0;
    z-index: 60;
    aspect-ratio: 16 / 9;
    flex: none;
    max-height: 38vh;
  }

  .desktop-media-bar {
    display: none !important;
  }

  .mobile-only-tab {
    display: flex !important;
  }

  .sidebar-column {
    border-right: none;
    border-top: 1px solid var(--border);
    flex: 1;
    min-height: calc(100vh - 38vh - 46px);
  }
}
