/* =============================================================================
   Custom CF7 CAPTCHA — Front-End Styles
   ============================================================================= */

/* ── Wrapper ────────────────────────────────────────────────────────────────── */
.cfc-captcha-wrap {
    display: block;
    margin-top: 0.5em;
}

/* ── Widget container ───────────────────────────────────────────────────────── */
.cfc-captcha-widget {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ── Question label ─────────────────────────────────────────────────────────── */
.cfc-captcha-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.cfc-captcha-label::before {
    content: "🔒";
    font-size: 1rem;
    line-height: 1;
}

.cfc-captcha-question {
    color: #1a1a2e;
}

/* ── Answer input ───────────────────────────────────────────────────────────── */
.cfc-captcha-answer {
    width: 70px !important;
    padding: 0.35rem 0.5rem !important;
    border: 2px solid #aaa !important;
    border-radius: 4px !important;
    font-size: 1rem !important;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cfc-captcha-answer:focus {
    outline: none !important;
    border-color: #0073aa !important;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.2) !important;
}

/* Validation error state */
.cfc-captcha-answer.wpcf7-not-valid {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.2) !important;
}

/* ── Refresh button ─────────────────────────────────────────────────────────── */
.cfc-captcha-refresh {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: none;
    border: 1px solid #aaa;
    border-radius: 4px;
    color: #555;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.cfc-captcha-refresh:hover,
.cfc-captcha-refresh:focus {
    background-color: #0073aa;
    border-color: #0073aa;
    color: #fff;
    outline: none;
}

.cfc-captcha-refresh:active {
    background-color: #005a87;
    border-color: #005a87;
}

/* Loading spinner state */
.cfc-captcha-refresh.cfc-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
}

/* ── Validation error message ───────────────────────────────────────────────── */
.cfc-captcha-wrap .wpcf7-not-valid-tip {
    display: block;
    margin-top: 0.35rem;
    padding: 0.3rem 0.6rem;
    background-color: #fde8e8;
    border-left: 3px solid #dc3232;
    border-radius: 0 3px 3px 0;
    color: #dc3232;
    font-size: 0.85rem;
}

/* ── Dark-mode support ──────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .cfc-captcha-widget {
        background-color: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .cfc-captcha-label {
        color: #e0e0e0;
    }

    .cfc-captcha-question {
        color: #fff;
    }

    .cfc-captcha-answer {
        background-color: #333 !important;
        border-color: #666 !important;
        color: #fff !important;
    }

    .cfc-captcha-answer:focus {
        border-color: #4ea6d4 !important;
        box-shadow: 0 0 0 3px rgba(78, 166, 212, 0.25) !important;
    }

    .cfc-captcha-refresh {
        border-color: #666;
        color: #bbb;
    }

    .cfc-captcha-refresh:hover,
    .cfc-captcha-refresh:focus {
        background-color: #4ea6d4;
        border-color: #4ea6d4;
        color: #fff;
    }

    .cfc-captcha-wrap .wpcf7-not-valid-tip {
        background-color: #3a1a1a;
        color: #f08080;
        border-left-color: #f08080;
    }
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cfc-captcha-widget {
        flex-direction: column;
        align-items: flex-start;
    }
}
