/**
 * Galène Modern UI
 * Professional, clean design with balanced layout
 */

/* ===== CSS VARIABLES ===== */
:root {
  /* Colors - Professional palette */
  --color-bg: #f8fafc;
  --color-bg-secondary: #ffffff;
  --color-bg-tertiary: #f1f5f9;
  --color-bg-dark: #1e293b;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-light: #eff6ff;

  --color-success: #22c55e;
  --color-success-hover: #16a34a;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-warning: #f59e0b;

  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  --color-border: #e2e8f0;
  --color-border-focus: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 280px;
  --chat-width: 320px;
  --topbar-height: 64px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== UTILITIES ===== */
.invisible {
  display: none !important;
}

/* ===== APP CONTAINER ===== */
.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Set viewport height variable */
:root {
  --vh: 1vh;
}

/* ===== LOGIN SCREEN ===== */
.login-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 100;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2xl);
  margin: var(--space-md);
}

.login-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.login-logo i {
  font-size: 28px;
  color: white;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

.loginform .form-group {
  margin-bottom: var(--space-lg);
}

.loginform label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 14px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: var(--transition);
  background: var(--color-bg);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input-wrapper input::placeholder {
  color: var(--color-text-muted);
}

/* Join Options */
.join-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.radio-card {
  cursor: pointer;
}

.radio-card input {
  display: none;
}

.radio-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.radio-content i {
  font-size: 20px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.radio-content span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.radio-card input:checked + .radio-content {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.radio-card input:checked + .radio-content i,
.radio-card input:checked + .radio-content span {
  color: var(--color-primary);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px var(--space-lg);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  padding: 10px var(--space-lg);
  background: var(--color-bg-tertiary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--color-border);
}

/* ===== CONFERENCE CONTAINER ===== */
.conference-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== TOP BAR ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  flex-shrink: 0;
  z-index: 100;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.topbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.meeting-info {
  margin-left: var(--space-md);
}

.meeting-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Icon Buttons */
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.icon-btn.btn-danger {
  background: var(--color-danger);
  color: white;
}

.icon-btn.btn-danger:hover {
  background: var(--color-danger-hover);
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn-sm:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text);
}

/* Control Bar */
.control-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-bg-tertiary);
  padding: var(--space-xs);
  border-radius: var(--radius-lg);
}

.control-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.control-btn:hover {
  background: var(--color-bg-secondary);
}

.control-btn i {
  font-size: 16px;
}

.control-btn.btn-go {
  background: var(--color-success);
  color: white;
}

.control-btn.btn-go:hover {
  background: var(--color-success-hover);
}

.control-btn.btn-stop {
  background: var(--color-danger);
  color: white;
}

.control-btn.btn-stop:hover {
  background: var(--color-danger-hover);
}

/* Recording button - red dot indicator */
#recordbutton {
  color: var(--color-text);
}

#recordbutton i {
  color: var(--color-danger);
}

#recordbutton:hover {
  background: var(--color-bg-secondary);
}

#unrecordbutton {
  background: var(--color-danger);
  color: white;
  animation: recording-pulse 1.5s ease-in-out infinite;
}

#unrecordbutton:hover {
  background: var(--color-danger-hover);
}

@keyframes recording-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.control-label {
  display: none;
}

@media (min-width: 768px) {
  .control-label {
    display: inline;
  }
}

/* ===== MAIN CONTENT ===== */
.main-content,
#mainrow {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
}

/* ===== PARTICIPANTS SIDEBAR ===== */
.participants-sidebar {
  width: var(--sidebar-width);
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: var(--transition-slow);
}

.participants-sidebar.active {
  width: 0;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.participant-count {
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.participants-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

/* User items - styled via JS */
#users .user-p {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

#users .user-p:hover {
  background: var(--color-bg-tertiary);
}

#users > div::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  margin-right: var(--space-sm);
  flex-shrink: 0;
}

#users > div.user-status-raisehand::before {
  content: "\f256";
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  width: auto;
  height: auto;
  background: none;
  color: var(--color-warning);
}

/* ===== VIDEO AREA ===== */
.video-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-dark);
  position: relative;
  overflow: hidden;
}

.video-container {
  flex: 1;
  display: flex;
  padding: var(--space-md);
  overflow: hidden;
}

.expand-video {
  flex: 1;
  display: flex;
}

.video-grid {
  flex: 1;
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-content: center;
  justify-content: center;
}

/* Peer Video */
.peer {
  position: relative;
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.peer.peer-active {
  box-shadow: 0 0 0 3px var(--color-primary);
}

.peer .media {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.peer .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm) var(--space-md);
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
}

/* Video Controls */
.video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-md);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  justify-content: space-between;
  opacity: 0;
  transition: var(--transition);
}

.peer:hover .video-controls {
  opacity: 1;
}

.top-video-controls {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  opacity: 0;
  transition: var(--transition);
}

.peer:hover .top-video-controls {
  opacity: 1;
}

.video-controls span,
.top-video-controls span {
  color: white;
  cursor: pointer;
  padding: var(--space-xs);
  transition: var(--transition);
}

