/* ===================================================
   TTS Reader & Navigation Stylesheet
   =================================================== */

/* --- 1. Navigationsbox (Feste Höhe, scrollbar) --- */
#tts-navigation {
  width: 320px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ccc;
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  font-family: sans-serif;
  font-size: 0.9em;
  margin-bottom: 20px;
}

.tts-nav-list,
.tts-nav-sublist {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
}

.tts-nav-sublist {
  padding-left: 18px;
  margin-top: 4px;
  margin-bottom: 6px;
}

.tts-nav-sublist.tts-collapsed {
  display: none;
}

.tts-nav-seite {
  margin-top: 8px;
  font-weight: bold;
}

.tts-nav-toggle {
  display: inline-block;
  width: 16px;
  cursor: pointer;
  user-select: none;
  color: #555;
  font-size: 0.8em;
}

.tts-nav-toggle:hover {
  color: #000;
}

.tts-nav-subitem {
  font-weight: normal;
  margin: 3px 0;
}

.tts-nav-subitem a {
  color: #333;
  text-decoration: none;
}

.tts-nav-subitem a:hover {
  text-decoration: underline;
}

/* --- 2. Highlight des aktiven Leseabschnitts --- */
.tts-active-chunk {
  background-color: #fff3a3;
  transition: background-color 0.3s ease;
  border-left: 4px solid #f39c12;
  padding-left: 4px;
}

/* --- 3. Schwebendes Bedienfeld (Fixed unten rechts) --- */
#tts-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #222;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  font-family: sans-serif;
  max-width: 380px;
}

.tts-controls button {
  background: #444;
  color: #fff;
  border: none;
  padding: 6px 12px;
  margin-right: 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1em;
}

.tts-controls button:hover {
  background: #666;
}

.tts-settings {
  margin-top: 8px;
  font-size: 0.85em;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tts-settings label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tts-settings select,
.tts-settings input {
  background: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 2px 4px;
  border-radius: 3px;
}

/* --- 4. Fortschrittsbalken & Restzeit-Anzeige --- */
.tts-progress-container {
  margin-top: 10px;
  width: 100%;
}

.tts-progress-bar {
  width: 100%;
  height: 6px;
  background-color: #444;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}

#tts-progress-fill {
  height: 100%;
  width: 0%;
  background-color: #4CAF50;
  transition: width 0.3s ease;
}

#tts-status-text {
  font-size: 0.75em;
  color: #ccc;
  display: flex;
  justify-content: space-between;
}
/* ==========================================
   Stimmen-Auswahl im Panel (Dropdowns)
   ========================================== */

.voice-selection-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.voice-selection-group label {
  font-size: 0.9em;
  font-weight: bold;
  color: inherit;
}

.voice-select {
  width: 100%;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
  color: #333;
  font-size: 0.9em;
  box-sizing: border-box;
  /* Verhindert, dass zu lange Stimmen-Namen das Panel aufbrechen */
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.voice-select:focus {
  outline: 2px solid #0056b3;
  border-color: #0056b3;
}
/* ==========================================
   Seiten-Navigation unter dem Panel
   ========================================== */

.tts-page-nav-container {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #ccc;
}

.tts-page-nav-title {
  font-size: 0.85em;
  font-weight: bold;
  margin-bottom: 6px;
  display: block;
}

.tts-page-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 150px; /* Begrenzt die Höhe bei vielen Seiten */
  overflow-y: auto;  /* Scrollbar falls nötig */
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tts-page-nav li {
  margin: 0;
  padding: 0;
}

.tts-page-nav button {
  background: #f0f0f0;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 0.8em;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.tts-page-nav button:hover,
.tts-page-nav button:focus {
  background: #0056b3;
  color: #fff;
  border-color: #003366;
  outline: 2px solid #0056b3;
}