/**
 * A1AI Voice Recognition Styles
 */

/* Wrapper that contains only the text input (and mic) so mic sits in bottom-right of text area */
.a1ai-voice-input-inner {
    position: relative;
    flex: 1;
    min-width: 0;
}

.a1ai-voice-input-inner .a1ai-chat-input,
.a1ai-voice-input-inner .a1ai-chatbot-input-field {
    width: 100%;
    box-sizing: border-box;
}

/* Mic Button - bottom right of text area only (inside .a1ai-voice-input-inner) */
.a1ai-mic-button {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-mic-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2271b1;
}

.a1ai-mic-button:focus,
.a1ai-mic-button:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.a1ai-mic-button.recording {
    color: #d63638;
    background: rgba(214, 54, 56, 0.1);
    animation: a1ai-pulse 1.5s ease-in-out infinite;
}

.a1ai-mic-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* Pulse animation for recording state */
@keyframes a1ai-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Transcript Indicator */
.a1ai-transcript-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #2271b1;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    max-width: 80%;
    animation: a1ai-slide-up 0.3s ease-out;
}

@keyframes a1ai-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.a1ai-listening-pulse {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: a1ai-listening-pulse 1s ease-in-out infinite;
}

@keyframes a1ai-listening-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.a1ai-transcript-text {
    font-weight: 500;
}

/* Voice Error Notification */
.a1ai-voice-error {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #d63638;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999999;
    font-size: 14px;
    max-width: 300px;
    animation: a1ai-slide-in 0.3s ease-out;
}

@keyframes a1ai-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Adjustments for free plugin chatbot */
.a1ai-chatbot-container .a1ai-input-wrapper {
    position: relative;
}

.a1ai-chatbot-container .a1ai-mic-button {
    right: 10px;
    bottom: 10px;
}

/* Adjustments for upgrade plugin chat */
.a1ai-chat-input-wrapper {
    position: relative;
}

.a1ai-chat-interface .a1ai-mic-button {
    right: 10px;
    bottom: 10px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .a1ai-mic-button {
        right: 8px;
        bottom: 8px;
        padding: 6px;
    }

    .a1ai-mic-icon {
        width: 18px;
        height: 18px;
    }

    .a1ai-transcript-indicator {
        bottom: 80px;
        max-width: 90%;
        font-size: 13px;
        padding: 10px 16px;
    }

    .a1ai-voice-error {
        top: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .a1ai-mic-button {
        color: #999;
    }

    .a1ai-mic-button:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #4f94d4;
    }

    .a1ai-mic-button.recording {
        color: #f86368;
        background: rgba(248, 99, 104, 0.2);
    }
}

/* Accessibility */
.a1ai-mic-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.a1ai-mic-button:disabled:hover {
    background: transparent;
    color: #666;
}

/* Hide mic button if voice recognition not supported */
.no-speech-recognition .a1ai-mic-button {
    display: none;
}
