/* Reset básico y tipografía */
:root {
  --primary-color: #2c3e50;
  --accent-color: #3498db;
  --bg-color: #f4f6f8;
  --text-color: #333;
  --white: #ffffff;
  --highlight: #ffeaa7;
  --active-word: #74b9ff;
}

body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.8;
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  padding: 70px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* Estilo para el formulario de búsqueda */
#searchForm {
  float: none !important;
  display: none;
  justify-content: flex-end;
  margin-bottom: 20px;
  gap: 10px;
}

#searchForm input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 200px;
  transition: width 0.3s ease;
}

#searchForm input[type="text"]:focus {
  width: 250px;
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

#searchForm input[type="submit"] {
  padding: 8px 16px;
  background-color: var(--accent-color);
  color: var(--white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
}

#searchForm input[type="submit"]:hover {
  background-color: #2980b9;
}

/* Estilo para el reproductor de video */
#hyperplayer {
  display: block;
  width: 100%;       /* Ocupa todo el ancho disponible */
  max-width: 55%;   /* Puedes cambiar esto (ej. 800px) para limitar el tamaño */
  margin: 0 auto 30px auto;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  border: none;
  aspect-ratio: 16 / 9; /* Mantiene la proporción del video automáticamente */
  height: auto;
}

/* Estilo para el contenedor de la transcripción */
#hypertranscript {
  background-color: var(--white);
  border: 1px solid #e1e4e8 !important; /* Override inline style */
  border-radius: 8px;
  padding: 30px !important; /* Override inline style */
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  font-size: 21px;
  height: 400px !important; /* Override inline style for consistent height */
  overflow-y: auto;
  scroll-behavior: smooth;
  max-width: 50%; /* Reduce el ancho máximo */
  margin-left: auto; /* Centra horizontalmente */
  margin-right: auto; /* Centra horizontalmente */
}

/* Estilización de la barra de desplazamiento para Webkit */
#hypertranscript::-webkit-scrollbar {
  width: 8px;
}

#hypertranscript::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#hypertranscript::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

#hypertranscript::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Estilo de los párrafos y palabras */
.hyperaudio-transcript p {
  margin-bottom: 24px;
  text-align: justify;
}

.hyperaudio-transcript span {
  cursor: pointer;
  padding: 2px 0;
  border-radius: 3px;
  /*transition: background-color 0.15s ease, color 0.15s ease;*/
}

.hyperaudio-transcript span:hover {
  background-color: #f0f0f0;
  color: #000;
}

/* Mejoras para las clases activas (overriding inline styles si es necesario o complementando) */
.hyperaudio-transcript .active {
  background-color: rgba(239, 239, 239, 0.5); /* Más sutil */
  /*transition: background-color 0.3s;*/
}

.hyperaudio-transcript .active > .active {
  background-color: var(--highlight) !important;
  color: #2c3e50;
  text-decoration: none !important;
  font-weight: 600;
  border-bottom: 2px solid var(--accent-color);
}

/* Estilo para el popover */
#popover {
  background-color: var(--white) !important;
  border: none !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
  padding: 12px !important;
  border-radius: 6px !important;
  font-family: inherit !important;
}

#popover a {
  color: var(--accent-color) !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

#popover a:hover {
  color: #2980b9 !important;
}

/* Diálogo */
dialog#clipboard-dialog {
  border: none;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  padding: 20px;
  max-width: 500px;
}

dialog#clipboard-dialog h3 {
  margin-top: 0;
  color: var(--primary-color);
}

dialog#clipboard-dialog button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

dialog#clipboard-dialog button:hover {
  background-color: #2980b9;
}

/* Layout horizontal para hyperplayer y hypertranscript */
@media (min-width: 900px) {
  body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
  }

  /* El formulario de búsqueda (u otro párrafo inicial) ocupa todo el ancho */
  body > p {
    grid-column: 1 / -1;
    width: 100%;
    display: none;
    /* Ajustes de altura y espaciado para el párrafo inicial */
    margin-top: 0;       /* Elimina el margen superior por defecto */
    margin-bottom: 20px; /* Controla el espacio debajo del párrafo */
    min-height: auto;    /* Puedes poner una altura fija (ej. 50px) si lo necesitas */
  }

  #hyperplayer {
    grid-column: 1 / 2;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  #hypertranscript {
    grid-column: 2 / 3;
    width: 100%;
    max-width: none;
    margin: 0;
    /* Ajustamos la altura si es necesario, o dejamos la del ID original */
  }
}
