/* ==========================================================================
   AHT Premium Math Captcha for Gravity Forms
   ========================================================================== */

.aht-math-captcha {
    display: block;
    width: 100%;
    max-width: 420px;
}

.aht-math-captcha__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Question Section */
.aht-math-captcha__question {
    display: inline-flex;
    align-items: center;
}

.aht-math-captcha__img {
    display: block;
    height: 38px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    -webkit-user-drag: none;
}

.aht-math-captcha__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 36px;
    padding: 0 8px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.aht-math-captcha__operator,
.aht-math-captcha__equals {
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
}

/* Input area */
.aht-math-captcha__input-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aht-math-captcha__input {
    width: 72px;
    height: 38px;
    padding: 0 10px;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    color: #0f172a;
    background: #ffffff;
    outline: none;
    margin: 0;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
}

.aht-math-captcha__input::-webkit-outer-spin-button,
.aht-math-captcha__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.aht-math-captcha__input:focus {
    border-color: #0284c7 !important;
    background: #ffffff;
}

.aht-math-captcha__input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

/* Refresh Button */
.aht-math-captcha__refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    outline: none;
    box-shadow: none;
}

.aht-math-captcha__refresh:focus,
.aht-math-captcha__refresh:active {
    outline: none;
    box-shadow: none;
    transform: none;
}

.aht-math-captcha__refresh:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.aht-math-captcha__refresh svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.aht-math-captcha__refresh--spinning svg {
    animation: aht-mcaptcha-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes aht-mcaptcha-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Validation Error Styling */

.aht-math-captcha__error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #dc2626;
}

.aht-math-captcha__error svg {
    flex-shrink: 0;
    color: #dc2626;
}

/* Hide Gravity Forms default duplicate validation message for Math Captcha field */
.gfield--type-aht_math_captcha .gfield_description.validation_message,
.gfield--type-aht_math_captcha .gfield_validation_message,
.gfield_validation_message[id*="validation_message_"] {
    display: none !important;
}

/* Responsive adjustment */
@media (max-width: 480px) {
    .aht-math-captcha__inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-bottom: 24px;
    }

    .aht-math-captcha__input-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .aht-math-captcha__input {
        flex: 1;
        width: auto;
    }
}