/* Estilos para la funcionalidad de voz al chat */

/* Panel de configuración de voz */
.voice-settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    max-width: 400px;
    width: 90%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.voice-settings-panel.show {
    opacity: 1;
    visibility: visible;
}

.voice-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.voice-settings-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-voice-settings {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.close-voice-settings:hover {
    background: rgba(255, 255, 255, 0.2);
}

.voice-settings-content {
    padding: 25px;
}

.voice-control-group {
    margin-bottom: 20px;
}

.voice-control-group:last-child {
    margin-bottom: 0;
}

.voice-control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.voice-control-group select,
.voice-control-group input[type="range"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.voice-control-group select:focus,
.voice-control-group input[type="range"]:focus {
    border-color: #667eea;
}

.voice-control-group input[type="range"] {
    padding: 0;
    height: 6px;
    background: #e0e0e0;
    border: none;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.voice-control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.voice-control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.voice-control-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Indicador de escucha */
.listening-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    padding: 30px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.listening-indicator.show {
    opacity: 1;
    visibility: visible;
}

.listening-content {
    text-align: center;
    color: white;
}

.listening-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #667eea;
    animation: pulse 1.5s infinite;
}

.listening-text {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.listening-waves {
    display: flex;
    justify-content: center;
    gap: 5px;
}

.wave {
    width: 4px;
    height: 20px;
    background: #667eea;
    border-radius: 2px;
    animation: wave 1.2s infinite ease-in-out;
}

.wave:nth-child(1) { animation-delay: 0s; }
.wave:nth-child(2) { animation-delay: 0.2s; }
.wave:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes wave {
    0%, 100% { height: 20px; }
    50% { height: 40px; }
}

/* Botón de entrada por voz */
#voiceInputBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

#voiceInputBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#voiceInputBtn i {
    font-size: 16px;
}

/* Botón de configuración de voz */
#voiceSettingsBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

#voiceSettingsBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#voiceSettingsBtn i {
    font-size: 16px;
}

/* Notificación de error */
.voice-error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #e74c3c;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    z-index: 10001;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Estados de los botones */
#voiceInputBtn.listening,
#boton-leer-moderno.speaking {
    background: #e74c3c !important;
    animation: pulse 1.5s infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .voice-settings-panel {
        width: 95%;
        margin: 20px;
    }
    
    .voice-settings-content {
        padding: 20px;
    }
    
    .listening-indicator {
        padding: 20px;
        margin: 20px;
    }
    
    .listening-icon {
        font-size: 36px;
    }
    
    .listening-text {
        font-size: 16px;
    }
}

/* Tema oscuro */
[data-theme="dark"] .voice-settings-panel {
    background: #2d3748;
    color: white;
}

[data-theme="dark"] .voice-control-group label {
    color: #e2e8f0;
}

[data-theme="dark"] .voice-control-group select {
    background: #4a5568;
    border-color: #718096;
    color: white;
}

[data-theme="dark"] .voice-control-group input[type="range"] {
    background: #4a5568;
}

[data-theme="dark"] .voice-control-group input[type="range"]::-webkit-slider-thumb {
    background: #4299e1;
}

[data-theme="dark"] .voice-control-group input[type="range"]::-moz-range-thumb {
    background: #4299e1;
}

/* Mejoras de accesibilidad */
.voice-control-group input[type="range"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.voice-control-group select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Animaciones adicionales */
.voice-settings-panel.show {
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Estados de carga */
.voice-control-group.loading {
    opacity: 0.6;
    pointer-events: none;
}

.voice-control-group.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
} 