/* ════════════════════════════════════════════════════════════
   AI Podcast Frontend — Dark Glassmorphism Theme
   ════════════════════════════════════════════════════════════ */

   @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Palette */
  --bg:         #0d0f14;
  --bg-surface: #141720;
  --bg-glass:   rgba(20, 23, 32, 0.72);
  --border:     rgba(255, 255, 255, 0.07);
  --accent:     #6c63ff;
  --accent-2:   #00cfb4;
  --danger:     #ff5f5f;
  --text:       #e4e6f0;
  --text-muted: #6b7280;
  --alex:       #6c63ff;   /* purple — Alex */
  --sam:        #00cfb4;   /* teal   — Sam  */

  /* Spacing */
  --radius:     12px;
  --radius-sm:  8px;

  /* Transitions */
  --ease:       cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:  var(--bg);
  color:       var(--text);
  min-height:  100vh;
  display:     flex;
  flex-direction: column;
  overflow-x:  hidden;
}

/* ── Scrollbars ──────────────────────────────────────────────── */
::-webkit-scrollbar        { width: 5px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(255,255,255,.12); border-radius: 4px; }

/* ── Top Bar ──────────────────────────────────────────────────── */
.top-bar {
  height:          52px;
  background:      var(--bg-surface);
  border-bottom:   1px solid var(--border);
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding:         0 1.25rem;
  position:        sticky;
  top:             0;
  z-index:         100;
  backdrop-filter: blur(12px);
}

.top-bar__brand  { display: flex; align-items: center; gap: .6rem; }
.top-bar__title  { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }

.top-bar__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.top-bar__dot.live {
  background: var(--danger);
  animation:  dot-pulse 1.8s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(1.3); }
}

.top-bar__meta { display: flex; align-items: center; gap: .8rem; }
.top-bar__viewers { font-size: .8rem; color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  border:        none;
  cursor:        pointer;
  font-family:   inherit;
  font-weight:   500;
  border-radius: var(--radius-sm);
  transition:    background .15s var(--ease), transform .1s;
}
.btn:active { transform: scale(.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #3d37c7);
  color:  #fff;
  padding: .45rem 1rem;
}
.btn--primary:hover { filter: brightness(1.12); }

.btn--ghost {
  background: rgba(255,255,255,.07);
  color:  var(--text);
  border: 1px solid var(--border);
  padding: .45rem .9rem;
}
.btn--ghost:hover { background: rgba(255,255,255,.12); }

.btn--sm   { font-size: .8rem; padding: .35rem .75rem; }
.btn--icon { background: transparent; color: var(--text); padding: .3rem; }
.btn--icon:hover { color: var(--accent); }

/* ── User Badge ──────────────────────────────────────────────── */
.user-badge    { display: flex; align-items: center; gap: .5rem; }
.user-badge__avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.user-badge__name { font-size: .85rem; font-weight: 500; }
.hidden { display: none !important; }

/* ── Layout ──────────────────────────────────────────────────── */
.layout {
  display:    flex;
  flex:       1;
  height:     calc(100vh - 52px);
  overflow:   hidden;
}

/* ── Stage ───────────────────────────────────────────────────── */
.stage {
  flex:       1;
  display:    flex;
  flex-direction: column;
  align-items: center;
  padding:    1.5rem 2rem;
  overflow-y: auto;
  gap:        1.2rem;
  position:   relative;
}

/* ── Speaker Avatars ─────────────────────────────────────────── */
.speakers {
  display:    flex;
  gap:        3rem;
  margin-top: .5rem;
}

.speaker {
  display:    flex;
  flex-direction: column;
  align-items: center;
  gap:        .5rem;
}

.speaker__avatar {
  position:      relative;
  width:         90px;
  height:        90px;
}

.speaker__initials {
  width:           90px;
  height:          90px;
  border-radius:   50%;
  border:          2px solid var(--border);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       2rem;
  font-weight:     700;
  background:      var(--bg-surface);
  transition:      box-shadow .3s var(--ease), border-color .3s;
}

.speaker__pulse {
  position: absolute;
  inset:    -4px;
  border-radius: 50%;
  border:   2px solid transparent;
  transition: all .3s var(--ease);
}

/* Speaking state */
.speaker--speaking .speaker__initials {
  border-color: currentColor;
}
.speaker--speaking .speaker__pulse {
  animation: speaker-ring 1.4s ease-in-out infinite;
}

#speaker-alex .speaker__initials   { color: var(--alex); }
#speaker-alex.speaker--speaking .speaker__initials { box-shadow: 0 0 0 3px rgba(108,99,255,.25); border-color: var(--alex); }
#speaker-alex .speaker__pulse      { border-color: var(--alex); }

#speaker-sam  .speaker__initials   { color: var(--sam); }
#speaker-sam.speaker--speaking .speaker__initials  { box-shadow: 0 0 0 3px rgba(0,207,180,.25); border-color: var(--sam); }
#speaker-sam  .speaker__pulse      { border-color: var(--sam); }

@keyframes speaker-ring {
  0%   { opacity:0; transform:scale(1); }
  40%  { opacity:.7; }
  100% { opacity:0; transform:scale(1.45); }
}

.speaker__name { font-weight: 600; font-size: .9rem; }
.speaker__role { font-size: .75rem; color: var(--text-muted); }

/* ── Caption Panel ───────────────────────────────────────────── */
.caption-panel {
  width:          100%;
  max-width:      680px;
  background:     var(--bg-glass);
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  padding:        1.1rem 1.4rem;
  backdrop-filter: blur(18px);
  min-height:     80px;
}

.caption-panel__speaker {
  font-size:    .75rem;
  font-weight:  600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color:        var(--text-muted);
  margin-bottom: .35rem;
}

.caption-panel__text {
  font-size:   1.05rem;
  line-height: 1.6;
  color:       var(--text);
  transition:  opacity .3s var(--ease);
}

/* ── Audio Controls ──────────────────────────────────────────── */
.audio-controls {
  display:     flex;
  align-items: center;
  gap:         .8rem;
  background:  var(--bg-surface);
  border:      1px solid var(--border);
  border-radius: 50px;
  padding:     .45rem 1.1rem;
}

.volume-wrap { display: flex; align-items: center; gap: .4rem; }
.volume-icon { opacity: .6; flex-shrink: 0; }

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width:      90px;
  height:     4px;
  border-radius: 2px;
  background: rgba(255,255,255,.2);
  cursor:     pointer;
  accent-color: var(--accent);
}

