/**
 * Estilos para Sistema de Reconocimiento de Voz - NEXUS
 * Usa sistema de temas de themes.css
 */

/* === Botón de Voz - Estilo Minimalista === */
.voice-button {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg);
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    margin: 0 4px;
    box-shadow: none;
}

.voice-button:hover {
    background: var(--color-border);
    color: var(--color-text);
}

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

.voice-button.recording {
    background: var(--color-error-soft);
    color: var(--color-error);
    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: var(--color-text);
    color: var(--color-surface);
    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: var(--color-error);
    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: var(--color-error);
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    margin-left: 10px;
    transition: color var(--transition-fast);
}

.cancel-btn:hover {
    color: var(--color-error);
    filter: brightness(0.8);
}

/* === Input recibiendo voz === */
.message-input.receiving-voice {
    border-color: var(--color-success) !important;
    background: var(--color-success-soft);
    animation: voiceGlow 2s ease-in-out infinite;
}

@keyframes voiceGlow {
    0%, 100% {
        box-shadow: 0 0 5px var(--color-success-soft);
    }
    50% {
        box-shadow: 0 0 20px var(--color-success-soft);
    }
}

/* === Visualizador de Audio === */
#audio-visualizer {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

/* === Notificaciones de Voz === */
.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--radius-lg);
    background: var(--color-text);
    color: var(--color-surface);
    font-size: 14px;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    box-shadow: var(--shadow-lg);
    max-width: 300px;
}

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

.voice-notification-error {
    background: var(--color-error);
    color: white;
}

.voice-notification-info {
    background: var(--color-info);
    color: white;
}

.voice-notification-warning {
    background: var(--color-warning);
    color: white;
}

.voice-notification-success {
    background: var(--color-success);
    color: white;
}

.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 (usando clase .dark en body) === */
body.dark .voice-button {
    background: var(--color-surface);
    color: var(--color-text-muted);
}

body.dark .voice-button:hover {
    background: var(--color-border);
    color: var(--color-text);
}

body.dark .voice-button.recording {
    background: var(--color-error-soft);
    color: var(--color-error);
}

body.dark .recording-indicator {
    background: var(--color-surface);
    color: var(--color-text);
}

body.dark #audio-visualizer {
    background: var(--color-surface);
    border-color: var(--color-border);
}

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

    .voice-button.recording {
        animation: none;
        border: 2px solid var(--color-error);
    }

    .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: var(--color-warning);
    color: white;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
}

.permission-required::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 5px solid var(--color-warning);
    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 var(--color-accent-soft);
    outline-offset: 2px;
}

/* === Tooltips mejorados === */
.voice-button[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: var(--color-surface);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    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 var(--color-text);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    z-index: 1001;
    pointer-events: none;
}
