@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-color: #0b0d10;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1e1b4b 0%, #0b0d10 80%);
  --panel-bg: rgba(17, 20, 26, 0.75);
  --panel-border: rgba(255, 255, 255, 0.07);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.35);
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.35);
  --accent: #d946ef;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.6);
}

/* Grid Layouts */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.hero {
  text-align: center;
  margin-bottom: 3.5rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #fff 30%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 400;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Typography & Subheadings */
h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

h2 { font-size: 1.75rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5rem; }
h3 { font-size: 1.35rem; color: var(--secondary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #ef4444 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--danger-glow);
}

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

/* Badges & Status Indicators */
.status-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-offline {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-online {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: rgba(217, 70, 239, 0.1);
  color: var(--accent);
  border: 1px solid rgba(217, 70, 239, 0.2);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pulse {
  animation: pulse-ring 1.5s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.6; }
  100% { transform: scale(1.05); opacity: 0; box-shadow: 0 0 0 8px transparent; }
}

/* Logging & Terminals */
.console-container {
  background: #06070a;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.console-header {
  background: #0f1118;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.console-dots {
  display: flex;
  gap: 0.35rem;
}

.console-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

.console-title {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.console-body {
  height: 250px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scroll-behavior: smooth;
}

.log-entry {
  line-height: 1.4;
  word-break: break-all;
}

.log-time { color: #475569; margin-right: 0.5rem; }
.log-info { color: #38bdf8; }
.log-success { color: #34d399; }
.log-warn { color: #f43f5e; }
.log-sys { color: #c084fc; }

/* QR Code Section */
.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem;
  border: 2px dashed rgba(255, 255, 255, 0.08);
}

#qrcode {
  background: #fff;
  padding: 0.75rem;
  border-radius: 12px;
  margin: 1.25rem 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
}

.qr-link-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--secondary);
  background: rgba(6, 182, 212, 0.08);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-top: 0.5rem;
  word-break: break-all;
  border: 1px dashed rgba(6, 182, 212, 0.2);
}

/* Flow Chart / Visualizer */
.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 2rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: 1rem;
}

.node {
  padding: 0.75rem 1.25rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 120px;
}

.node.active {
  border-color: var(--secondary);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.arrow {
  color: var(--text-muted);
  font-weight: 800;
  font-size: 1.25rem;
}

/* Host Canvas Grid */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #030406;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 20px rgba(0,0,0,0.9);
}

#host-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  pointer-events: none;
  background: rgba(0,0,0,0.7);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
}

/* Mobile Client Video Frame */
.video-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

video#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Touchpad and Interactive Controls for Client */
.client-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: auto;
  touch-action: none;
}

.touch-indicator {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.4) 0%, rgba(6, 182, 212, 0) 70%);
  border: 1px solid var(--secondary);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
  z-index: 100;
}

.touch-indicator.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.3);
}

.floating-controls {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 20;
}

.floating-badge {
  pointer-events: auto;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 0.5rem 0.85rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.floating-btn {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  font-size: 1rem;
}

/* Step list UI */
.step-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255,255,255,0.01);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.03);
}

.step-num {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.step-desc strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 0.15rem;
}

/* Footer styling */
footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.8rem;
  color: #475569;
  border-top: 1px solid rgba(255,255,255,0.03);
  padding: 1.5rem 0;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--secondary);
}
