/* ===================================
   SISTEMA DE MICRÓFONO GLOBAL
   =================================== */

#globalMicrophoneContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.btn-microphone {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.btn-microphone:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-microphone:active {
    transform: translateY(-1px);
}

/* Estado: Escuchando */
.btn-microphone.listening {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse 1.5s ease-in-out infinite;
}

.btn-microphone.listening::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 3px solid #f5576c;
    animation: ripple 1.5s ease-out infinite;
}

/* Animación de pulso */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Animación de ondas */
@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Estado: Detenido */
.btn-microphone.stopped {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Estado: Error */
.btn-microphone.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mensaje de estado */
.microphone-status {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    max-width: 200px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
}

.microphone-status:empty {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    #globalMicrophoneContainer {
        bottom: 15px;
        right: 15px;
    }

    .btn-microphone {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .microphone-status {
        font-size: 11px;
        padding: 6px 12px;
        max-width: 150px;
    }
}

/* Efecto hover mejorado */
.btn-microphone i {
    transition: transform 0.3s ease;
}

.btn-microphone:hover i {
    transform: scale(1.1);
}

/* Indicador visual cuando está escuchando */
.btn-microphone.listening i {
    animation: micPulse 0.8s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Tooltip mejorado */
.btn-microphone::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(5px);
    margin-bottom: 10px;
    z-index: 10000;
}

.btn-microphone:hover::after {
    opacity: 1;
    transform: translateY(0);
}

/* Asegurar que esté por encima de todo */
#globalMicrophoneContainer * {
    z-index: 9999;
}
