/**
 * Frontend Styles für LeichtOnline TTS Plugin
 * 
 * @package LeichtOnlineTTS
 * @since 1.0.0
 */

/* ==========================================================================
   TTS Audio Player Styles
   ========================================================================== */

/* Base Button Styling */
.icon-speaker {
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

/* Loading State */
.tts-loading .icon-speaker {
    animation: tts-pulse 1.5s infinite;
}

.tts-loading .icon-speaker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: tts-spin 1s linear infinite;
    z-index: 1;
}

/* Icon-Font Overrides */
.icon-speaker::before {
    content: "\e91d" !important; /* Speaker Icon */
}

.icon-close::before {
    content: "\e91e" !important; /* Close Icon */
}

/* Playing State - nur Animation, keine Farbänderung */
.tts-playing .icon-close {
    animation: tts-playing 2s infinite;
}

/* Alle anderen States - keine Farbänderungen */
.tts-loading .icon-speaker,
.tts-error .icon-speaker,
.icon-close {
    /* Behält Standard-Farbe des Themes */
}

/* Hover Effects */
.c-button:hover .icon-speaker,
.c-button:hover .icon-play,
.c-button:hover .icon-close {
    transform: scale(1.05);
}

.tts-playing .c-button:hover .icon-close {
    transform: scale(1.1);
}

.tts-loading .c-button:hover .icon-speaker {
    transform: scale(1.05);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes tts-pulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.6; 
        transform: scale(0.95);
    }
}

@keyframes tts-playing {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.08);
        opacity: 0.8;
    }
}

@keyframes tts-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Theme-specific Overrides
   ========================================================================== */

/* lo-leicht Theme */
.tts-theme-lo-leicht .tts-playing .icon-speaker {
    color: var(--color-primary, #007cba) !important;
}

/* Guidelines-spezifische Styles */
.single-guidelines .tts-playing .icon-speaker {
    color: #007cba !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .icon-speaker {
        /* Größere Touch-Targets auf Mobile */
        min-width: 44px;
        min-height: 44px;
    }
    
    .tts-loading .icon-speaker::after {
        width: 16px;
        height: 16px;
        margin: -8px 0 0 -8px;
        border-width: 3px;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Focus-States für Keyboard-Navigation */
.c-button:focus .icon-speaker {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .icon-speaker,
    .tts-loading .icon-speaker,
    .tts-playing .icon-speaker {
        animation: none !important;
        transition: none !important;
    }
    
    .tts-loading .icon-speaker::after {
        animation: none !important;
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .tts-playing .icon-speaker {
        color: #000 !important;
        background: #fff;
        border: 2px solid #000;
    }
    
    .tts-error .icon-speaker {
        color: #fff !important;
        background: #d63638;
    }
}

/* ==========================================================================
   Debug Styles (nur bei WP_DEBUG)
   ========================================================================== */

.tts-debug-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 9999;
    max-width: 300px;
}

.tts-debug-info h4 {
    margin: 0 0 5px 0;
    color: #fff;
    font-size: 13px;
}

.tts-debug-info ul {
    margin: 0;
    padding-left: 15px;
    list-style: none;
}

.tts-debug-info li {
    margin-bottom: 2px;
    font-family: monospace;
}

.tts-debug-info .status-true {
    color: #4caf50;
}

.tts-debug-info .status-false {
    color: #f44336;
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU-Acceleration für Animationen */
.icon-speaker {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Preload-Hint für Audio-Dateien */
.has-tts-content .icon-speaker {
    cursor: pointer;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .icon-speaker,
    .c-button--icon {
        display: none !important;
    }
}
