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

:root {
    --azul-fondo: #1D42E9;
    --amarillo-texto: #FFFFFF; 
    --texto-oscuro: #2f3542;
    --verde-btn: #28a745; 
    --verde-btn-hover: #218838; 
    --rojo-btn: #dc3545; 
    --rojo-btn-hover: #c82333; 
    --blanco: #ffffff;
    --gris: #6c757d;
    --panel-bg: rgba(255, 255, 255, 0.1); 
    --font-stack: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--azul-fondo);
    color: var(--amarillo-texto);
    min-height: 100vh;
    padding: 20px;
}

.logo-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-header img {
    width: 160px;
    height: auto;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: transparent; 
    padding: 0; 
}

h1 {
    text-align: center;
    color: var(--amarillo-texto);
    margin-bottom: 2rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.top-panel {
    display: flex;
    gap: 2rem;
    align-items: stretch; 
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.panel h3 {
    color: var(--amarillo-texto);
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.2rem;
}

.panel-right {
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    gap: 1.5rem; 
    padding: 0;
    background: transparent;
    border: none;
}

.video-container { 
    max-width: 350px; 
    border-radius: 16px;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.full-width-panel {
    flex-basis: 100%; 
}

.panel-header {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 1rem; 
}

.panel-header h3 {
    margin-bottom: 0; 
    font-size: 1.2rem; 
}

.image-controls {
    display: flex;
    gap: 0.5rem; 
}

.control-btn {
    background: rgba(255, 255, 255, 0.2); 
    border: none;
    color: var(--amarillo-texto); 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    cursor: pointer;
    display: flex; 
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease; 
    padding: 0; 
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.4); 
}

.control-btn svg,
.video-mute-btn svg {
    width: 22px;
    height: 22px;
}

.video-modal {
  position: fixed; /* Se queda fijo en la pantalla */
  inset: 0; /* Abarca toda la pantalla (top, right, bottom, left) */
  background-color: rgba(10, 25, 47, 0.95); /* Fondo oscuro semitransparente */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000; /* Se asegura de que esté por encima de todo */
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Clase para ocultar el modal con una transición suave */
.video-modal.hidden {
  opacity: 0;
  pointer-events: none; /* Evita que se pueda interactuar con él cuando está oculto */
}

#intro-video {
  width: 90%;
  max-width: 800px; /* Limita el tamaño máximo en pantallas grandes */
  max-height: 80vh; /* Limita la altura para que no ocupe toda la pantalla */
  border-radius: 16px;
  border: 1px solid var(--amarillo-texto);
}

.modal-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
}

.modal-btn {
  background-color: var(--panel-bg);
  color: var(--amarillo-texto);
  border: 1px solid var(--amarillo-texto);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s ease;
}

.modal-btn:hover {
  background-color: var(--amarillo-texto);
  color: var(--azul-fondo);
}

.unmute-hint {
  margin-top: 1rem;
  color: var(--texto-oscuro);
  font-size: 0.9rem;
}

.btn.report-btn {
    background-color: var(--amarillo-texto);
    border-color: var(--amarillo-texto);
    color: var(--azul-fondo); 
    text-decoration: none; 
    display: inline-flex; 
    align-items: center;
}

.btn.report-btn:hover {
    background-color: #d4b100; 
    border-color: #d4b100;
}

.spinner-svg {
  animation: rotate 1s linear infinite;
  width: 1em; 
  height: 1em;
  margin-right: 0.5em; 
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

.video-container {
    position: relative; /* Necesario para posicionar el botón de mute encima */
}

.video-mute-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background-color: rgba(10, 25, 47, 0.7); /* Fondo semi-transparente */
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--texto-claro);
    opacity: 0.5;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.video-mute-btn:hover {
    opacity: 1;
    background-color: rgba(10, 25, 47, 0.9);
}

.video-mute-btn svg {
    width: 24px;
    height: 24px;
}

.btn.stop-style {
    background-color: #6c757d; 
    border-color: #6c757d;
}
.btn.stop-style:hover {
    background-color: #5a6268;
}

.btn:disabled {
    background-color: #4a5568; 
    border-color: #4a5568;
    color: #a0aec0;
    cursor: not-allowed;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
}

#agentVideo { width: 100%; height: 100%; object-fit: cover; }
#documentImage { width: 100%; border-radius: 8px; }

.controls-status-container { display: flex; flex-direction: column; gap: 1.5rem; }
.controls { display: flex; gap: 1rem; justify-content: center; }
.btn {
    padding: 12px 24px; border: none; border-radius: 50px;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff;
    margin-bottom: 2rem;
}
.btn.record { background: var(--verde-btn); color: var(--blanco); }
.btn.stop { background: var(--gris); color: var(--blanco); }
.btn:hover:not(:disabled) { transform: scale(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.status {
    display: none;
    text-align: center; padding: 1rem;
    background: var(--panel-bg); border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
#statusText, .transcript-box h4, .response-box h4 { display: none; }

.wave-bar { background: var(--amarillo-texto); }

.transcript-container {
    background: var(--panel-bg); padding: 1.5rem; border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.transcript-container h3 { text-align: center; font-size: 1.2rem; }

.transcript-response-wrapper { display: flex; gap: 1.5rem; margin-top: 1rem; }
.transcript-box, .response-box {
    flex: 1; background: rgba(0,0,0,0.2);
    padding: 1rem; border-radius: 8px;
}
.transcript, .response { min-height: 80px; line-height: 1.5; color: var(--amarillo-texto); }

@media (max-width: 900px) {
    .top-panel, .transcript-response-wrapper { flex-direction: column; }
    body { padding: 10px; }
}