/* 
 * Simple, Robust CAPTCHA Fix
 * Maximum specificity override for Contact Form 7 Image CAPTCHA
 * Ensures CAPTCHA images are always properly displayed and clickable
 * Provides clear visual feedback for all states
 */

/* ==========================================================================
   Force CAPTCHA Display and Centering
   ========================================================================== */

/* Override CF7's default CSS with maximum specificity */
.wpcf7-captcha,
body .wpcf7-captcha {
    background: var(--wp--preset--color--accent-7) !important;
    border: 2px solid var(--wp--preset--color--accent-6) !important;
    border-radius: 8px !important;
    padding: 24px !important;
    text-align: center !important;
    position: relative !important;
    min-height: 120px !important;
    display: block !important;
    visibility: visible !important;
}

/* CAPTCHA images - force proper sizing and display */
.wpcf7-captcha img,
body .wpcf7-captcha img,
.wpcf7-captcha .wpcf7-captcha-img,
body .wpcf7-captcha .wpcf7-captcha-img {
    max-width: 40px !important;
    max-height: 40px !important;
    border: 1px solid var(--wp--preset--color--accent-5) !important;
    border-radius: 6px !important;
    margin: 0 auto 8px !important;
    display: block !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

/* CAPTCHA images - hover effects */
.wpcf7-captcha img:hover,
body .wpcf7-captcha img:hover,
.wpcf7-captcha .wpcf7-captcha-img:hover,
body .wpcf7-captcha .wpcf7-captcha-img:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-color: var(--wp--preset--color--accent-3) !important;
}

/* Radio buttons - force large, touch-friendly targets */
.wpcf7-captcha input[type="radio"] + label,
body .wpcf7-captcha input[type="radio"] + label {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 12px 16px !important;
    margin: 4px !important;
    border: 2px solid var(--wp--preset--color--accent-5) !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--wp--preset--color--base) !important;
    color: var(--wp--preset--color--contrast) !important;
    font-family: var(--wp--preset--font-family--manrope) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
}

/* Radio buttons - hover effects */
.wpcf7-captcha input[type="radio"]:hover + label,
body .wpcf7-captcha input[type="radio"]:hover + label {
    background: var(--wp--preset--color--accent-3) !important;
    border-color: var(--wp--preset--color--accent-3) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Radio buttons - checked state */
.wpcf7-captcha input[type="radio"]:checked + label,
body .wpcf7-captcha input[type="radio"]:checked + label {
    background: var(--wp--preset--color--accent-3) !important;
    border-color: var(--wp--preset--color--accent-3) !important;
    color: var(--wp--preset--color--base) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 2px 8px rgba(80, 58, 168, 0.2) !important;
}

/* Radio buttons - checkmark */
.wpcf7-captcha input[type="radio"]:checked + label::after,
body .wpcf7-captcha input[type="radio"]:checked + label::after {
    content: '✓' !important;
    position: absolute !important;
    top: 4px !important;
    right: 8px !important;
    color: var(--wp--preset--color--base) !important;
    font-weight: bold !important;
    font-size: 14px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Hide actual radio inputs completely */
.wpcf7-captcha input[type="radio"],
body .wpcf7-captcha input[type="radio"] {
    display: none !important;
}

/* Force form container to accommodate CAPTCHA */
.wpcf7 .wpcf7-captcha {
    padding-bottom: 40px !important;
}

/* CAPTCHA title styling */
.wpcf7-captcha::before {
    font-size: 16px !important;
    margin-bottom: 20px !important;
    text-align: center !important;
    font-family: var(--wp--preset--font-family--manrope) !important;
    font-weight: 600 !important;
    color: var(--wp--preset--color--contrast) !important;
}

/* Debug border for development */
.wpcf7-captcha-debug {
    border: 2px dashed #007cba !important;
    background: rgba(0, 124, 186, 0.1) !important;
    padding: 10px !important;
    margin: 10px 0 !important;
    border-radius: 4px !important;
    color: #007cba !important;
    font-family: var(--wp--preset--font-family--manrope) !important;
    font-size: 12px !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Mobile optimization */
@media (max-width: 768px) {
    .wpcf7-captcha img,
    body .wpcf7-captcha img,
    .wpcf7-captcha .wpcf7-captcha-img,
    body .wpcf7-captcha .wpcf7-captcha-img {
        max-width: 30px !important;
        max-height: 30px !important;
    }
    
    .wpcf7-captcha input[type="radio"] + label,
    body .wpcf7-captcha input[type="radio"] + label {
        min-width: 40px !important;
        min-height: 40px !important;
        padding: 8px 12px !important;
        margin: 2px !important;
        font-size: 13px !important;
    }
    
    .wpcf7-captcha::before {
        font-size: 14px !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wpcf7-captcha {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}