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

:root {
  --bg-primary: #070814;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #00f0ff;
  --accent-purple: #bd00ff;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-bg-hover: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-border-focus: rgba(0, 240, 255, 0.4);
  --glass-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.5);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Background Glow Effects */
body::before, body::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  z-index: -1;
  filter: blur(150px);
  pointer-events: none;
}

body::before {
  background: radial-gradient(circle, rgba(189, 0, 255, 0.15) 0%, rgba(0,0,0,0) 70%);
  top: -10%;
  left: -10%;
}

body::after {
  background: radial-gradient(circle, rgba(0, 240, 255, 0.12) 0%, rgba(0,0,0,0) 70%);
  bottom: -10%;
  right: -10%;
}

/* Core Layout Container */
.container {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

/* Glassmorphism Card Style */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
  transform: skewX(-25deg);
  transition: 0.75s;
  pointer-events: none;
}

.card:hover::before {
  left: 120%;
}

/* Header Typography */
.header-area {
  text-align: center;
  margin-bottom: 8px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.25);
}

.logo-icon svg {
  width: 32px;
  height: 32px;
  fill: #fff;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Selection Portal View */
.portal-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.portal-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  position: relative;
  color: var(--text-main);
}

.portal-btn:hover {
  background: var(--glass-bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.portal-btn::after {
  content: '→';
  position: absolute;
  right: 24px;
  font-size: 20px;
  color: var(--text-muted);
  transition: var(--transition);
}

.portal-btn:hover::after {
  transform: translateX(4px);
  color: var(--accent-cyan);
}

.portal-btn-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.portal-btn:hover .portal-btn-icon {
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
}

.portal-btn-host:hover .portal-btn-icon {
  background: rgba(189, 0, 255, 0.1);
  color: var(--accent-purple);
}

.portal-btn-host:hover::after {
  color: var(--accent-purple);
}

.portal-btn-text h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.portal-btn-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Forms & Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.text-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 20px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 16px;
  transition: var(--transition);
  outline: none;
}

.text-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}

.text-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #00a8ff 100%);
  border: none;
  border-radius: 16px;
  padding: 16px 24px;
  color: #070814;
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(0, 240, 255, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 240, 255, 0.3);
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red) 0%, #c0392b 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.35);
}

.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Info Badges & Details */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  align-self: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background-color: var(--text-muted);
}

.status-dot.active {
  background-color: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green);
  animation: pulse 2s infinite;
}

.status-dot.connecting {
  background-color: var(--accent-yellow);
  box-shadow: 0 0 12px var(--accent-yellow);
  animation: pulse 1.5s infinite;
}

.status-dot.error {
  background-color: var(--accent-red);
  box-shadow: 0 0 12px var(--accent-red);
}

/* QR Code & Link Area */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  margin-top: 8px;
}

.qr-box {
  background: #fff;
  padding: 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.qr-link {
  font-size: 13px;
  color: var(--accent-cyan);
  text-decoration: none;
  word-break: break-all;
  text-align: center;
  transition: var(--transition);
}

.qr-link:hover {
  text-decoration: underline;
  opacity: 0.9;
}

/* Stats Card Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
}

.stat-value.latency-good { color: var(--accent-green); }
.stat-value.latency-medium { color: var(--accent-yellow); }
.stat-value.latency-bad { color: var(--accent-red); }

/* Audio Controls & UI */
.audio-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.volume-control {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.volume-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: var(--transition);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 240, 255, 0.4);
  transition: var(--transition);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Small Volume Slider for Connected Clients List */
.volume-slider-small {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  transition: var(--transition);
  margin: 0;
}

.volume-slider-small::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 240, 255, 0.4);
  transition: var(--transition);
}

.volume-slider-small::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Audio Visualizer Animation */
.visualizer-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
  margin: 16px 0;
}

.visualizer-bar {
  width: 6px;
  height: 10%;
  background: linear-gradient(to top, var(--accent-purple), var(--accent-cyan));
  border-radius: 3px;
  transition: height 0.05s ease;
}

.visualizer-bar.animating {
  animation: bounce 1.2s ease-in-out infinite alternate;
}

/* Dynamic animations for index of visualizer bars */
.visualizer-bar.animating:nth-child(1) { animation-delay: 0.1s; }
.visualizer-bar.animating:nth-child(2) { animation-delay: 0.4s; }
.visualizer-bar.animating:nth-child(3) { animation-delay: 0.2s; }
.visualizer-bar.animating:nth-child(4) { animation-delay: 0.6s; }
.visualizer-bar.animating:nth-child(5) { animation-delay: 0.3s; }
.visualizer-bar.animating:nth-child(6) { animation-delay: 0.5s; }
.visualizer-bar.animating:nth-child(7) { animation-delay: 0.1s; }
.visualizer-bar.animating:nth-child(8) { animation-delay: 0.4s; }

/* Connected Clients List */
.client-list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
}

.client-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.client-name {
  font-weight: 500;
}

.client-latency {
  color: var(--accent-green);
  font-weight: 600;
}

/* Animations */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0% { height: 10%; }
  100% { height: 100%; }
}

/* Footer & Back Link */
.footer-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin-top: 8px;
  align-self: center;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--accent-cyan);
}

/* Select dropdowns for PRO features */
.select-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.select-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

.select-input option {
  background: #070814;
  color: #fff;
}

.pro-card {
  border: 1px solid rgba(0, 240, 255, 0.15);
  background: rgba(0, 240, 255, 0.02);
  box-shadow: 0 8px 32px 0 rgba(0, 240, 255, 0.05);
}

.pro-badge {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}
.host-grid-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.host-left-col, .host-right-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

.host-footer-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
  margin-top: 8px;
}

.sig-badge-host {
  margin-top: 12px;
}

/* Tablet & Desktop Responsive Layout */
@media (min-width: 768px) {
  .host-container {
    max-width: 900px;
  }
  
  .host-container .card {
    padding: 40px;
    gap: 32px;
  }
  
  .host-container .header-area {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 24px;
    margin-bottom: 8px;
    position: relative;
  }
  
  .host-container .header-area img {
    margin-bottom: 0 !important;
  }
  
  .host-container .header-text-group h1 {
    margin-bottom: 4px;
  }
  
  .host-container .sig-badge-host {
    margin: 0;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .host-grid-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
  }
  
  .host-right-col {
    border-left: 1px solid var(--glass-border);
    padding-left: 32px;
  }
  
  .host-footer-divider {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
  }
}

/* Responsive Customizations */
@media (max-width: 480px) {
  .container {
    padding: 16px;
  }
  .card {
    padding: 24px;
  }
}

/* Auto-connect Autoplay Unlock Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 5, 12, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 24px;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 36px 28px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 240, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-room-id {
  font-family: var(--font-family);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  padding: 8px 24px;
  border-radius: 14px;
  border: 1px dashed rgba(0, 240, 255, 0.25);
  letter-spacing: 2px;
  margin: 6px 0 10px 0;
  box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.05);
}