.video-controls span:hover,
.top-video-controls span:hover {
  color: var(--color-primary);
}

.volume-slider {
  width: 80px;
  margin-left: var(--space-sm);
  accent-color: var(--color-primary);
}

/* Captions */
.captions-container {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
}

.captions-text {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: 1rem;
}

/* ===== CHAT SIDEBAR ===== */
.chat-sidebar {
  width: var(--chat-width);
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.chat-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.chat-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chatbox {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

/* Chat Messages */
.message {
  max-width: 85%;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
}

.message-row {
  margin-bottom: var(--space-xs);
}

.message-sender {
  background: var(--color-primary);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: var(--radius-sm);
}

.message:not(.message-sender) {
  background: var(--color-bg-tertiary);
  border-bottom-left-radius: var(--radius-sm);
}

.message-header {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.message-sender .message-header {
  color: rgba(255,255,255,0.7);
}

.message-content {
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message-footer {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-align: right;
  margin-top: var(--space-xs);
}

.message-sender .message-footer {
  color: rgba(255,255,255,0.7);
}

.message-system {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
  font-style: italic;
  max-width: 100%;
  text-align: center;
}

.message-private {
  background: #fef3c7;
  border: 1px dashed var(--color-warning);
}

/* Chat Input */
.chat-input-form {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  position: relative;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
}

.chat-input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font-size: 0.9rem;
  padding: var(--space-sm);
  max-height: 120px;
  font-family: inherit;
}

.chat-input-wrapper textarea:focus {
  outline: none;
}

.chat-input-wrapper textarea::placeholder {
  color: var(--color-text-muted);
}

/* Command Palette */
.command-palette {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--space-sm);
  z-index: 100;
  animation: palette-in 0.15s ease-out;
}

@keyframes palette-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.command-palette-header {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
}

.command-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}

.command-item:last-child {
  border-bottom: none;
}

.command-item:hover,
.command-item.selected {
  background: var(--color-bg-tertiary);
}

.command-item.selected {
  background: var(--color-primary-light);
}

.command-icon {
  font-size: 1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.command-name {
  font-weight: 600;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  color: var(--color-primary);
  min-width: 100px;
  font-size: 0.875rem;
}

.command-desc {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  flex: 1;
}

.command-params {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  background: var(--color-bg-tertiary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.command-category {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.command-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.command-hint {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
  border-top: 1px solid var(--color-border);
}

.command-hint kbd {
  background: var(--color-bg-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 0.65rem;
}

.send-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--color-primary-hover);
}

/* Resizer */
.resizer {
  width: 4px;
  background: transparent;
  cursor: ew-resize;
  transition: var(--transition);
}

.resizer:hover {
  background: var(--color-primary);
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 0;
  height: 100vh;
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  transition: var(--transition-slow);
}

.settings-header,
.sidenav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  min-height: 64px;
}

.settings-header h2,
.sidenav-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.settings-content,
.sidenav-content {
  padding: var(--space-xl);
  overflow-y: auto;
  height: calc(100vh - 64px);
}

/* Profile Section */
.profile-section {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.profile-card,
.profile-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: linear-gradient(135deg, var(--color-bg-tertiary) 0%, var(--color-bg) 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.profile-avatar,
.profile-logo {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-role {
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 500;
}

.user-logout {
  flex-shrink: 0;
}

.user-logout a {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-danger);
  color: white;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.user-logout a:hover {
  background: var(--color-danger-hover);
}

.logout-icon {
  font-size: 0.9rem;
}

.logout-text {
  white-space: nowrap;
}

.link-sm {
  font-size: 0.8rem;
  color: var(--color-primary);
  cursor: pointer;
}

.link-sm:hover {
  text-decoration: underline;
}

/* Settings Sections */
.settings-section {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h3,
.settings-section legend {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-lg);
  padding: 0;
  border: none;
}

fieldset.settings-section {
  border: none;
  padding: 0;
  margin: 0 0 var(--space-xl) 0;
}

.setting-item {
  margin-bottom: var(--space-lg);
}

.setting-item label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  white-space: nowrap;
}

.setting-item label i {
  color: var(--color-primary);
  width: 18px;
  font-size: 0.9rem;
}

.setting-item select,
.select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.setting-item select:hover,
.select:hover {
  border-color: var(--color-text-muted);
}

.setting-item select:focus,
.select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  cursor: pointer;
}

.setting-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.setting-toggle label {
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
}

/* Sidenav label compatibility */
.sidenav-label,
.sidenav-label-first {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
  white-space: nowrap;
}

.select-inline {
  margin-top: var(--space-xs);
}

/* ===== MODAL DIALOG ===== */
.modal-dialog {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 0;
  max-width: 400px;
  width: 90%;
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  padding: var(--space-xl);
}

.modal-header {
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-form .form-group {
  margin-bottom: var(--space-md);
}

.modal-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.modal-form input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.modal-form input:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

.modal-actions .btn-primary {
  width: auto;
}

/* ===== TOASTIFY OVERRIDES ===== */
.toastify {
  border-radius: var(--radius) !important;
  font-family: inherit !important;
  box-shadow: var(--shadow-lg) !important;
}

.toastify.error {
  background: var(--color-danger) !important;
}

.toastify.warning {
  background: var(--color-warning) !important;
}

.toastify.info {
  background: var(--color-success) !important;
}

/* ===== CONTEXT MENU ===== */
.contextualMenu {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--color-border) !important;
}

/* ===== MOBILE BUTTONS ===== */
.show-video,
.chat-btn {
  position: fixed;
  z-index: 50;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

.show-video {
  bottom: 100px;
  right: 20px;
}

.chat-btn {
  bottom: 20px;
  right: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .participants-sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
  }

  .participants-sidebar.active {
    transform: translateX(0);
    width: var(--sidebar-width);
  }

  .chat-sidebar {
    position: fixed;
    right: 0;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 50;
    transform: translateX(100%);
  }

  .chat-sidebar.active {
    transform: translateX(0);
  }

  .control-label {
    display: none;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: var(--space-sm);
  }

  .join-options {
    grid-template-columns: repeat(3, 1fr);
  }

  .radio-content {
    padding: var(--space-xs) var(--space-sm);
  }

  .radio-content i {
    font-size: 16px;
    margin-bottom: 2px;
  }

  .radio-content span {
    font-size: 0.65rem;
  }

  .topbar {
    padding: 0 var(--space-sm);
  }

  .meeting-info {
    display: none;
  }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ===== COMPATIBILITY WITH GALENE.JS ===== */
/* These classes are used by the existing JavaScript */

.row { display: flex; }
.full-height { height: 100%; }
.full-width { width: 100%; }
.full-width-active { width: 100%; }

/* Nav elements expected by JS */
.nav-link { cursor: pointer; }
.nav-button { cursor: pointer; }
.nav-cancel { color: var(--color-danger); }
.muted { color: var(--color-danger); }

/* Button states */
.btn { cursor: pointer; }
.btn-success { background: var(--color-success); color: white; }
.btn-cancel { background: var(--color-danger); color: white; }
.btn-default { background: var(--color-bg-tertiary); }
.btn-blue { background: var(--color-primary); color: white; }

/* Form elements */
.form-control {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Media states */
.media-failed {
  filter: none;
}

.mirror {
  transform: scaleX(-1);
}

.peer-hidden {
  display: none;
}

/* Legacy class mappings */
.users-header { display: none; }
.header-sep { display: none; }
.sidenav { /* mapped to settings-panel */ }
.coln-left { /* mapped to chat-sidebar */ }
.coln-right { /* mapped to video-area */ }
#left-sidebar { /* mapped to participants-sidebar */ }

/* ===== BREAKOUT ROOMS ===== */

/* Breakout Timer (shown in topbar during breakout) */
.breakout-timer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-warning);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  animation: timer-pulse 2s ease-in-out infinite;
}

.breakout-timer i {
  font-size: 1rem;
}

.breakout-timer.warning {
  background: var(--color-danger);
  animation: timer-urgent 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes timer-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.breakout-return-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-left: var(--space-sm);
}

.breakout-return-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* Breakout Notification Overlay */
.breakout-notification {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlay-in 0.3s ease-out;
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.breakout-notification-content {
  background: var(--color-bg-secondary);
  padding: var(--space-2xl) var(--space-2xl);
  border-radius: var(--radius-xl);
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: card-in 0.4s ease-out 0.1s both;
  box-shadow: var(--shadow-xl);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.breakout-notification-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  animation: icon-bounce 0.6s ease-out 0.3s both;
}

@keyframes icon-bounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.breakout-notification-icon i {
  font-size: 36px;
  color: white;
}

.breakout-notification-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.breakout-notification-content p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.breakout-room-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius);
  margin: var(--space-md) 0;
}

.breakout-redirect-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: var(--space-md);
}

.breakout-redirect-text span {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.1rem;
}

/* Breakout Dialog Modal */
#breakout-dialog {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 0;
  max-width: 420px;
  width: 90%;
}

#breakout-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#breakout-dialog .modal-content {
  padding: var(--space-xl);
}

#breakout-dialog .modal-header {
  margin-bottom: var(--space-lg);
}

#breakout-dialog .modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

#breakout-dialog .breakout-info {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--color-bg-tertiary);
  border-radius: var(--radius);
}

#breakout-dialog .form-group {
  margin-bottom: var(--space-lg);
}

#breakout-dialog .form-group label {
  display: block;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

#breakout-dialog .select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--color-bg-secondary);
  cursor: pointer;
}

#breakout-dialog .select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

#breakout-dialog .modal-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

#breakout-dialog .btn-secondary {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

#breakout-dialog .btn-secondary:hover {
  background: var(--color-bg);
}

#breakout-dialog .btn-primary {
  flex: 2;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

#breakout-dialog .btn-primary:hover {
  background: var(--color-primary-hover);
}

/* End Breakout Notification (when returning to main) */
.breakout-ending-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg-secondary);
  padding: var(--space-xl) var(--space-2xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  text-align: center;
  z-index: 1000;
  animation: card-in 0.3s ease-out;
}

.breakout-ending-notification h3 {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.breakout-ending-notification p {
  color: var(--color-text-secondary);
}
