/* ==========================================================================
   LokaStream Core CSS
   Design: Premium Glassmorphism, Neon Highlights & Fluid Grid
   ========================================================================== */

:root {
  /* Clean Light Theme with Grey Accents */
  --bg-base: #ffffff;
  --bg-base-alt: #f8f9fa;
  --bg-panel: rgba(255, 255, 255, 0.75); /* Light glassmorphism */
  --bg-panel-solid: #f8f9fa;
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-active: rgba(108, 117, 125, 0.4);
  
  --primary: #495057; /* Dark Grey Accent */
  --primary-glow: rgba(73, 80, 87, 0.15);
  --secondary: #6c757d; /* Medium Grey Accent */
  --secondary-glow: rgba(108, 117, 125, 0.1);
  --danger: #dc3545; /* Clean red for danger actions */
  --danger-glow: rgba(220, 53, 69, 0.2);
  --success: #28a745; /* Clean green for online states */
  --dark-hover: rgba(0, 0, 0, 0.03);
  
  /* Fonts & Shadows */
  --font-family: 'Plus Jakarta Sans', sans-serif;
  --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.06);
  --shadow-neon: 0 0 12px var(--primary-glow);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: #212529; /* Dark charcoal text */
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================================================
   Background Animated Blur Shapes
   ========================================================================== */
.bg-blur-shapes {
  display: none !important;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.06;
  mix-blend-mode: multiply;
  animation: float-animation 20s infinite alternate ease-in-out;
}

.shape-1 {
  background: #a8aeb7;
  width: 450px;
  height: 450px;
  top: -10%;
  left: -10%;
  animation-duration: 25s;
}

.shape-2 {
  background: #cdd2db;
  width: 400px;
  height: 400px;
  bottom: -5%;
  right: -5%;
  animation-duration: 22s;
}

.shape-3 {
  background: #e2e5ec;
  width: 350px;
  height: 350px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 30s;
}

@keyframes float-animation {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate(50px, 80px) scale(1.1) rotate(180deg);
  }
  100% {
    transform: translate(-30px, -50px) scale(0.9) rotate(360deg);
  }
}

/* ==========================================================================
   Glassmorphic Utilities
   ========================================================================== */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-glow);
  border-radius: var(--radius-lg);
}

.glass-select, input[type="text"] {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #212529;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.glass-select:focus, input[type="text"]:focus {
  border-color: var(--secondary);
  box-shadow: var(--shadow-neon);
  background: #ffffff;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: none;
  color: #fff;
  padding: 0.85rem 1.75rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12), var(--shadow-neon);
}

.primary-btn:active {
  transform: translateY(0);
}

.glass-btn {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-glass);
  color: #495057;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.glass-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #212529;
  border-color: rgba(0, 0, 0, 0.15);
}

.text-btn {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.text-btn:hover {
  color: #212529;
}

.circle-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #495057;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.circle-btn:hover {
  transform: scale(1.1);
  background: #ffffff;
  color: #212529;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.circle-btn.off {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

/* ==========================================================================
   LOBBY SCREEN
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1500px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
  justify-content: center;
}

.lobby-container {
  height: auto;
  min-height: 100vh;
  justify-content: center;
}

.lobby-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo h1 span {
  color: var(--secondary);
  text-shadow: 0 0 10px var(--secondary-glow);
}

.lobby-header p {
  color: var(--secondary);
  font-size: 1.05rem;
}

/* Lobby Layout Grid */
.lobby-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .lobby-layout {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 1rem;
    height: auto;
  }
}

/* Left Panel: Camera Preview */
.preview-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-preview-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
  background: #1e1e1e;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.video-preview-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror effect */
}

.video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f1f3f5;
  color: #868e96;
  gap: 1rem;
}

.video-placeholder i {
  font-size: 3rem;
}

.preview-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
}

.preview-device-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .preview-device-settings {
    grid-template-columns: 1fr;
  }
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-item label {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Right Panel: Join Form */
.form-panel {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.form-panel h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: #212529;
}

.form-panel .subtitle {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #495057;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  color: #6c757d;
}

.input-wrapper input {
  width: 100%;
  padding-left: 2.75rem;
  padding-right: 1rem;
}

.input-wrapper input#room-id {
  padding-right: 3.25rem;
}

.inside-btn {
  position: absolute;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--primary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: var(--transition);
}

.inside-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

/* Advanced Configuration */
.advanced-settings {
  margin-top: 0.25rem;
}

.advanced-settings #advanced-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.input-hint {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
  line-height: 1.3;
}

.local-notice {
  display: flex;
  gap: 0.75rem;
  background: rgba(108, 117, 125, 0.05);
  border: 1px solid rgba(108, 117, 125, 0.15);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 1.5rem;
  align-items: flex-start;
}

