/* ── Math Captcha Widget ─────────────────────────────────────────── */

.captcha-wrapper {
    display: inline-block;
    margin-bottom: 6px;
}

/* Row: canvas + refresh button joined together */
.captcha-row {
    display: flex;
    align-items: stretch;
    border: 1px solid #bbb;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
}

#captchaCanvas {
    display: block;
    background: #f0f4f8;
}

.captcha-refresh {
    background: #00897b;
    color: #fff;
    border: none;
    padding: 0 12px;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
    flex-shrink: 0;
}

.captcha-refresh:hover {
    background: #00695c;
}

/* Answer input — same width as canvas, sits directly below */
.captcha-input {
    display: block;
    width: 180px;          /* matches canvas width */
    margin-top: 4px;
    padding: 5px 8px;
    font-size: 14px;
    border: 1px solid #bbb;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.captcha-input:focus {
    border-color: #00897b;
    box-shadow: 0 0 0 2px rgba(0,137,123,0.18);
}

/* Error state */
.captcha-input.captcha-error {
    border-color: #e53935 !important;
    box-shadow: 0 0 6px rgba(229,57,53,0.45) !important;
    background: #fff5f5 !important;
    animation: captcha-shake 0.5s ease;
}

@keyframes captcha-shake {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-7px); }
    30%  { transform: translateX(7px); }
    45%  { transform: translateX(-5px); }
    60%  { transform: translateX(5px); }
    75%  { transform: translateX(-3px); }
    90%  { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

/* Error message */
.captcha-error-msg {
    display: none;
    align-items: center;
    gap: 4px;
    color: #e53935;
    font-size: 12px;
    margin-top: 3px;
}

.captcha-error-msg .captcha-error-icon {
    font-weight: bold;
    font-size: 13px;
}