.stream-status {
  font-size:  .78rem;
  color:      var(--danger);
  font-weight: 600;
  opacity:    .9;
}

/* ── Chapter Panel ───────────────────────────────────────────── */
.chapter-panel {
  display:    flex;
  align-items: center;
  gap:        .6rem;
  background: rgba(108,99,255,.1);
  border:     1px solid rgba(108,99,255,.2);
  border-radius: 50px;
  padding:    .35rem 1rem;
  font-size:  .8rem;
}

.chapter-panel__label {
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size:  .7rem;
  color:      var(--accent);
  font-weight: 600;
}

.chapter-panel__title { color: var(--text); }

/* ── Reactions Bar ───────────────────────────────────────────── */
.reactions-bar {
  display:    flex;
  gap:        .5rem;
}

.reaction-btn {
  border:        none;
  background:    var(--bg-surface);
  border:        1px solid var(--border);
  border-radius: 50px;
  padding:       .35rem .7rem;
  font-size:     1.2rem;
  cursor:        pointer;
  transition:    transform .15s var(--ease), box-shadow .15s;
  user-select:   none;
}
.reaction-btn:hover  { transform: scale(1.2); box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.reaction-btn:active { transform: scale(.95); }

/* ── Reaction Burst Overlay ──────────────────────────────────── */
.burst-overlay {
  position:       absolute;
  inset:          0;
  pointer-events: none;
  overflow:       hidden;
  z-index:        50;
}

.burst-emoji {
  position:  absolute;
  bottom:    10%;
  font-size: 1.8rem;
  animation: emoji-rise 2.5s var(--ease) forwards;
  pointer-events: none;
}

@keyframes emoji-rise {
  0%   { opacity:1; transform:translateY(0) scale(1); }
  80%  { opacity:.7; }
  100% { opacity:0; transform:translateY(-60vh) scale(.7) rotate(calc(var(--twist,0) * 1deg)); }
}

/* ── Poll Widget ─────────────────────────────────────────────── */
.poll-widget {
  width:        100%;
  max-width:    500px;
  background:   var(--bg-glass);
  border:       1px solid rgba(108,99,255,.3);
  border-radius: var(--radius);
  padding:      1.1rem 1.3rem;
  backdrop-filter: blur(14px);
  animation:    reveal .3s var(--ease);
}

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

.poll-widget__question { font-weight: 600; margin-bottom: .7rem; }

.poll-widget__options { display: flex; flex-direction: column; gap: .5rem; }

.poll-option-btn {
  border:        none;
  border-radius: var(--radius-sm);
  padding:       .6rem .9rem;
  cursor:        pointer;
  font-family:   inherit;
  font-size:     .9rem;
  font-weight:   500;
  background:    rgba(108,99,255,.15);
  border:        1px solid rgba(108,99,255,.25);
  color:         var(--text);
  text-align:    left;
  transition:    background .15s, border-color .15s;
  position:      relative;
  overflow:      hidden;
}
.poll-option-btn:hover { background: rgba(108,99,255,.3); }
.poll-option-btn.voted { border-color: var(--accent); }

.poll-option-btn .poll-bar {
  position:   absolute;
  inset-block:    0;
  left:       0;
  background: rgba(108,99,255,.2);
  transition: width .4s var(--ease);
  z-index:   0;
}
.poll-option-btn .poll-btn-text { position: relative; z-index: 1; }

.poll-widget__timer { font-size: .75rem; color: var(--text-muted); margin-top: .6rem; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width:          340px;
  flex-shrink:    0;
  display:        flex;
  flex-direction: column;
  border-left:    1px solid var(--border);
  background:     var(--bg-surface);
  overflow:       hidden;
}

.sidebar__header {
  padding:         .8rem 1rem;
  border-bottom:   1px solid var(--border);
  font-weight:     600;
  font-size:       .85rem;
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  flex-shrink:     0;
}

.sidebar__viewer-count { font-size: .75rem; color: var(--text-muted); font-weight: 400; }

/* ── Chat Messages ───────────────────────────────────────────── */
.chat-messages {
  flex:       1;
  overflow-y: auto;
  padding:    .6rem .8rem;
  display:    flex;
  flex-direction: column;
  gap:        .3rem;
}

.chat-msg {
  font-size:   .85rem;
  line-height: 1.45;
  padding:     .2rem .3rem;
  border-radius: 4px;
  animation:   msg-in .2s var(--ease);
}
@keyframes msg-in {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:translateY(0); }
}

