/**
 * Estilos para Sistema de Reconocimiento de Voz - NEXUS
 * @version 1.0
 * @date 2025-11-11
 */

/* === Botón de Voz - Estilo Minimalista === */
.voice-button {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e5e7eb;  /* Gris claro */
    border: none;
    color: #6b7280;  /* Gris medio para el icono */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin: 0 4px;  /* Margen reducido */
    box-shadow: none;
}

.voice-button:hover {
    background: #d1d5db;  /* Gris un poco más oscuro al hover */
    color: #4b5563;
}

.voice-button:active {
    transform: scale(0.95);
}

.voice-button.recording {
    background: #fee2e2;  /* Rojo claro */
    color: #ef4444;  /* Rojo para el icono */
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.voice-button .mic-icon,
.voice-button .recording-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* === Indicador de Grabación === */
.recording-indicator {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    white-space: nowrap;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #f5576c;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.recording-text {
    font-size: 14px;
    font-weight: 500;
}

.cancel-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    margin-left: 10px;
    transition: color 0.2s;
}

.cancel-btn:hover {
    color: #ff4444;
}

/* === Input recibiendo voz === */
.message-input.receiving-voice {
    border-color: #4CAF50 !important;
    background: linear-gradient(90deg,
        rgba(76, 175, 80, 0.05) 0%,
        rgba(76, 175, 80, 0.02) 100%);
    animation: voiceGlow 2s ease-in-out infinite;
}

@keyframes voiceGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    }
}

/* === Visualizador de Audio === */
#audio-visualizer {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 999;
}

/* === Notificaciones de Voz === */
.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background: #333;
    color: white;
    font-size: 14px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 300px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.voice-notification-error {
    background: #f44336;
}

.voice-notification-info {
    background: #2196F3;
}

.voice-notification-warning {
    background: #ff9800;
}

.voice-notification-success {
    background: #4CAF50;
}

.voice-notification.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* === Ajustes al formulario del chat === */
.message-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Responsive Mobile === */
@media (max-width: 768px) {
    .voice-button {
        width: 40px;
        height: 40px;
    }

    .recording-indicator {
        bottom: 70px;
        left: 10px;
        right: 10px;
        transform: none;
    }

    #audio-visualizer {
        width: 90%;
        left: 5%;
        transform: none;
    }

    .voice-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
    .voice-button {
        background: #374151;  /* Gris oscuro */
        color: #9ca3af;
    }

    .voice-button:hover {
        background: #4b5563;
        color: #d1d5db;
    }

    .voice-button.recording {
        background: #7f1d1d;  /* Rojo oscuro */
        color: #fca5a5;
    }

    .recording-indicator {
        background: rgba(45, 55, 72, 0.95);
    }

    #audio-visualizer {
        background: rgba(45, 55, 72, 0.95);
        border-color: #4a5568;
    }
}

/* === Accesibilidad === */
@media (prefers-reduced-motion: reduce) {
    .voice-button,
    .recording-indicator,
    .voice-notification {
        animation: none;
    }

    .voice-button.recording {
        animation: none;
        border: 2px solid #ef4444;  /* Borde rojo sólido en lugar de animación */
    }

    .recording-dot {
        animation: none;
        opacity: 1;
    }

    .message-input.receiving-voice {
        animation: none;
    }
}

/* === Indicador de permisos === */
.permission-required {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

.permission-required::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 5px solid #ff9800;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}

/* === Estados del botón === */
.voice-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-button:focus {
    outline: 2px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* === Tooltips mejorados === */
.voice-button[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

.voice-button[title]:hover::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    z-index: 1001;
    pointer-events: none;
}
