/* reCAPTCHA container styling */
.comment-form-recaptcha {
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid #e1e1e1;
    clear: both;
}

/* reCAPTCHA label styling */
.comment-form-recaptcha-label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.comment-form-recaptcha-label .required {
    color: #d63638;
    font-weight: 400;
}

/* reCAPTCHA info text */
.comment-form-recaptcha-info {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    line-height: 1.4;
}

/* reCAPTCHA v2 widget container */
#comment_recaptcha_v2 {
    margin: 10px 0;
    min-height: 78px; /* Standard reCAPTCHA height */
}

/* General reCAPTCHA widget styling */
.comment-form-recaptcha .g-recaptcha {
    margin: 10px 0;
}

/* Ensure reCAPTCHA fits within comment form */
.comment-form-recaptcha iframe {
    max-width: 100%;
    border-radius: 3px;
}

/* Theme integration for popular themes */
.comment-form .comment-form-recaptcha {
    margin: 1em 0;
}

/* BuddyBoss Theme specific styling */
.buddyboss-theme .comment-form-recaptcha {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.buddyboss-theme .comment-form-recaptcha-label {
    color: #495057;
    margin-bottom: 12px;
}

/* WordPress default theme compatibility */
.wp-block-comments .comment-form-recaptcha,
.comment-respond .comment-form-recaptcha {
    margin: 1.5em 0;
    padding: 1em;
    background: #fafafa;
    border-left: 4px solid #0073aa;
}

/* Custom reCAPTCHA Error Messages */
.recaptcha-error-message {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.15);
    animation: slideInDown 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.recaptcha-error-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #c0392b, #e74c3c, #c0392b);
}

.recaptcha-error-content {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

.recaptcha-error-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.recaptcha-error-text {
    flex: 1;
    font-weight: 500;
}

.recaptcha-error-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.recaptcha-error-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.recaptcha-error-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .comment-form-recaptcha {
        margin: 15px 0;
        padding: 12px 0;
    }

    .comment-form-recaptcha-label {
        font-size: 13px;
    }

    .comment-form-recaptcha-info {
        font-size: 11px;
    }

    /* BuddyBoss Theme mobile adjustments */
    .buddyboss-theme .comment-form-recaptcha {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .comment-form-recaptcha {
        margin: 15px 0;
        padding: 10px 0;
    }

    .comment-form-recaptcha .g-recaptcha {
        transform: scale(0.77);
        transform-origin: 0 0;
    }

    #comment_recaptcha_v2 {
        transform: scale(0.9);
        transform-origin: 0 0;
    }

    .recaptcha-error-content {
        padding: 14px 16px;
        font-size: 13px;
    }

    .recaptcha-error-icon {
        font-size: 18px;
    }

    .recaptcha-error-close {
        width: 24px;
        height: 24px;
        font-size: 20px;
    }

    /* Adjust BuddyBoss theme mobile spacing */
    .buddyboss-theme .comment-form-recaptcha {
        padding: 12px;
        margin: 10px 0;
    }
}

/* Loading state styling */
.comment-form-recaptcha.loading {
    opacity: 0.7;
    pointer-events: none;
}

.comment-form-recaptcha.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .comment-form-recaptcha {
        border-top: 2px solid #000;
    }

    .comment-form-recaptcha-label {
        color: #000;
        font-weight: 700;
    }

    .comment-form-recaptcha-info {
        color: #000;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .comment-form-recaptcha {
        border-top-color: #444;
    }

    .comment-form-recaptcha-label {
        color: #e0e0e0;
    }

    .comment-form-recaptcha-info {
        color: #b0b0b0;
    }

    .buddyboss-theme .comment-form-recaptcha {
        background: #2a2a2a;
        border-color: #444;
    }

    .wp-block-comments .comment-form-recaptcha,
    .comment-respond .comment-form-recaptcha {
        background: #1a1a1a;
        border-left-color: #0073aa;
    }
}