.local-notice i {
  color: var(--secondary);
  margin-top: 0.15rem;
}

.local-notice p {
  font-size: 0.8rem;
  color: #495057;
  line-height: 1.4;
}

.lobby-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   CONFERENCE SCREEN (Main Workspace)
   ========================================================================== */
.conference-container {
  height: 100vh;
  max-width: 100%;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */
.room-header {
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-badge {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

.room-badge .label {
  color: var(--secondary);
  font-weight: 500;
}

.room-badge .value {
  color: var(--secondary);
  font-weight: 700;
  font-family: monospace;
}

.badge-btn {
  position: relative;
}

.count-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-panel-solid);
}

/* Conference Main Layout */
.conference-layout {
  display: flex;
  flex: 1;
  gap: 1.25rem;
  min-height: 0; /* Important for flex child scrolling */
}

.video-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
}

/* Dynamic & Fluid Video Grid */
.video-grid {
  display: grid;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 0.25rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
  justify-content: center;
  position: relative; /* Anchor for absolute spotlight styling */
}

/* Fluid dynamic grid class modifications based on participant count */
.video-grid.count-1 {
  grid-template-columns: 1fr;
  max-width: 850px;
  margin: 0 auto;
}

.video-grid.count-2 {
  grid-template-columns: 1fr 1fr;
  max-width: 1050px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .video-grid.count-2 {
    grid-template-columns: 1fr;
  }
}

.video-grid.count-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}

.video-grid.count-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.video-grid.count-5, .video-grid.count-6 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 800px) {
  .video-grid.count-3, .video-grid.count-4, .video-grid.count-5, .video-grid.count-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 500px) {
  .video-grid.count-3, .video-grid.count-4, .video-grid.count-5, .video-grid.count-6 {
    grid-template-columns: 1fr;
  }
}

