:root {
  --bg-dark: #F8FAFC; 
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-dock: rgba(255, 255, 255, 0.95);
  --bg-border: rgba(0, 0, 0, 0.08); 
  --primary-orange: #E35205;
  --primary-orange-light: #F57F20;
  --accent-brown: #8B4513;
  --accent-rose: #E11D48;
  --accent-emerald: #059669;
  --accent-amber: #D97706;
  --text-main: #0F172A; 
  --text-muted: #64748B; 
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body.call-mode {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Background Scene */
.video-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #F8FAFC;
}

.bg-blur-layer {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 0);
  background-size: 28px 28px;
  opacity: 1;
}

/* Start Overlay */
.start-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.overlay-logo {
  height: 120px;
  margin-bottom: 2rem;
  object-fit: contain;
}

.btn-start {
  padding: 1.2rem 2.5rem;
  font-size: 1.2rem;
  font-weight: bold;
  background: var(--primary-orange);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(227, 82, 5, 0.3);
  transition: transform 0.2s ease;
}

.btn-start:hover {
  transform: translateY(-3px);
}

/* Room Outer Container */
.room-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 1rem;
  gap: 0.85rem;
}

/* Call Header Bar */
.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-border);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  z-index: 10;
}

.call-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.anahuac-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.anahuac-img-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  transform-origin: left center;
  filter: drop-shadow(0 2px 8px rgba(227, 82, 5, 0.15));
}

.live-dot {
  width: 10px;
  height: 10px;
  background: var(--accent-rose);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.6);
  animation: liveBlink 1.5s infinite;
  margin-left: 1rem;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.call-timer {
  font-family: monospace;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--primary-orange);
  margin-left: 0.5rem;
  font-weight: 600;
}

.scenario-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(227, 82, 5, 0.1);
  border: 1px solid rgba(227, 82, 5, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-orange);
}

.quality-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* Call Body Layout */
.call-body {
  flex: 1;
  display: flex;
  gap: 1rem;
  min-height: 0;
}

/* Central Video Stage (FULL SCREEN AVATAR CONTAINER) */
.video-stage {
  flex: 1;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(circle at center, #1E293B 0%, #020617 100%);
  box-shadow: inset 0 0 100px rgba(0,0,0,0.8), 0 20px 40px rgba(0,0,0,0.2);
}

/* Stream Badges Overlay */
.stream-badge {
  position: absolute;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.85rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
  color: #E2E8F0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.top-left { top: 16px; left: 16px; }
.top-right { top: 16px; right: 16px; }

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.5);
}

/* FULL SCREEN AVATAR COVER */
.avatar-stream-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-cover {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Para que el cuerpo entero y la cara se vean sin recortarse */
  position: absolute;
  top: 0;
  left: 0;
  transform: scale(1.02); /* Evitar bordes blancos o cortes finos */
}

#did-video {
  display: none;
}

/* Live Captions Box */
.live-captions-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  z-index: 10;
}

.caption-speaker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-orange);
  margin-bottom: 0.25rem;
  letter-spacing: 0.05em;
}

.caption-text {
  font-size: 0.95rem;
  line-height: 1.45;
  color: #F8FAFC;
  font-weight: 600;
}

/* Self-View Picture in Picture */
.self-pip {
  position: absolute;
  bottom: 120px;
  right: 20px;
  width: 120px;
  height: 160px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.pip-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.pip-avatar {
  font-size: 2rem;
  margin: 0.5rem 0;
}

.pip-mic-status {
  font-size: 0.65rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

/* Call Sidebar Panel */
.call-sidebar {
  width: 380px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,0.03);
  z-index: 10;
}

.call-sidebar.hidden {
  display: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--bg-border);
}

.sidebar-header h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
}

.close-sidebar-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.sidebar-tabs {
  display: flex;
  background: rgba(241, 245, 249, 0.5);
  border-bottom: 1px solid var(--bg-border);
}

.sidebar-tabs .tab-btn {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.sidebar-tabs .tab-btn.active {
  color: var(--primary-orange);
  border-bottom: 2px solid var(--primary-orange);
  background: rgba(227, 82, 5, 0.05);
}

.sidebar-content {
  display: none;
  flex-direction: column;
  flex: 1;
  padding: 1rem;
  overflow: hidden;
}

.sidebar-content.active {
  display: flex;
}

.transcript-timeline {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-right: 0.3rem;
  margin-bottom: 1rem;
}

.transcript-msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.msg-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.msg-sender {
  font-weight: 700;
  color: var(--primary-orange-light);
}

.transcript-msg.user .msg-sender {
  color: var(--primary-orange);
}

.msg-text {
  background: rgba(241, 245, 249, 0.8);
  border: 1px solid var(--bg-border);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-main);
}

.sidebar-input-form {
  display: flex;
  gap: 0.5rem;
  background: #FFFFFF;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.sidebar-input-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
}

.send-icon-btn {
  background: var(--primary-orange);
  color: #FFFFFF;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(227, 82, 5, 0.3);
}

/* RAG Panel */
.rag-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.upload-dropzone {
  border: 2px dashed rgba(227, 82, 5, 0.3);
  background: rgba(227, 82, 5, 0.03);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.project-info-badge {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #059669;
}

.rag-laws-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.law-btn {
  background: #FFFFFF;
  border: 1px solid var(--bg-border);
  color: var(--text-main);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.law-btn:hover {
  border-color: var(--primary-orange);
  background: rgba(227, 82, 5, 0.03);
}

/* Bottom Control Dock */
.dock-footer {
  display: flex;
  justify-content: center;
  z-index: 10;
}

.dock-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-dock);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-border);
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.dock-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.dock-icon {
  font-size: 1.25rem;
}

.dock-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mic-btn.active-mic {
  background: rgba(227, 82, 5, 0.1);
  border-color: rgba(227, 82, 5, 0.2);
  color: var(--primary-orange);
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(227, 82, 5, 0.3); }
  70% { box-shadow: 0 0 0 10px rgba(227, 82, 5, 0); }
  100% { box-shadow: 0 0 0 0 rgba(227, 82, 5, 0); }
}

.end-call-btn {
  background: rgba(225, 29, 72, 0.1);
  border-color: rgba(225, 29, 72, 0.2);
  color: var(--accent-rose);
}

.end-call-btn:hover {
  background: rgba(225, 29, 72, 0.15);
}

/* Scenario Dropdown */
.dock-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 240px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.dropdown-menu.show {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dropdown-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-item:hover, .dropdown-item.active {
  background: rgba(227, 82, 5, 0.08);
  color: var(--primary-orange);
}
