/* ==========================================================================
   GoWebRTC - Modern Dark Glassmorphism Design System
   ========================================================================== */

:root {
  --bg-dark: #090c15;
  --bg-surface: #101626;
  --bg-surface-elevated: #182035;
  --bg-glass: rgba(16, 22, 38, 0.75);
  --bg-glass-card: rgba(24, 32, 53, 0.65);
  --bg-glass-input: rgba(10, 14, 25, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(99, 102, 241, 0.35);

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --secondary: #06b6d4;
  --accent: #ec4899;

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-glow);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Ambient Background Blobs */
.app-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(120px);
  border-radius: 50%;
  opacity: 0.35;
  animation: floatBlobs 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  background: radial-gradient(circle, #6366f1, #3b82f6);
}

.blob-2 {
  width: 600px;
  height: 600px;
  bottom: -150px;
  right: -150px;
  background: radial-gradient(circle, #06b6d4, #8b5cf6);
  animation-duration: 25s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #ec4899, #6366f1);
  opacity: 0.15;
}

@keyframes floatBlobs {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.08); }
  100% { transform: translateY(30px) scale(0.95); }
}

/* Glassmorphism Helper */
.glassmorphism {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
}

/* Main Application Layout */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Header */
.app-header {
  height: 70px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(9, 12, 21, 0.85);
  backdrop-filter: blur(15px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  color: #a5b4fc;
}

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

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(135deg, #818cf8 0%, #38bdf8 50%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-icon-label:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-glass-hover);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-glass);
}

.status-badge.connected {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.status-badge.connected .status-indicator {
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.status-badge.disconnected .status-indicator {
  background-color: #f87171;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Main Content Area */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
}

.view-panel.active {
  display: flex;
}

/* Lobby View */
#view-lobby {
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.lobby-card {
  width: 100%;
  max-width: 480px;
  padding: 36px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.icon-orb {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
}

.lobby-header h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.lobby-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

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

.input-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 42px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-input);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: var(--transition-normal);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-input-action {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-input-action:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

/* Media Preview inside Lobby */
.preview-media-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 10px;
}

.preview-video-container {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: var(--radius-md);
  background: #000;
  border: 1px solid var(--border-glass);
  overflow: hidden;
}

.preview-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.preview-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  background: rgba(16, 22, 38, 0.85);
  font-size: 0.85rem;
}

.preview-toggles {
  display: flex;
  gap: 10px;
}

.btn-toggle-media {
  flex: 1;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-toggle-media.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.btn-toggle-media .icon-mic-off,
.btn-toggle-media .icon-cam-off {
  display: none;
}

.btn-toggle-media:not(.active) {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.btn-toggle-media:not(.active) .icon-mic-on,
.btn-toggle-media:not(.active) .icon-cam-on {
  display: none;
}

.btn-toggle-media:not(.active) .icon-mic-off,
.btn-toggle-media:not(.active) .icon-cam-off {
  display: block;
}

.btn-primary-gradient {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #06b6d4 100%);
  border: none;
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px var(--primary-glow);
  transition: var(--transition-normal);
}

.btn-primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px var(--primary-glow);
  filter: brightness(1.1);
}

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

.lobby-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.dot-green { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.dot-blue { width: 6px; height: 6px; border-radius: 50%; background: #38bdf8; }
.dot-purple { width: 6px; height: 6px; border-radius: 50%; background: #c084fc; }

/* Room Active Layout */
.room-layout {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

.video-grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  background: #07090f;
  padding: 16px;
  overflow: hidden;
}

.room-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  z-index: 2;
}

.room-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
  animation: pulseGlow 1.5s infinite;
}

.room-top-actions {
  display: flex;
  gap: 10px;
}

.btn-glass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.btn-glass:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-glass-hover);
}

.badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.badge-count.hidden {
  display: none;
}

/* Dynamic Video Grid */
.video-grid {
  flex: 1;
  display: grid;
  gap: 16px;
  width: 100%;
  height: calc(100% - 130px);
  position: relative;
  align-content: center;
  justify-content: center;
}

.video-grid.layout-1 {
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin: 0 auto;
}

.video-grid.layout-2 {
  grid-template-columns: repeat(2, 1fr);
}

.video-grid.layout-3,
.video-grid.layout-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.video-grid.layout-multi {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.video-card {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 200px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-normal);
}

.video-card:hover {
  border-color: var(--border-glass-hover);
}

.video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-card.local-feed video {
  transform: scaleX(-1);
}

.video-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
}

.participant-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.badge-local {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.5);
  font-weight: 500;
}

.participant-media-status {
  display: flex;
  gap: 6px;
}

