/*
 * Copies .cwoa-cookie-notice__btn's pill style byte-for-byte (see class-cwoa-cookie-notice.php)
 * instead of relying on ambient .button classes: on the real account page this renders inside
 * #cwoa-app, whose broad "#cwoa-app button:not(...)" reset strips ANY <button> down to a plain
 * link look unless explicitly excluded \u2014 so this needs its own self-contained,
 * !important-guarded styling to render consistently everywhere the VAT field can appear.
 */
.cwoa-vat-check-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    /* nowrap on purpose: the field itself is full-column-width here, so wrap would always
       drop the button to its own line the moment field + button can't both fit at natural
       size. Instead the input shrinks (flex + min-width:0) so the button always stays put
       on the same row on desktop; only the dedicated mobile breakpoint below stacks them. */
    flex-wrap: nowrap;
}

.cwoa-vat-check-wrap input {
    flex: 1 1 auto;
    min-width: 0;
}

.cwoa-vat-check-btn,
button.cwoa-vat-check-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    flex: 0 0 auto;
    appearance: none !important;
    cursor: pointer !important;
    padding: 8px 20px !important;
    border-radius: 999px !important;
    font: inherit !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    white-space: nowrap;
    color: var(--cwoa-accent, #2271b1) !important;
    border: 1px solid color-mix(in srgb, var(--cwoa-accent, #2271b1) 38%, #e4e7ec) !important;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--cwoa-accent, #2271b1) 14%, #ffffff),
        color-mix(in srgb, #ffffff 94%, white)
    ) !important;
    box-shadow: none !important;
    text-decoration: none !important;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.cwoa-vat-check-btn:hover:not(:disabled),
.cwoa-vat-check-btn:focus-visible {
    border-color: color-mix(in srgb, var(--cwoa-accent, #2271b1) 55%, #e4e7ec) !important;
    transform: translateY(-1px);
}

.cwoa-vat-check-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.6;
    transform: none;
}

/* Result lives on the button itself (Yes/No label + color) instead of a message under the
   field: valid keeps the theme accent look (just a bolder fill), invalid switches to red. */
.cwoa-vat-check-btn.is-valid {
    color: #ffffff !important;
    border-color: var(--cwoa-accent, #2271b1) !important;
    background: var(--cwoa-accent, #2271b1) !important;
}

.cwoa-vat-check-btn.is-invalid {
    color: #ffffff !important;
    border-color: #c0392b !important;
    background: #c0392b !important;
}

.cwoa-vat-check-btn.is-valid:hover:not(:disabled),
.cwoa-vat-check-btn.is-valid:focus-visible {
    border-color: var(--cwoa-accent, #2271b1) !important;
}

.cwoa-vat-check-btn.is-invalid:hover:not(:disabled),
.cwoa-vat-check-btn.is-invalid:focus-visible {
    border-color: #c0392b !important;
}

.cwoa-vat-check-btn__spinner {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid color-mix(in srgb, var(--cwoa-accent, #2271b1) 30%, transparent);
    border-top-color: var(--cwoa-accent, #2271b1);
    animation: cwoa-vat-check-spin 0.85s linear infinite;
    display: none;
}

.cwoa-vat-check-btn.is-checking .cwoa-vat-check-btn__spinner {
    display: inline-block;
}

@keyframes cwoa-vat-check-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cwoa-vat-check-btn__spinner {
        animation: none !important;
    }
}

@media (max-width: 480px) {
    .cwoa-vat-check-wrap {
        flex-wrap: wrap;
    }
    .cwoa-vat-check-btn {
        flex: 1 1 100% !important;
    }
}
