/* Stream Panel — moveable & resizeable */
.stream-panel {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 360px;
  min-width: 200px;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.stream-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  border-radius: 12px 12px 0 0;
}

.stream-panel-header:active {
  cursor: grabbing;
}

/* Token status badge in stream panel header */
.stream-token-status {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-weight: 600;
  margin-left: auto;
  margin-right: 0.5rem;
}

.stream-token-status.token-valid {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.stream-token-status.token-expired {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.stream-token-status.token-none {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
}

.stream-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.stream-close:hover {
  color: #fff;
}

.stream-video-container {
  position: relative;
  flex: 1;
  min-height: 120px;
}

.stream-video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  border-radius: 0 0 12px 12px;
  object-fit: contain;
}

.stream-request-upgrade {
  display: block;
  margin-top: 8px;
  padding: 6px 14px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.stream-request-upgrade:hover {
  background: #4f46e5;
}

.stream-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  pointer-events: auto;
  border-radius: 0 0 12px 12px;
  transition: opacity 0.3s;
  text-align: center;
  padding: 8px;
}

.stream-status.hidden {
  opacity: 0;
}

.stream-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.stream-status-dot.connecting { background: #f59e0b; }
.stream-status-dot.requesting { background: #3b82f6; }
.stream-status-dot.error { background: #ef4444; animation: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Resize handle — bottom-right corner */
.stream-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 1;
}

.stream-resize-handle::after {
  content: '';
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.3);
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

/* Mobile: full-width stream panel */
@media (max-width: 480px) {
  .stream-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
  }
  .stream-resize-handle {
    display: none;
  }
}