.icon-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.icon-status.mic-on { background: #10b981; }
.icon-status.mic-off { background: #ef4444; }
.icon-status.cam-on { background: #38bdf8; }
.icon-status.cam-off { background: #ef4444; }

/* Fallback Avatar */
.avatar-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.avatar-fallback.hidden {
  display: none;
}

.avatar-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

/* Floating Controls Bar */
.floating-controls-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-ctrl {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-ctrl:hover {
  transform: scale(1.08);
  background: #242f4c;
}

.btn-ctrl.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #818cf8;
}

.btn-ctrl .icon-ctrl-off {
  display: none;
}

.btn-ctrl:not(.active):not(.danger) {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.btn-ctrl:not(.active):not(.danger) .icon-ctrl-on {
  display: none;
}

.btn-ctrl:not(.active):not(.danger) .icon-ctrl-off {
  display: block;
}

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

.btn-ctrl.danger:hover {
  background: var(--danger-hover);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

/* Sidebar: Chat & Files */
.room-sidebar {
  width: 360px;
  height: 100%;
  border-left: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  position: relative;
  z-index: 5;
  transition: var(--transition-normal);
}

.room-sidebar.collapsed {
  display: none;
}

.sidebar-header {
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-glass);
}

.sidebar-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
}

.tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

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

/* Chat Tab */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-system-notice {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  margin: 6px 0;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  gap: 3px;
}

.chat-msg.msg-incoming {
  align-self: flex-start;
}

.chat-msg.msg-outgoing {
  align-self: flex-end;
}

.msg-sender {
  font-size: 0.75rem;
  font-weight: 600;
  color: #818cf8;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.msg-incoming .msg-bubble {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.msg-outgoing .msg-bubble {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.msg-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  align-self: flex-end;
}

.chat-input-bar {
  padding: 14px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 8px;
  background: var(--bg-surface);
}

.chat-input-bar input {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--bg-glass-input);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
}

.chat-input-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

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

.btn-send:hover {
  background: var(--primary-hover);
}

/* Files Tab */
.file-upload-zone {
  margin: 16px;
  padding: 24px 16px;
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: var(--text-muted);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition-fast);
  position: relative;
}

.file-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.hidden-file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-limit-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.file-transfers-list {
  flex: 1;
  padding: 0 16px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-card {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.file-progress-bar {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.file-progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.1s ease;
}

.btn-file-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Modal Diagnostics */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-container {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-glass-hover);
  box-shadow: var(--shadow-lg);
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #818cf8;
}

.modal-title-group h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-main);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

.stat-value.highlight {
  color: #38bdf8;
}

.raw-stats-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
}

.raw-stats-box h4 {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.peers-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.empty-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  animation: slideInToast 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.info { border-color: rgba(99, 102, 241, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Mobile-First UX/UI Enhancements & Responsive Layout System
   ========================================================================== */

.mobile-only {
  display: none;
}

.sheet-drag-handle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* Touch Active Feedback */
button:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 90;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  .sidebar-backdrop.hidden {
    display: none;
    opacity: 0;
  }

  html, body {
    height: 100%;
    height: 100dvh;
    min-height: 100dvh;
    position: fixed;
    touch-action: manipulation;
  }

  .app-container {
    height: 100%;
    height: 100dvh;
  }

  /* Compact Mobile Header */
  .app-header {
    height: 58px;
    padding: 0 16px;
    padding-top: max(4px, env(safe-area-inset-top));
  }

  .brand-badge {
    display: none;
  }

  .brand-title {
    font-size: 1.15rem;
  }

  .btn-icon-label {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .btn-icon-label span {
    display: none;
  }

  .status-badge {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  /* Lobby on Mobile */
  #view-lobby {
    padding: 16px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .lobby-card {
    padding: 24px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
  }

  .lobby-header h2 {
    font-size: 1.35rem;
  }

  .lobby-header p {
    font-size: 0.85rem;
    margin-bottom: 18px;
  }

  .icon-orb {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
  }

  .preview-video-container {
    height: 160px;
  }

  /* Room Video Grid on Mobile */
  .video-grid-container {
    padding: 10px;
    padding-bottom: max(80px, calc(76px + env(safe-area-inset-bottom)));
  }

  .room-top-bar {
    margin-bottom: 8px;
  }

  .room-info-badge {
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .btn-glass {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .btn-glass span:not(.badge-count) {
    display: none;
  }

  /* Mobile Video Layout: Fullscreen / PIP */
  .video-grid {
    height: 100%;
    gap: 8px;
    display: flex;
    flex-direction: column;
  }

  .video-grid.layout-1 .video-card {
    height: 100%;
    width: 100%;
    border-radius: var(--radius-md);
  }

  /* 2-Person Call on Mobile: Floating Picture-in-Picture */
  .video-grid.layout-2 {
    position: relative;
    display: block;
    height: 100%;
    width: 100%;
  }

  .video-grid.layout-2 .remote-feed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: var(--radius-md);
  }

  .video-grid.layout-2 .local-feed {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 110px;
    height: 155px;
    z-index: 5;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: #000;
    transition: var(--transition-normal);
  }

  .video-grid.layout-2 .local-feed .participant-name {
    display: none;
  }

  .video-grid.layout-4,
  .video-grid.layout-multi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
  }

  .video-card {
    min-height: auto;
    border-radius: var(--radius-md);
  }

  /* Floating Bottom Controls on Mobile */
  .floating-controls-bar {
    bottom: max(14px, env(safe-area-inset-bottom));
    gap: 10px;
    padding: 8px 16px;
    background: rgba(16, 22, 38, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .btn-ctrl {
    width: 48px;
    height: 48px;
  }

  .btn-ctrl svg {
    width: 20px;
    height: 20px;
  }

  /* Bottom-Sheet Drawer for Mobile Chat & Files */
  .room-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 80vh;
    height: 80dvh;
    border-radius: 24px 24px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: none;
    box-shadow: 0 -15px 50px rgba(0, 0, 0, 0.85);
    z-index: 100;
    transform: translateY(0);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex !important;
  }

  .room-sidebar.collapsed {
    transform: translateY(105%);
    pointer-events: none;
  }

  .sheet-drag-handle {
    display: block;
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    margin: 10px auto 4px;
    flex-shrink: 0;
  }

  .sidebar-header {
    height: 52px;
    padding: 0 16px;
  }

  .chat-input-bar {
    padding: 10px 14px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .chat-input-bar input {
    height: 44px;
    font-size: 0.95rem;
  }

  .btn-send {
    width: 44px;
    height: 44px;
  }

  /* Modal on Mobile */
  .modal-container {
    padding: 20px 16px;
    max-height: 85vh;
    overflow-y: auto;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-value {
    font-size: 0.95rem;
  }
}

