/* =========================================================================
   SPRACHSTEUERUNG V13.2 - KONFLIKTFREIE CSS-KLASSEN
   ========================================================================= */
/* 🎯 Alle Klassen haben jetzt das Präfix "splr-" (Sprachsteuerung Lothar Reuter)
   um Konflikte mit anderen Plugins zu vermeiden */

/* === Hilfebox Style: Modern Blue Theme V2 (Konfliktfrei) === */
#splr-help-box {
  position: fixed !important; 
  bottom: 80px !important;    
  right: 20px !important;
  background: #1976D2; /* Sattes, modernes Blau */
  color: #FFFFFF;     /* Weißer Text für Kontrast */
  padding: 18px !important; /* Etwas mehr Padding */
  border: 2px solid #FFC107 !important; /* KRITISCH: Gelber Rand */
  border-radius: 12px; /* Abgerundete Ecken */
  box-shadow: 0 6px 15px rgba(0,0,0,0.4), 0 0 8px rgba(255,255,0,0.5); /* Optimierter Schatten */
  font-size: 14px;
  line-height: 1.5;
  max-width: 300px !important; /* KRITISCH: Breite erhöhen */
  width: 300px !important;     /* KRITISCH: Breite erhöhen */
  display: none;
  z-index: 10000 !important; /* Wichtig: Über allem liegen */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Styling für die Kopfzeile (mit Icons) */
#splr-help-box .splr-help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px; 
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

/* Icons */
#splr-help-box .splr-help-icon {
  cursor: pointer;
  font-size: 20px;
}

/* Icon für Einstellungen */
#splr-help-box .splr-settings-icon {
    color: #FFFF00 !important; /* Gelb */
}

/* Icon für Befehle (📚) */
#splr-help-box .splr-commands-icon { 
    color: #FFFFFF !important; /* Weiß */
    margin: 0 10px; 
}

/* Icon für Info (ℹ) */
#splr-help-box .splr-info-icon { 
    color: #A8D5FF !important; /* Helles Blau */
    margin-right: 10px;
}

/* Icon für Schließen (✖) */
#splr-help-box .splr-close-icon {
    color: #FF0000 !important; /* Rot */
}

/* Text-Container und List-Items */
#splr-help-box p, 
#splr-help-box ul {
  margin: 0 0 10px 0;
  color: white; 
}

#splr-help-box ul {
  list-style: none;
  padding-left: 0;
}

/* Stil für Befehls-Tags */
#splr-help-box code {
  background: #0d47a1;
  color: #FFF0B5;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

/* =========================================================================
   GOOGLE-STYLE WORD HIGHLIGHTING (KONFLIKTFREI)
   ========================================================================= */

.splr-word {
  display: inline;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 3px;
  padding: 2px 0;
}

/* Aktives Wort (wird gerade vorgelesen) - Google-Style */
.splr-word-active {
  background: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%) !important;
  color: #000000 !important;
  font-weight: 500 !important;
  padding: 3px 5px !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 8px rgba(132, 250, 176, 0.4) !important;
  transform: scale(1.02);
  position: relative;
  z-index: 1;
  animation: splr-wordPulse 0.3s ease-out;
}

/* Bereits gelesene Wörter (optional) */
.splr-word-read {
  color: #888888;
  opacity: 0.7;
}

/* =========================================================================
   V13.5 MITLESE-MARKIERUNG (Stil des Dokument-Vorlesers, Desktop + Handy)
   - gesprochene Wörter: grau (.splr-word-read, siehe oben)
   - grünes Fenster um das aktuelle Wort: .splr-word-block
   Feste Farben (hell-grün + dunkler Text), damit es auf hellen UND dunklen
   Seiten lesbar bleibt.
   ========================================================================= */
.splr-word-block {
  background: #b9efc9 !important;
  color: #183b28 !important;
  opacity: 1 !important;
  border-radius: 3px;
}

/* Handy: ruhiger Block, grüner Balken nur am Anfang; Zeilenhöhe und Textfluss bleiben unverändert */
@media (max-width: 600px) {
  .splr-word-block {
    border-radius: 2px;
    box-shadow: none !important;
    font-weight: inherit !important;
  }
  .splr-word-block-start {
    border-left: 4px solid #2f9e5b;
    padding-left: 4px;
    margin-left: -4px;
    border-radius: 2px 0 0 2px;
  }
}

