/* ── L1 Agent Hero Panel ── */

.l1-hero-panel {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  height: 640px;          /* fixed height — enables inner scroll */
}

.l1-hero-panel--overlay {
  width: 100%;
  height: 100%;
  margin: 0;
}

/* ── Floating assistant FAB + overlay ── */
.l1-assistant-fab {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1060;
  width: 3.75rem;
  height: 3.75rem;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 8px 28px rgba(232, 93, 36, 0.45), 0 2px 8px rgba(26, 24, 22, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.l1-assistant-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 32px rgba(232, 93, 36, 0.5), 0 4px 12px rgba(26, 24, 22, 0.22);
}

.l1-assistant-fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.l1-assistant-fab-icon-close {
  display: none;
}

.l1-assistant-fab.is-open {
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(26, 24, 22, 0.35);
}

.l1-assistant-fab.is-open .l1-assistant-fab-icon-open { display: none; }
.l1-assistant-fab.is-open .l1-assistant-fab-icon-close { display: block; font-size: 1.25rem; }

.l1-assistant-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(232, 93, 36, 0.45);
  animation: l1-fab-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.l1-assistant-fab.is-open .l1-assistant-fab-pulse {
  display: none;
}

@keyframes l1-fab-pulse {
  0%   { transform: scale(1); opacity: 0.85; }
  70%  { transform: scale(1.22); opacity: 0; }
  100% { transform: scale(1.22); opacity: 0; }
}

.l1-assistant-overlay {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 1rem 1.5rem 6rem;
  pointer-events: none;
}

.l1-assistant-overlay.is-open {
  pointer-events: auto;
}

.l1-assistant-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 24, 22, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.l1-assistant-overlay.is-open .l1-assistant-backdrop {
  opacity: 1;
}

.l1-assistant-panel {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 2rem));
  height: min(640px, calc(100vh - 7.5rem));
  transform: translateY(1.25rem) scale(0.96);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.l1-assistant-overlay.is-open .l1-assistant-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.l1-chat-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.l1-overlay-close-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.l1-overlay-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

body.l1-assistant-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .l1-assistant-overlay {
    padding: 0.75rem 0.75rem 5.5rem;
    align-items: stretch;
    justify-content: stretch;
  }

  .l1-assistant-panel {
    width: 100%;
    height: min(640px, calc(100vh - 6.5rem));
  }

  .l1-assistant-fab {
    right: 1rem;
    bottom: 1rem;
    width: 3.35rem;
    height: 3.35rem;
    font-size: 1.3rem;
  }
}

/* ═══════════════════════════════
   LEFT — Chat side
═══════════════════════════════ */
.l1-chat-side {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--border);
  height: 100%;           /* fill panel height */
  overflow: hidden;       /* clip children */
  min-height: 0;
}

/* Top bar */
.l1-chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--ink);
  color: #fff;
}
.l1-chat-topbar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.l1-agent-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(232,93,36,0.3);
}
.l1-agent-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: #fff;
  line-height: 1.2;
}
.l1-agent-role {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
}

/* Status pill */
.l1-status-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
}
.l1-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7fffb0;
  animation: l1-pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes l1-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
.l1-status-pill.speaking .l1-status-dot { background: #f97316; animation: none; }

/* Capabilities bar */
.l1-capabilities-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}
.l1-cap-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.l1-cap-chip i { color: var(--accent); font-size: 0.7rem; }

/* Messages — scrollable, takes remaining height */
.l1-chat-messages {
  flex: 1;
  overflow-y: scroll;     /* always show scrollbar track */
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--cream);
  min-height: 0;
  scroll-behavior: smooth;
}
.l1-chat-messages::-webkit-scrollbar       { width: 5px; }
.l1-chat-messages::-webkit-scrollbar-track { background: var(--cream-deep); }
.l1-chat-messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.l1-chat-messages::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.l1-msg { display: flex; align-items: flex-end; gap: 0.5rem; }
.l1-msg--user { flex-direction: row-reverse; }

.l1-msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.l1-msg--user .l1-msg-avatar { background: var(--info-soft); color: var(--info); }

.l1-msg-bubble {
  max-width: 80%;
  padding: 0.6rem 0.9rem;
  border-radius: 14px 14px 14px 4px;
  font-size: 0.845rem;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.l1-msg--user .l1-msg-bubble {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  border-radius: 14px 14px 4px 14px;
}
.l1-msg-bubble.typing { color: var(--ink-muted); font-style: italic; }

/* Footer / input row */
.l1-chat-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--paper);
}
.l1-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.l1-start-btn:hover  { background: var(--accent-deep); transform: translateY(-1px); }
.l1-start-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.l1-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: border-color 0.15s;
}
.l1-input-wrap:focus-within { border-color: var(--accent); }
.l1-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.4rem 0.75rem;
  font-size: 0.845rem;
  color: var(--ink);
  outline: none;
}
.l1-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
  flex-shrink: 0;
}
.l1-send-btn:hover { background: var(--accent-deep); }

.l1-replay-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--ink-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.l1-replay-btn:hover { border-color: var(--accent); color: var(--accent); }
.l1-replay-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ═══════════════════════════════
   RIGHT — Video side
═══════════════════════════════ */
.l1-video-side {
  background: linear-gradient(160deg, #1a1816 0%, #2a1f1a 100%);
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  overflow: hidden;
  height: 100%;
}
.l1-video-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(232,93,36,0.18) 0%, transparent 65%);
  pointer-events: none;
}

.l1-video-frame {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}
.l1-video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.l1-video-overlay-tag {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,24,22,0.75);
  backdrop-filter: blur(6px);
  color: rgba(255,255,255,0.85);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.1);
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.l1-video-frame video.l1-speaking {
  filter: brightness(1.08);
}

/* ═══════════════════════════════
   Responsive
═══════════════════════════════ */
@media (max-width: 900px) {
  .l1-hero-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto 280px;
  }
  .l1-chat-side { border-right: none; border-bottom: 1px solid var(--border); }
  .l1-video-frame video { object-position: center center; }
}

/* ── Script bubble types ── */
.l1-step-header {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-softer);
  border: 1px solid rgba(232,93,36,0.18);
  border-radius: var(--radius-pill);
  padding: 0.3rem 1rem;
  margin: 0.25rem auto;
  max-width: 90%;
  letter-spacing: 0.01em;
}
.l1-system-bubble {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  background: var(--cream-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.85rem;
  margin: 0 auto;
  max-width: 95%;
}
.l1-success-bubble {
  text-align: center;
  font-size: 0.845rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(21,128,61,0.2);
  border-radius: var(--radius-lg);
  padding: 0.65rem 1rem;
  margin: 0.25rem 0;
}
