/* ---- Live Page ---- */

.page__content--wide {
  max-width: 960px;
}

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.live-header__left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-header .page__title {
  margin-bottom: 0;
}

/* Join button - prominent, top right */
.live-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  animation: joinPulse 2s ease-in-out infinite;
}

.live-join-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.live-join-btn:hover {
  opacity: 0.85;
  animation: none;
}

.live-join-btn:active {
  transform: scale(0.97);
}

.live-join-btn.hidden {
  display: none;
}

@keyframes joinPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(0, 0, 0, 0); }
}

[data-theme="dark"] .live-join-btn,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .live-join-btn {
    animation-name: joinPulseDark;
  }
}

@keyframes joinPulseDark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 235, 229, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(240, 235, 229, 0); }
}

/* Status badge */
.live-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--tag-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.live-status.live {
  background: rgba(229, 69, 96, 0.1);
  color: #e54560;
  border-color: rgba(229, 69, 96, 0.3);
}

.live-status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.live-status.live .live-status__dot {
  background: #e54560;
  animation: live-pulse 1.8s ease-in-out infinite;
}

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

/* Video Stage */
.live-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.live-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Placeholder */
.live-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
}

.live-placeholder.hidden {
  display: none;
}

.live-placeholder__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-placeholder__icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-secondary);
  opacity: 0.5;
}

.live-placeholder__text {
  font-size: 0.95rem;
  font-weight: 500;
}

.live-placeholder__sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Camera Bubbles */
.live-bubbles {
  position: absolute;
  display: flex;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.live-bubbles.corner-bottomRight {
  bottom: 12px;
  right: 12px;
  flex-direction: row-reverse;
  align-items: flex-end;
}

.live-bubbles.corner-bottomLeft {
  bottom: 12px;
  left: 12px;
  flex-direction: row;
  align-items: flex-end;
}

.live-bubbles.corner-topRight {
  top: 12px;
  right: 12px;
  flex-direction: row-reverse;
  align-items: flex-start;
}

.live-bubbles.corner-topLeft {
  top: 12px;
  left: 12px;
  flex-direction: row;
  align-items: flex-start;
}

.live-bubble {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
  position: relative;
  border: 2px solid var(--border);
}

.live-bubble video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-bubble__label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Controls */
.live-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.live-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.live-btn:active {
  transform: scale(0.97);
}

.live-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.live-btn--primary {
  background: var(--text);
  color: var(--bg);
}

.live-btn--primary:hover {
  opacity: 0.85;
}

.live-btn--danger {
  background: #e54560;
  color: #fff;
}

.live-btn--danger:hover {
  background: #ff5577;
}

.live-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.live-btn--ghost:hover {
  color: var(--text);
  background: var(--tag-bg);
}

.live-btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.live-btn-icon svg {
  width: 18px;
  height: 18px;
}

.live-btn-icon:hover {
  border-color: var(--hover);
}

.live-btn-icon.muted {
  background: rgba(229, 69, 96, 0.1);
  border-color: rgba(229, 69, 96, 0.3);
  color: #e54560;
}

.live-btn-icon.hidden,
.live-btn.hidden {
  display: none;
}

/* Viewer count */
.live-viewers {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.live-viewers svg {
  opacity: 0.7;
  stroke: var(--text-secondary);
}

/* Modal */
.live-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all 250ms ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.live-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.live-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 360px;
  margin: auto;
  transform: translateY(10px) scale(0.98);
  transition: transform 250ms ease;
}

.live-modal-overlay.visible .live-modal {
  transform: translateY(0) scale(1);
}

.live-modal h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.live-modal p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.live-modal__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--card-bg);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

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

.live-modal__preview-off {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.live-modal__fields-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.live-modal__fields-row .live-modal__field {
  flex: 1;
  margin-bottom: 0;
}

.live-modal__field {
  margin-bottom: 0.6rem;
}

.live-modal__field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.live-modal__field input,
.live-modal__field select {
  width: 100%;
  padding: 8px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.live-modal__field input::placeholder {
  color: var(--text-secondary);
}

.live-modal__field input:focus,
.live-modal__field select:focus {
  border-color: var(--hover);
}

.live-modal__name-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.live-modal__name-row .live-modal__field {
  flex: 1;
  margin-bottom: 0;
}

.live-modal__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Toasts */
.live-toasts {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-toast {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  animation: live-toast-in 300ms ease forwards;
  max-width: 300px;
}

.live-toast.toast-error {
  border-color: rgba(229, 69, 96, 0.4);
  color: #e54560;
}

.live-toast.toast-success {
  border-color: rgba(61, 214, 140, 0.4);
  color: #2ba865;
}

[data-theme="dark"] .live-toast.toast-success {
  color: #66eeb0;
}

.live-toast.toast-out {
  animation: live-toast-out 250ms ease forwards;
}

@keyframes live-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes live-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* Responsive */
@media (max-width: 600px) {
  .live-header {
    flex-wrap: wrap;
  }

  .live-join-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  .live-join-btn span {
    display: none;
  }

  .live-stage {
    border-radius: 6px;
  }

  .live-bubble {
    width: 65px;
    height: 65px;
  }

  .live-btn span {
    display: none;
  }

  .live-btn-icon {
    width: 40px;
    height: 40px;
  }

  .live-modal {
    padding: 1.5rem;
    margin: 1rem;
  }
}