/* Animation für Wort-Wechsel */
@keyframes splr-wordPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1.02); }
}

/* Mobile-optimiert */
@media (max-width: 768px) {
  .splr-word-active {
    padding: 4px 6px !important;
    font-size: 1.02em;
  }
}

/* Verhindert Layout-Shifts */
.splr-highlighting-active {
  line-height: 1.3 !important;
}

/* =========================================================================
   SPRACHSTEUERUNGS-BUTTON (Alte ID beibehalten - ist spezifisch genug!)
   ========================================================================= */

/* Button-Styles */
#sprachBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  
  /* Größe - 50px + 2px Border = 54px Gesamt (wie vorher) */
  width: 50px;
  height: 50px;
  /* box-sizing: border-box ENTFERNT - Border kommt ZUSÄTZLICH zu 50px */
  
  border-radius: 50%;
  border: 2px solid white;
  background-color: #4b0082; /* Standard: Indigo */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3), 0 0 10px rgba(255,255,255,0.5);
  z-index: 9999;
  transition: all 0.3s ease;

  /* 🆕 V13.4.1: Verhindert, dass ein langer Druck auf den Button (z.B. für die
     neue 5-Sekunden-Hilfebox-Geste) vom Browser/der App als "langer Druck auf
     das darunterliegende Bild" interpretiert wird (natives Bild-Kontextmenü
     "Bild kopieren/herunterladen/teilen", v.a. in In-App-Browsern wie
     WhatsApp/Instagram/Facebook). */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#sprachBtn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0,0,0,0.4), 0 0 15px rgba(255,255,255,0.6);
}

#sprachBtn:active {
  transform: scale(0.95);
}

/* =========================================================================
   🆕 V13.4.11: HALTE-FORTSCHRITTSRING (visuelles Feedback während des
   Haltens, bevor die 750ms-Stopp- bzw. 3s-Hilfebox-Geste tatsächlich
   auslöst - siehe startHoldVisual()/stopHoldVisual() in lr-sprachsteuerung.js)
   ========================================================================= */

#sprachBtn::after {
  content: '';
  position: absolute;
  inset: -5px;
  box-sizing: border-box;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(var(--splr-hold-color, #FFC107) calc(var(--splr-hold-progress, 0) * 1%), transparent 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

#sprachBtn.splr-holding::after {
  opacity: 1;
}

/* =========================================================================
   RESPONSIVE DESIGN
   ========================================================================= */

@media (max-width: 768px) {
  #splr-help-box {
    max-width: calc(100vw - 40px) !important;
    width: calc(100vw - 40px) !important;
    right: 20px !important;
  }
}

/* =========================================================================
   ACCESSIBILITY (A11Y)
   ========================================================================= */

/* Focus styles für Tastaturnavigation */
#sprachBtn:focus,
.splr-help-icon:focus {
  outline: 2px solid #2271b1;
  outline-offset: 2px;
}

/* =========================================================================
   PRINT STYLES (Verstecke UI-Elemente beim Drucken)
   ========================================================================= */

@media print {
  #splr-help-box,
  #sprachBtn {
    display: none !important;
  }
}

/* =========================================================================
   HIGH CONTRAST MODE (Barrierefreiheit)
   ========================================================================= */

@media (prefers-contrast: high) {
  #splr-help-box {
    border: 3px solid #FFC107 !important;
  }
  
  .splr-word-active {
    border: 2px solid #000000 !important;
  }
  
  #sprachBtn {
    border: 3px solid white !important;
  }
}

/* =========================================================================
   REDUCED MOTION (Barrierefreiheit)
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .splr-word,
  .splr-word-active,
  #sprachBtn {
    animation: none !important;
    transition: none !important;
  }
  
  .splr-word-active {
    transform: none !important;
  }

  #sprachBtn::after {
    transition: none !important;
  }
  
  @keyframes splr-wordPulse {
    0%, 100% { transform: none; }
  }
}
