﻿.ai-button {
    position: absolute;
    top: 40px;
    right: 15px;
    background: linear-gradient(135deg, #4285F4 0%, #34A853 50%, #FBBC05 100%);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    /* QA 56/41: 44px, the design system's minimum tap size. At 30px the design system's min-width of 44px
       turned the circle into a 44x30 oval in the fly-in. */
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.textarea-wrapper {
    position: relative;
}

    .textarea-wrapper .ai-button {
        top: 10px;
    }

    .textarea-wrapper > textarea {
        padding-right: 62px;
    }

    .ai-button i {
        font-size: 16px;
        transition: transform 0.3s ease-in-out;
    }

    .ai-button:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
    }

    .ai-button::after {
        content: attr(data-tooltip);
        visibility: hidden;
        background-color: rgba(0, 0, 0, 0.8);
        color: #fff;
        text-align: center;
        padding: 8px 12px;
        border-radius: 8px;
        position: absolute;
        /* QA 30: the tooltip sat above the button and covered the "AI Help" label and the field label
           above the box. It now opens to the left of the button, inside the text box area. */
        top: 50%;
        right: calc(100% + 8px);
        transform: translateY(-50%);
        width: max-content;
        max-width: 220px;
        white-space: normal;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
        font-size: 14px;
        font-family: 'Google Sans', Arial, sans-serif;
    }

    .ai-button:hover::after {
        visibility: visible;
        opacity: 1;
    }

.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 767.9px) {
    .ai-button {
        top: 70px;
    }
}