/**
 * TTS Player - Stylesheet
 * Version: 2.0
 * Kompakter, responsiver TTS Player für Websites
 * Optimiert mit CSS Custom Properties
 */

/* ============================================ */
/* CSS CUSTOM PROPERTIES - THEMES */
/* ============================================ */

/* Root: Standard Theme (Default) */
:root {
    --tts-color-primary: #667eea;
    --tts-color-secondary: #764ba2;
    --tts-shadow-base: rgba(102, 126, 234, 0.4);
    --tts-shadow-hover: rgba(102, 126, 234, 0.6);
}

/* Healthcare Theme */
.tts-theme-healthcare {
    --tts-color-primary: #16a085;
    --tts-color-secondary: #1abc9c;
    --tts-shadow-base: rgba(22, 160, 133, 0.4);
    --tts-shadow-hover: rgba(22, 160, 133, 0.6);
}

/* Corporate Theme */
.tts-theme-corporate {
    --tts-color-primary: #2c3e50;
    --tts-color-secondary: #34495e;
    --tts-shadow-base: rgba(44, 62, 80, 0.4);
    --tts-shadow-hover: rgba(44, 62, 80, 0.6);
}

/* Warm Theme */
.tts-theme-warm {
    --tts-color-primary: #f46b45;
    --tts-color-secondary: #eea849;
    --tts-shadow-base: rgba(244, 107, 69, 0.4);
    --tts-shadow-hover: rgba(244, 107, 69, 0.6);
}

/* ============================================ */
/* TTS PLAYER BUTTON */
/* ============================================ */

.tts-button {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--tts-color-primary) 0%, var(--tts-color-secondary) 100%);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px var(--tts-shadow-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tts-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--tts-shadow-hover);
}

.tts-button svg {
    width: 26px;
    height: 26px;
    fill: white;
}

/* ============================================ */
/* TTS PLAYER POPUP */
/* ============================================ */

.tts-player-popup {
    position: fixed;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
    /* Animation entfernt! */
}

.tts-player-popup.active {
    display: flex;
    animation: tts-fadeIn 0.3s ease;
}

/* Nur Opacity animieren, kein Transform! */
@keyframes tts-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================ */
/* PLAYER HEADER */
/* ============================================ */

.tts-player-header {
    background: linear-gradient(135deg, var(--tts-color-primary) 0%, var(--tts-color-secondary) 100%);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tts-player-title {
    font-size: 14px;
    font-weight: 600;
}

.tts-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tts-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================ */
/* PLAYER BODY */
/* ============================================ */

.tts-player-body {
    padding: 15px;
}

/* Status */
.tts-status {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    min-height: 18px;
}

.tts-status.loading {
    color: var(--tts-color-primary);
}

.tts-status.error {
    color: #e74c3c;
}

/* Timeline */
.tts-timeline {
    margin-bottom: 10px;
}

.tts-timeline-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.tts-timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--tts-color-primary) 0%, var(--tts-color-secondary) 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.tts-timeline-time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

/* Controls */
.tts-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.tts-control-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tts-control-btn:hover:not(:disabled) {
    border-color: var(--tts-color-primary);
    transform: scale(1.05);
}

.tts-control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tts-control-btn.primary {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--tts-color-primary) 0%, var(--tts-color-secondary) 100%);
    border: none;
}

.tts-control-btn.primary:hover:not(:disabled) {
    transform: scale(1.08);
}

.tts-control-btn.secondary {
    width: 38px;
    height: 38px;
}

.tts-control-btn svg {
    width: 18px;
    height: 18px;
    fill: #666;
}

.tts-control-btn.primary svg {
    width: 22px;
    height: 22px;
    fill: white;
}

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

/* Tablet: 481px - 768px */
@media (max-width: 768px) {
    .tts-button {
        width: 54px;
        height: 54px;
    }
    
    .tts-button svg {
        width: 24px;
        height: 24px;
    }
    
    .tts-player-popup {
        width: 320px;
        max-width: calc(100vw - 40px);
    }
    
    .tts-player-header {
        padding: 14px 16px;
    }
    
    .tts-player-title {
        font-size: 15px;
    }
}

/* Mobile: 391px - 480px */
@media (max-width: 480px) {
    .tts-button {
        width: 50px;
        height: 50px;
    }
    
    .tts-button svg {
        width: 22px;
        height: 22px;
    }
    
    .tts-player-popup {
        width: calc(100vw - 30px);
        max-width: 340px;
    }
    
    .tts-player-header {
        padding: 12px 14px;
    }
    
    .tts-player-title {
        font-size: 14px;
    }
    
    .tts-player-body {
        padding: 14px;
    }
    
    .tts-status {
        font-size: 11px;
        margin-bottom: 10px;
    }
    
    .tts-control-btn.primary {
        width: 52px;
        height: 52px;
    }
    
    .tts-control-btn.secondary {
        width: 42px;
        height: 42px;
    }
    
    .tts-control-btn.primary svg {
        width: 24px;
        height: 24px;
    }
    
    .tts-control-btn.secondary svg {
        width: 20px;
        height: 20px;
    }
}

/* Small Mobile: <= 390px */
@media (max-width: 390px) {
    .tts-button {
        width: 48px;
        height: 48px;
    }
    
    .tts-button svg {
        width: 20px;
        height: 20px;
    }
    
    .tts-player-popup {
        width: calc(100vw - 20px);
        max-width: none;
    }
    
    .tts-player-header {
        padding: 10px 12px;
    }
    
    .tts-player-title {
        font-size: 13px;
    }
    
    .tts-close-btn {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
    
    .tts-player-body {
        padding: 12px;
    }
    
    .tts-status {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .tts-timeline {
        margin-bottom: 8px;
    }
    
    .tts-timeline-bar {
        height: 6px;
    }
    
    .tts-timeline-time {
        font-size: 9px;
        margin-top: 3px;
    }
    
    .tts-controls {
        gap: 8px;
        margin-top: 10px;
    }
    
    .tts-control-btn.primary {
        width: 48px;
        height: 48px;
    }
    
    .tts-control-btn.secondary {
        width: 38px;
        height: 38px;
    }
    
    .tts-control-btn.primary svg {
        width: 22px;
        height: 22px;
    }
    
    .tts-control-btn.secondary svg {
        width: 18px;
        height: 18px;
    }
}

/* Extra Small: <= 320px (iPhone SE, alte Geräte) */
@media (max-width: 320px) {
    .tts-button {
        width: 44px;
        height: 44px;
    }
    
    .tts-button svg {
        width: 18px;
        height: 18px;
    }
    
    .tts-player-popup {
        width: calc(100vw - 16px);
    }
    
    .tts-player-header {
        padding: 8px 10px;
    }
    
    .tts-player-body {
        padding: 10px;
    }
    
    .tts-control-btn.primary {
        width: 44px;
        height: 44px;
    }
    
    .tts-control-btn.secondary {
        width: 36px;
        height: 36px;
    }
}