:root {
  --bg-dark: #0f0f13;
  --bg-panel: #1a1a20;
  --primary-accent: #e50914;
  /* Netflix/Live Red */
  --primary-hover: #b20710;
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border-radius: 12px;
  --transition: all 0.3s ease;
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
}

/* Base Layout */
.cast-interface {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  min-height: 80vh;
  /* Adjust based on your layout */
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

/* Header Section */
.cast-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.room-info-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-badge {
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 0.5rem 1.25rem;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.room-badge:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.room-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 0.5rem;
  letter-spacing: 0.5px;
}

#roomid {
  color: var(--text-main);
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: 700;
  letter-spacing: 1px;
}

.copy-icon {
  margin-left: 0.75rem;
  opacity: 0.5;
  width: 16px;
  height: 16px;
}

/* Share Button */
.btn-share {
  background-color: var(--primary-accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

.btn-share:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(229, 9, 20, 0.4);
}

.btn-share.active {
  background-color: var(--bg-panel);
  border: 1px solid var(--danger);
  color: var(--danger);
  box-shadow: none;
}

/* Video Player Container */
.stream-wrapper {
  width: 100%;
  position: relative;
}

#videoContainer {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Overlays (Spinner & Quality) */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  z-index: 20;
}

.loading-spinner.show {
  display: block;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.quality-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  z-index: 20;
}

.quality-badge.hd {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.quality-badge.offline {
  color: var(--danger);
}

/* Controls & Viewers Bar */
.controls-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dot.connecting {
  background-color: var(--warning);
  animation: pulse 1s infinite;
}

.dot.disconnected {
  background-color: var(--danger);
}

/* Dropdown styling */
.viewers-dropdown {
  position: relative;
}

.viewers-btn {
  background: transparent;
  color: var(--text-main);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: var(--transition);
}

.viewers-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu {
  position: absolute;
  bottom: 120%;
  /* Show above */
  right: 0;
  background: var(--bg-panel);
  min-width: 200px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 100;
}

.viewers-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.85rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Toast Notification */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Helper for animations */
@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .cast-interface {
    padding: 1rem;
  }

  .cast-header {
    flex-direction: column;
    align-items: stretch;
  }

  .room-info-container {
    justify-content: space-between;
  }

  .btn-share {
    width: 100%;
    justify-content: center;
  }

  .controls-bar {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .viewers-dropdown {
    width: 100%;
  }

  .viewers-btn {
    width: 100%;
    justify-content: space-between;
  }
}