/* Video Containers with Glassmorphism and animations */
.video-container {
  position: relative;
  aspect-ratio: 16/9;
  background: #111111; /* Dark solid background to blend letterboxes */
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  animation: fadeInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  width: 100%;
  height: 100%;
  cursor: pointer; /* Click to Zoom indicator */
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Spotlight Mode: full view of selected video box */
.video-container.spotlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  aspect-ratio: auto;
  border-color: var(--secondary);
  box-shadow: 0 0 35px var(--secondary-glow);
  animation: spotlightZoomIn 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes spotlightZoomIn {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Indicator showing video is in Spotlight / Focus Mode */
.spotlight-indicator {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(108, 117, 125, 0.9);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-container.spotlight .spotlight-indicator {
  opacity: 1;
}

/* Admin controls overlay inside remote video container */
.admin-controls-overlay {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(33, 37, 41, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  display: flex;
  gap: 0.5rem;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.video-container:hover .admin-controls-overlay {
  opacity: 1;
  pointer-events: auto;
}

.admin-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.admin-action-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.admin-action-btn.kick-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 42, 116, 0.3);
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Smooth deletion placeholder */
.video-container.leaving {
  animation: fadeOutScale 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes fadeOutScale {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Full aspect ratio, no cropping */
}

.video-container.mirrored video {
  transform: scaleX(-1);
}

/* Video Controls & Tag Overlays */
.video-tag {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(33, 37, 41, 0.75);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #ffffff;
}

.video-tag span.me-badge {
  background: var(--primary);
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  color: white;
}

.video-status-indicators {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

/* Hide active remote participant indicators */
.video-container:not(#video-wrapper-local) .status-badge.mic-status:not(.muted) {
  display: none !important;
}
.video-container:not(#video-wrapper-local) .status-badge.cam-status:not(.camera-off) {
  display: none !important;
}

.status-badge {
  background: rgba(33, 37, 41, 0.75);
  backdrop-filter: blur(8px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-glass);
  font-size: 0.85rem;
  transition: var(--transition);
  color: #ffffff;
}

.status-badge.muted {
  color: var(--danger);
  border-color: rgba(255, 42, 116, 0.25);
}

.status-badge.camera-off {
  color: var(--danger);
  border-color: rgba(255, 42, 116, 0.25);
}

.status-badge.clickable {
  cursor: pointer;
  pointer-events: auto;
}

.status-badge.clickable:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

.status-badge.active-mirror {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.video-tag span.host-badge {
  background: var(--secondary);
  color: #ffffff;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 800;
}

/* Screen sharing mode overlay style */
.video-container.screen-share {
  border-color: var(--secondary);
  box-shadow: 0 0 15px var(--secondary-glow);
}

.video-container.screen-share .video-tag {
  border-color: var(--secondary);
}

/* Video Off Overlay */
.video-off-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8f9fa; /* Clean light background */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  gap: 0.75rem;
  font-size: 0.9rem;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.video-off-avatar {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Sidebar: Chat & Participants
   ========================================================================== */
.sidebar-panel {
  width: 330px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, width 0.4s ease;
}

.sidebar-panel.collapsed {
  width: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 768px) {
  .sidebar-panel {
    position: absolute;
    top: 5.5rem;
    right: 1.25rem;
    bottom: 6.5rem;
    width: calc(100% - 2.5rem);
    z-index: 10;
  }
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.02);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: #6c757d;
  padding: 1rem 0;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  position: relative;
}

.tab-btn.active {
  color: #212529;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%);
  border-radius: 10px;
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.tab-pane {
  display: none;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 1.25rem;
}

.tab-pane.active {
  display: flex;
}

/* Chat Tab Layout */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-right: 0.25rem;
}

.chat-bubble {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: chatEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes chatEntrance {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.chat-bubble .meta {
  font-size: 0.75rem;
  color: #6c757d;
  display: flex;
  gap: 0.5rem;
}

.chat-bubble .meta .time {
  font-size: 0.7rem;
  opacity: 0.8;
}

.chat-bubble .text {
  background: rgba(0, 0, 0, 0.03);
  padding: 0.6rem 0.9rem;
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  border: 1px solid var(--border-glass);
  word-break: break-word;
  color: #212529;
}

.chat-bubble.me {
  align-self: flex-end;
}

.chat-bubble.me .meta {
  justify-content: flex-end;
}

.chat-bubble.me .text {
  background: rgba(108, 117, 125, 0.1); /* Light grey accent */
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
  border-color: var(--border-active);
  color: #212529;
}

.system-message {
  text-align: center;
  font-size: 0.75rem;
  color: #6c757d;
  background: rgba(0, 0, 0, 0.01);
  border: 1px dashed var(--border-glass);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.chat-input-wrapper input {
  flex: 1;
  border-radius: var(--radius-md);
}

.send-btn {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.send-btn:hover {
  background: #343a40;
  box-shadow: var(--shadow-neon);
}

/* User List Tab */
.user-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  animation: chatEntrance 0.3s ease forwards;
  color: #212529;
}

.user-item-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  border: 1px solid var(--border-glass);
}

.user-item.me .user-avatar {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-status-icons {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #6c757d;
}

.user-status-icons i.muted {
  color: var(--danger);
}

/* ==========================================================================
   Control Bar (Bottom Menu)
   ========================================================================== */
.control-bar {
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}

@media (max-width: 600px) {
  .control-bar {
    padding: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
}

.control-btn {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-glass);
  color: #495057;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 1.2rem;
  min-width: 84px;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.control-btn i {
  font-size: 1.25rem;
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #212529;
  border-color: rgba(0, 0, 0, 0.15);
}

.control-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-neon);
}

.control-btn.off {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

.control-btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.control-btn.danger:hover {
  background: #bd2130;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

.control-btn.secondary.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  box-shadow: 0 0 12px var(--secondary-glow);
}

.control-group {
  display: flex;
  gap: 0.75rem;
}

/* ==========================================================================
   Modals (Settings & Help)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.4); /* Light transparent overlay */
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.modal-content {
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  animation: modalSlideUp 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.help-modal-content {
  max-width: 650px;
}

@keyframes modalSlideUp {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #212529;
}

.modal-header h3 i {
  color: var(--secondary);
}

.modal-close-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close-btn:hover {
  color: #212529;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

/* Help Modal Markdown Stylings */
.markdown-body h4 {
  font-size: 1rem;
  color: var(--primary);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-body p {
  font-size: 0.9rem;
  color: #495057;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.markdown-body ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

.markdown-body li {
  font-size: 0.85rem;
  color: #495057;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.markdown-body code {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #212529;
}

/* ==========================================================================
   Active Rooms Widget Styling (Lobby)
   ========================================================================== */
.active-rooms-section {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-glass);
  padding-top: 1.25rem;
}

.active-rooms-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #495057;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.active-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.active-room-card {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-glass);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
}

.active-room-card:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--secondary);
  transform: translateY(-1px);
}

.active-room-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.active-room-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #212529;
}

.active-room-count {
  font-size: 0.75rem;
  color: #6c757d;
}

.active-room-join-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  transition: var(--transition);
}

.active-room-card:hover .active-room-join-btn {
  background: #212529;
}

.empty-rooms {
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 0.75rem 0;
}

/* Sidebar close button */
.sidebar-close-btn {
  background: none;
  border: none;
  color: var(--secondary);
  padding: 0 1rem;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  color: #212529;
}

/* Focus choice context menu */
.focus-menu-popup {
  position: fixed;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  box-shadow: var(--shadow-glow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 150px;
  animation: fadeInScale 0.15s ease-out;
}

.focus-menu-btn {
  background: none;
  border: none;
  color: #212529;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.focus-menu-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}
