/* ==========================================================================
   Radiant Video Studio - Cyber Glassmorphism Design System
   ========================================================================== */

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(14, 18, 29, 0.82);
  --bg-card-hover: rgba(22, 28, 46, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(0, 242, 254, 0.45);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-purple: #7928ca;
  --accent-pink: #ff0080;
  --accent-glow: 0 0 25px rgba(0, 242, 254, 0.4);
  --accent-live: #ef4444;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 24px;
  position: relative;
  user-select: none;
}

/* Ambient Animated Lighting */
.ambient-glow {
  position: fixed;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(140px);
  opacity: 0.18;
  z-index: 0;
  transition: all 1.2s ease;
}

.ambient-cyan {
  top: -150px;
  left: -150px;
  background: radial-gradient(circle, var(--accent-cyan), var(--accent-blue));
}

.ambient-purple {
  bottom: -150px;
  right: -150px;
  background: radial-gradient(circle, var(--accent-purple), var(--accent-pink));
}

/* Main Studio Layout Container */
.studio-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1240px;
  background: var(--bg-card);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  transition: max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-container.theater-mode {
  max-width: 98vw;
  grid-template-columns: 1fr;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top Studio Header */
.studio-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.02);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.35);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 242, 254, 0.25);
  margin-left: 8px;
  letter-spacing: 0.02em;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-tool {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-tool.active {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.btn-tool svg {
  width: 16px;
  height: 16px;
}

/* Left Section: Cinema Stage & Player */
.cinema-stage {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* Radiant Video Viewport */
.video-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: box-shadow 0.3s ease;
}

.video-viewport.is-playing {
  box-shadow: 0 20px 60px rgba(0, 242, 254, 0.15), 0 0 1px rgba(0, 242, 254, 0.3);
}

/* RadiantMP native container mount */
#rmp-player {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  inset: 0;
}

/* Ensure control bar and module icons are always clearly visible on hover */
.video-viewport:hover .rmp-control-bar,
#rmp-player:hover .rmp-control-bar,
.video-viewport:hover .rmp-module,
#rmp-player:hover .rmp-module {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  pointer-events: auto !important;
  z-index: 40 !important;
}

/* Position control bar securely inside the viewport with a gradient shadow */
.rmp-control-bar {
  z-index: 40 !important;
  bottom: 0 !important;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.4) 65%, transparent) !important;
}

/* Quality and Module Overlay area */
.rmp-module-overlay,
.rmp-module-overlays-area {
  z-index: 50 !important;
}

/* Custom Drag & Drop Overlay */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 14, 0.88);
  backdrop-filter: blur(12px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 2px dashed var(--accent-cyan);
  border-radius: var(--radius-md);
}

.drop-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.drop-overlay-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

/* Video Metadata Bar */
.video-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding: 0 4px;
}

.video-title-area {
  flex: 1;
  min-width: 0;
}

.video-headline {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-protocol {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 242, 254, 0.25);
}

.badge-live {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-live);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: none;
}

.badge-live.is-live {
  display: inline-block;
  animation: pulseLive 1.8s infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Quick Control Strip Below Video */
.studio-quick-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.strip-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.strip-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.chip-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}

.chip-btn.active {
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Right Section: Stream Showcase & Playlist */
.stream-panel {
  border-left: 1px solid var(--border-glass);
  background: rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-header {
  padding: 20px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-count {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: var(--bg-glass);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Local Video Upload Box */
.upload-box {
  margin: 14px 18px;
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: var(--transition-fast);
}

.upload-box:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.04);
}

.upload-box-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.upload-box-text svg {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

/* Scrollable Stream Cards */
.stream-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 20px 14px;
  max-height: 520px;
}

.stream-list::-webkit-scrollbar {
  width: 5px;
}

.stream-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
}

.stream-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  margin-bottom: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}

.stream-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass);
}

.stream-card.active {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--border-glass-active);
}

.card-poster-thumb {
  width: 72px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #111420;
}

.card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-title {
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  margin-bottom: 2px;
}

.stream-card.active .card-title {
  color: var(--accent-cyan);
}

.card-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-tag {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(79, 172, 254, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-card {
  background: #111522;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.18rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  margin-bottom: 12px;
  transition: border-color var(--transition-fast);
}

.input-field:focus {
  border-color: var(--accent-cyan);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #07090e;
  font-weight: 700;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-muted);
  border: 1px solid var(--border-glass);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Dedicated Settings Panel Elements */
.settings-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-glass);
}

.settings-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.settings-row label {
  color: var(--text-muted);
}

.settings-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.settings-select option {
  background: #111522;
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-val {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

/* Toast Message */
.toast-msg {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(16, 20, 31, 0.94);
  border: 1px solid var(--border-glass-active);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-cyan);
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive Queries */
@media (max-width: 960px) {
  .studio-container {
    grid-template-columns: 1fr;
    max-width: 600px;
  }
  .stream-panel {
    border-left: none;
    border-top: 1px solid var(--border-glass);
  }
}