.chat-msg__user {
  font-weight: 600;
  margin-right: .35rem;
  font-size: .8rem;
}

.chat-msg--system { color: var(--text-muted); font-style: italic; font-size: .78rem; }
.chat-msg--question .chat-msg__user { color: var(--accent-2); }

.chat-msg--metadata {
  background:  rgba(108,99,255,.06);
  border-left: 2px solid var(--accent);
  padding:     .3rem .6rem;
  font-size:   .78rem;
  color:       var(--text-muted);
  font-style:  italic;
}

/* ── Ask Panel ───────────────────────────────────────────────── */
.ask-panel {
  border-top: 1px solid var(--border);
  padding:    .7rem .85rem;
  flex-shrink: 0;
}

.ask-panel__header {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  font-size:       .8rem;
  font-weight:     600;
  margin-bottom:   .5rem;
  color:           var(--text-muted);
}

.queue-badge {
  background: rgba(108,99,255,.25);
  color:      var(--accent);
  border-radius: 50px;
  padding:    .15rem .55rem;
  font-size:  .72rem;
  font-weight: 600;
}

.ask-panel__input-wrap { display: flex; gap: .5rem; align-items: flex-start; }

.ask-input {
  flex:            1;
  background:      rgba(255,255,255,.04);
  border:          1px solid var(--border);
  border-radius:   var(--radius-sm);
  color:           var(--text);
  font-family:     inherit;
  font-size:       .83rem;
  padding:         .45rem .65rem;
  resize:          none;
  transition:      border-color .2s;
}
.ask-input:focus  { outline: none; border-color: var(--accent); }

/* ── Chat Input ──────────────────────────────────────────────── */
.chat-input-wrap {
  border-top: 1px solid var(--border);
  padding:    .65rem .85rem;
  display:    flex;
  gap:        .5rem;
  flex-shrink: 0;
}

.chat-input {
  flex:        1;
  background:  rgba(255,255,255,.04);
  border:      1px solid var(--border);
  border-radius: var(--radius-sm);
  color:       var(--text);
  font-family: inherit;
  font-size:   .85rem;
  padding:     .45rem .65rem;
  transition:  border-color .2s;
}
.chat-input:focus  { outline: none; border-color: var(--accent); }
.chat-input:disabled { opacity: .45; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .layout       { flex-direction: column; height: auto; }
  .sidebar      { width: 100%; border-left: none; border-top: 1px solid var(--border); height: 45vh; }
  .stage        { padding: 1rem; }
  .speakers     { gap: 2rem; }
  .speaker__avatar,
  .speaker__initials { width: 70px; height: 70px; }
}
