/*! (C) The Hyperaudio Project. MIT @license: en.wikipedia.org/wiki/MIT_License. */
/* Updated for Version 2.1 */

.hyperaudio-transcript .strikethrough {
  text-decoration: line-through;
}

.hyperaudio-transcript .annotation, .hyperaudio-transcript .parannotation{
  opacity: 0.7;
}

.hyperaudio-transcript .highlight {
  background-color: yellow;
}

.hyperaudio-transcript .highlight.active {
  background-color: lightGreen;
}

.hyperaudio-transcript  header {
  font-size: 200%;
}

/*.hyperaudio-transcript a {
  cursor: pointer;
  color: #000;
}*/


.hyperaudio-transcript a, a.link {
  border: 0px;
}

.hyperaudio-transcript .read {
  color: #000;
}

.hyperaudio-transcript .active > .active {
  color: #000;
}

.hyperaudio-transcript .unread {
  color: #777;
}

.hyperaudio-transcript .search-match {
  background-color: pink;
}

.hyperaudio-transcript .share-match {
  background-color: #66ffad;
}

.hyperaudio-transcript sub:before {
  content: '\231C';
}

.hyperaudio-transcript sub.highlight-duration:before {
  content: '\231D';
}

.hyperaudio-transcript h5 {
  font-size: 130%;
}

[data-m] {
  cursor: pointer;
}

.speaker {
  font-weight: bold;
}

/* Custom styles for Studia Omniavis player */
body {
  font-family: 'Roboto', sans-serif;
  background-color: #f0f2f5;
  color: #1c1e21;
  margin: 0;
}

.main-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  padding-bottom: 120px; /* Add space for the fixed player */
}

.player-container {
  margin-bottom: 16px;
}

/* Hide the native audio player, as it has no UI we need */
audio.media-player {
  display: none;
}

/* Style the video player frame, making it visible */
video.media-player {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Ensures video fits container without distortion */
  background-color: #000;
  cursor: pointer; /* Indicate it's clickable */
}

.floating-video-container {
  position: fixed;
  right: 20px;
  bottom: 120px; /* Positioned just above the control bar */
  width: 320px;
  max-width: 40vw; /* Responsive small size */
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  z-index: 999;
  transition: all 0.3s ease-in-out;
  background-color: #000;
}

.custom-player-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.custom-timeline {
  width: 100%;
  max-width: 760px; /* To align with main content */
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.timeline-progress {
  height: 100%;
  width: 0%;
  background-color: #ffc107;
  border-radius: 4px;
}

.main-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.main-controls button {
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
}

#play-pause-btn .icon {
  width: 32px;
  height: 32px;
}

#pip-btn .icon {
  width: 24px;
  height: 24px;
}

.time-controls button {
  background-color: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.time-display {
    font-size: 0.9rem;
    color: #555;
    min-width: 100px;
    text-align: center;
}

.hypertranscript-container {
  position: relative;
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hyperaudio-transcript {
  font-size: 1.15rem;
  line-height: 1.8;
}

.hyperaudio-transcript p {
  margin-bottom: 1.5em;
}

.hyperaudio-transcript .active>span.active {
  background-color: #ffc107;
  border-radius: 3px;
}

/* === Annotation Tools Styles === */

.transcript-wrapper {
  display: flex;
  position: relative;
}

.hypertranscript-container {
  flex-grow: 1;
}

/* Transcript Tools */

.text-chunk {
    display: flex; /* Use Flexbox for layout */
    justify-content: space-between; /* Push text and icons apart */
    align-items: flex-start; /* Align items to the top */
    margin-bottom: 0.5em; /* Add some space between chunks */
    gap: 16px; /* Space between text and icons */
}

.chunk-text-wrapper {
    flex-grow: 1; /* Allow text to take up available space */
}

.chunk-action-container {
    flex-shrink: 0; /* Prevent the icon container from shrinking */
    display: flex;
    align-items: center;
    gap: 4px;
    /* The container is no longer positioned absolutely */
}

.chunk-action-icon {
    width: 20px;
    height: 20px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease-in-out;
}

.chunk-action-icon:hover {
    color: #333;
}

.badge-container {
    display: flex;
    gap: 4px;
}

.chunk-badge {
    display: none; /* Hidden by default */
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1;
    color: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.chunk-badge.note-badge {
    background-color: #5bc0de; /* Info blue */
}

.chunk-badge.dialogue-badge {
    background-color: #5cb85c; /* Success green */
}

.chunk-badge svg {
    width: 12px;
    height: 12px;
}

.chunk-hover-highlight {
    background-color: #f0f0f0;
    border-radius: 3px;
}

.chunk-popover {
    position: absolute;
    display: none;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.chunk-popover ul {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.chunk-popover li {
    padding: 8px 16px;
    cursor: pointer;
}

.chunk-popover li:hover {
    background-color: #f5f5f5;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .text-chunk {
        /* On mobile, icons appear inline with text content */
        display: block;
    }

    .chunk-action-container {
        display: inline-flex;
        vertical-align: middle;
        margin-left: 8px; /* Space after the text */
    }
}

/* Stile per evidenziare il chunk di destinazione del segnalibro */
@keyframes highlight-fade {
  from {
    background-color: #ffc107;
  }
  to {
    background-color: transparent;
  }
}

.text-chunk.bookmark-highlight {
  animation: highlight-fade 10s ease-out;
}
