/**
 * Стили для Text Voice Reader
 */

/* ================================================
   Основной контейнер плеера
   ================================================ */

.text-voice-reader-container {
    position: relative;
    max-width: 100%;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
}

.text-voice-reader-container:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ================================================
   Панель управления
   ================================================ */

.voice-reader-controls {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    gap: 15px;
    flex-wrap: wrap;
}

.voice-reader-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.voice-reader-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.voice-reader-btn:active {
    transform: scale(0.95);
}

.voice-reader-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Иконки кнопок */
.play-icon, .pause-icon {
    font-size: 18px;
    margin-left: 2px; /* Центровка треугольника воспроизведения */
}

.pause-icon {
    margin-left: 0;
}

/* ================================================
   Прогресс бар
   ================================================ */

.voice-reader-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #fff 0%, #f0f0f0 100%);
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.progress-text {
    font-size: 12px;
    font-weight: 600;
    min-width: 35px;
    text-align: right;
    opacity: 0.9;
}

/* ================================================
   Контейнер текста
   ================================================ */

.voice-reader-text-container {
    position: relative;
    max-height: 400px;
    overflow-y: auto;
    padding: 0;
}

.voice-reader-text {
    padding: 30px;
    line-height: 1.8;
    font-size: 18px;
    color: #333;
    background: #fafafa;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ================================================
   Подсветка слов
   ================================================ */

.voice-reader-text .word {
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
    position: relative;
}

.voice-reader-text .word.current {
    background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%);
    color: #2c3e50;
    font-weight: 600;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: wordPulse 0.5s ease;
}

@keyframes wordPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1.05); }
}

/* ================================================
   Статус плеера
   ================================================ */

.voice-reader-status {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    font-size: 14px;
    color: #6c757d;
    text-align: center;
    font-style: italic;
}

/* ================================================
   Полноэкранный режим
   ================================================ */

.text-voice-reader-container.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.fullscreen-mode .voice-reader-text-container {
    flex: 1;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
}

.fullscreen-mode .voice-reader-text {
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 24px;
    line-height: 2;
    text-align: center;
    max-width: 80%;
    margin: 0 auto;
    padding: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
}

.fullscreen-mode .voice-reader-text .word.current {
    background: linear-gradient(120deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.1em;
}

.fullscreen-mode .voice-reader-controls {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
}

/* ================================================
   Адаптивность
   ================================================ */

@media (max-width: 768px) {
    .text-voice-reader-container {
        margin: 10px;
        border-radius: 8px;
    }
    
    .voice-reader-controls {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .voice-reader-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .voice-reader-text {
        padding: 20px 15px;
        font-size: 16px;
        line-height: 1.6;
    }
    
    .voice-reader-progress {
        min-width: 150px;
        order: 3;
        flex-basis: 100%;
        margin-top: 10px;
    }
    
    .fullscreen-mode .voice-reader-text {
        font-size: 20px;
        padding: 20px;
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .voice-reader-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .voice-reader-progress {
        order: 1;
        margin-top: 0;
        margin-bottom: 10px;
        width: 100%;
    }
    
    .voice-reader-text {
        font-size: 14px;
    }
    
    .fullscreen-mode .voice-reader-text {
        font-size: 18px;
        line-height: 1.8;
    }
}

/* ================================================
   Темная тема (опционально)
   ================================================ */

@media (prefers-color-scheme: dark) {
    .text-voice-reader-container {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .voice-reader-text {
        background: #1a202c;
        color: #e2e8f0;
    }
    
    .voice-reader-text .word.current {
        background: linear-gradient(120deg, #4299e1 0%, #667eea 100%);
        color: white;
    }
    
    .voice-reader-status {
        background: #2d3748;
        border-top-color: #4a5568;
        color: #a0aec0;
    }
}

/* ================================================
   Анимации загрузки
   ================================================ */

.voice-reader-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.voice-reader-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================================================
   Фокус и доступность
   ================================================ */

.text-voice-reader-container {
    outline: none;
}

.text-voice-reader-container:focus-within {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Скрытие скроллбара для лучшего вида */
.voice-reader-text-container::-webkit-scrollbar {
    width: 8px;
}

.voice-reader-text-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.voice-reader-text-container::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
}

.voice-reader-text-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #764ba2, #667eea);
}

/* ================================================
   Эффекты при наведении
   ================================================ */

.text-voice-reader-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.fullscreen-mode {
    transform: none !important;
}

/* ================================================
   Кастомные утилиты
   ================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}