/* Livestream experience styling */
:root {
  --live-bg: #0b0c11;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.08);
  --muted: #9ca3af;
  --accent: #ff3b30;
  --accent-2: #ff9f1c;
  --glass: rgba(255, 255, 255, 0.06);
}

.livestream-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 24px;
}

.live-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-title h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.live-title p {
  margin: 0;
  color: var(--muted);
}

.live-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-actions .ghost {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: #d1d5db;
}

.livestream-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.live-stage {
  background: radial-gradient(circle at 20% 20%, rgba(255, 59, 48, 0.15), transparent 45%),
              radial-gradient(circle at 80% 10%, rgba(255, 159, 28, 0.12), transparent 40%),
              var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.live-preview {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--panel-border);
  height: 420px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
}

.live-preview .preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.65));
}

.live-preview .preview-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.live-preview .meters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.meter {
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.meter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
  transform: scaleX(0.55);
  transform-origin: left;
}

.live-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.status-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: #e5e7eb;
  font-weight: 600;
  font-size: 13px;
}

.chip.live {
  background: rgba(255, 59, 48, 0.12);
  border-color: rgba(255, 59, 48, 0.4);
  color: #ffb4ad;
}

.chip.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #bbf7d0;
}

.chip.warn {
  background: rgba(255, 159, 28, 0.12);
  border-color: rgba(255, 159, 28, 0.4);
  color: #fde68a;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 6px rgba(255, 59, 48, 0.1);
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-actions button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, border 0.2s ease;
}

.status-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.18);
}

.livestream-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.meta-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  display: grid;
  gap: 6px;
}

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

.meta-card input,
.meta-card select,
.meta-card textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
  font-weight: 600;
}

.meta-card textarea {
  min-height: 72px;
  resize: vertical;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle {
  position: relative;
  width: 46px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.toggle input { display: none; }

.toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle input:checked + span {
  transform: translateX(22px);
  background: #10b981;
}

.section-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 800;
  font-size: 16px;
}

.rtmp-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.copy-group {
  display: grid;
  gap: 8px;
}

.copy-field {
  display: flex;
  gap: 10px;
}

.copy-field input {
  flex: 1;
}

.copy-field button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
  cursor: pointer;
  font-weight: 700;
}

.info-callout {
  padding: 14px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #c7d7ff;
  line-height: 1.5;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
}

.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }

.stat-value { font-size: 26px; font-weight: 800; }

.live-chat {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-tabs {
  display: flex;
  gap: 8px;
}

.chat-tab {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #e5e7eb;
  cursor: pointer;
  font-weight: 700;
}

.chat-tab.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--panel-border);
}

.chat-body {
  padding: 14px 12px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
}

.chat-message {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  display: grid;
  gap: 4px;
}

.chat-meta { color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center; }

.chat-text { font-weight: 600; }

.chat-composer {
  padding: 12px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
}

.chat-composer input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e5e7eb;
  font-weight: 600;
}

.chat-composer button {
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #10b981, #22d3ee);
  color: #0b0c11;
  font-weight: 800;
  cursor: pointer;
}

.viewer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
}

.viewer-row .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9333ea, #ec4899);
}

.viewer-row .meta {
  display: grid;
  gap: 2px;
}

.viewer-row .meta .name { font-weight: 700; }

.viewer-row .meta .tag { color: var(--muted); font-size: 12px; }

.gift-rail,
.reaction-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  overflow-x: auto;
  padding: 8px;
}

.rail-chip {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.schedule-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
}

.schedule-row { display: flex; align-items: center; gap: 10px; }

.schedule-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #e5e7eb;
  font-weight: 600;
}

.schedule-row button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .livestream-grid { grid-template-columns: 1fr; }
  .live-stage { order: -1; }
}

@media (max-width: 768px) {
  .livestream-shell {
    padding: 20px 16px;
    gap: 16px;
  }
  
  .live-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .live-title h2 {
    font-size: 22px;
  }
  
  .live-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .live-actions button {
    width: 100%;
  }
  
  .live-stage {
    padding: 16px;
  }
  
  .live-preview {
    height: 240px;
  }
  
  .live-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .rtmp-config {
    display: none;
  }
  
  .live-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .live-status-bar { 
    flex-direction: column; 
    align-items: flex-start; 
  }
  
  .live-preview { 
    height: 200px; 
  }
  
  .chat-composer { 
    flex-direction: column; 
    align-items: stretch; 
  }
  
  .chat-composer input {
    width: 100%;
  }
  
  .chat-composer button {
    width: 100%;
    padding: 12px;
  }
  
  .live-chat {
    max-height: 240px;
  }
  
  .gift-rail,
  .reaction-rail {
    gap: 6px;
    padding: 4px;
  }
  
  .livestream-grid {
    gap: 12px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .livestream-shell {
    padding: 12px 16px;
    gap: 12px;
  }
  
  .live-preview {
    height: 300px;
  }
}

