:root {
  /* Colors - Synced with Figma v2 */
  --bg-color: #15161B;
  --panel-bg: rgba(26, 32, 42, 0.7);
  /* Based on Figma #1A202A with opacity */
  --accent-color: #AEF2BD;
  /* Retake Mint */
  --accent-glow: rgba(174, 242, 189, 0.3);
  --danger-color: #FF4B4B;
  /* Figma Alert Red */

  --text-primary: #FFFFFF;
  --text-secondary: #9CA3AF;
  /* Figma secondary grey */
  --text-muted: #4B5563;
  /* Figma muted text */
  --border-color: rgba(255, 255, 255, 0.1);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);

  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Outfit', sans-serif;

  /* Layout */
  --header-height: 72px;
  /* Adjusted for v2 header scale */
  --sidebar-width: 320px;
  --panel-radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  background-image:
    linear-gradient(rgba(174, 242, 189, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(174, 242, 189, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 0% 0%, rgba(174, 242, 189, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(255, 75, 75, 0.05) 0%, transparent 50%);
  background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%;
}

#app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  height: 100vh;
  width: 100vw;
}

/* Header */
header {
  grid-column: 1 / span 2;
  border-bottom: 1px solid var(--border-color);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr auto;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  height: var(--header-height);
}

.search-container {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0 16px;
  height: 48px;
  margin: 0 24px;
  max-width: 600px;
}

.search-container input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px;
  width: 100%;
  outline: none;
  font-size: 0.95rem;
}

.search-container figma-icon {
  opacity: 0.5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-container img {
  height: 32px;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sidebar / Profile Settings */
aside {
  grid-row: 2;
  border-right: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.profile-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--panel-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all 0.3s ease;
  backdrop-filter: var(--glass-blur);
}

.profile-card:hover {
  border-color: rgba(174, 242, 189, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.avatar-container {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.avatar-container img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  object-fit: cover;
}

.edit-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent-color);
  color: #000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-group input,
.input-group textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
}

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

/* Main Dashboard Area */
main {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center, rgba(174, 242, 189, 0.03) 0%, transparent 70%);
}

/* Chat Section */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 12px;
}

/* Chat Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.message {
  display: flex;
  gap: 12px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--border-color);
}

.message-content {
  flex: 1;
}

.message-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-color);
  margin-bottom: 2px;
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.chat-input-area {
  margin-top: 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input-area input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  outline: none;
  font-size: 1rem;
}

/* Minimized Video Monitor */
.monitor-float {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 280px;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px;
  border: 2px solid var(--accent-color);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 50;
  cursor: move;
}

.monitor-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  font-size: 10px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  backdrop-filter: blur(4px);
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--danger-color);
}

.live-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--danger-color);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }

  100% {
    opacity: 1;
  }
}

.monitor-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 12px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent-color);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Action Buttons */
.btn {
  background: var(--accent-color);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-go-live {
  background: var(--danger-color);
  color: #fff;
}

.btn-go-live:hover {
  box-shadow: 0 8px 32px rgba(255, 75, 75, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
  color: #fff;
}

.nav-pod {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 8px;
  align-items: center;
}

/* Shared Scheduler/Schedule Grid System */
.scheduler-wrapper {
  margin-top: 20px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.scheduler-scroll {
  overflow-x: auto;
  position: relative;
}

.scheduler-grid {
  display: inline-block;
  min-width: 100%;
}

.time-header {
  display: flex;
  margin-left: 180px;
  /* Space for channel info */
  border-bottom: 1px solid var(--glass-border);
}

.time-label {
  width: 120px;
  flex-shrink: 0;
  padding: 10px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.channel-row {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
}

.channel-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--glass-border);
  position: sticky;
  left: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.channel-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--accent-color);
  background: #000;
}

.channel-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slots-container {
  display: flex;
}

.slot-cell {
  width: 120px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.slot-btn {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  gap: 4px;
  text-align: center;
  padding: 4px;
}

.slot-btn:hover:not(.booked-other) {
  border-color: var(--accent-color);
  background: rgba(174, 242, 189, 0.1);
  color: var(--accent-color);
}

.slot-btn.booked-mine,
.slot-btn.active {
  background: var(--accent-color);
  color: #000;
  border-color: var(--accent-color);
  font-weight: 700;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.slot-btn.booked-other {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  cursor: not-allowed;
  opacity: 0.8;
}

.login-scaffold {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 32px;
}

/* Global Utility Window Base (Floating) */
.utility-window {
  position: fixed;
  /* Use fixed for overlays to stay relative to viewport */
  background: rgba(15, 15, 15, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(174, 242, 189, 0.2);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.3s ease;
}

.utility-window.is-dragging {
  transform: scale(1.02);
  box-shadow: 0 0 30px rgba(174, 242, 189, 0.15);
  border-color: rgba(174, 242, 189, 0.4);
}

.utility-header {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.utility-title {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: 1px;
}

/* Agent Window Overrides */
.agent-window {
  width: 380px;
  height: 450px;
}

/* Chat Window Overrides */
.chat-window {
  width: 340px;
  height: 500px;
}

/* Monitor Window Overrides */
.monitor-float {
  width: 320px;
  height: 180px;
  /* Monitor content has unique padding/structure preserved from original */
}

.monitor-header {
  padding: 8px 12px;
  font-size: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  cursor: move;
}

/* Background Stage Layout */
.hosting-stage {
  position: fixed;
  top: 80px;
  /* Below Header */
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  z-index: 1;
  /* Below all utilities */
  background: #000;
}

#stageIframe {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

.agent-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 0.9rem;
}

.agent-message {
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 90%;
  line-height: 1.4;
}

.message-streamer {
  align-self: flex-end;
  background: rgba(174, 242, 189, 0.1);
  color: #fff;
  border: 1px solid rgba(174, 242, 189, 0.2);
}

.message-agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.agent-footer {
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--glass-border);
}

.prompt-input-group {
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 12px;
}

.prompt-input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  outline: none;
  font-size: 0.9rem;
}

.prompt-input-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-prompt {
  background: transparent;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.btn-prompt:hover:not(:disabled) {
  transform: scale(1.1);
}

.btn-prompt:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Legacy preview container styles removed/consolidated into .hosting-stage */

/* Stage Mode (Takover) */
.stage-container {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 24px;
  min-height: 0;
}

.monitor-large {
  flex: 1;
  background: #111;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.monitor-large.hidden {
  display: none !important;
}

/* Public View Specifics */
.viewer-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 24px;
}

.live-tag {
  background: var(--danger-color);
  color: #fff;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  animation: pulse 1.5s infinite;
}

.viewer-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.profile-display h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.profile-display p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.chat-input-placeholder {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.overlay-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
}
