/* reCAPTCHA Styling */
.recaptcha-container {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.recaptcha-wrapper {
    margin: 1.5rem 0;
    text-align: center;
}

.recaptcha-error {
    margin-bottom: 1rem;
    border-radius: 4px;
    padding: 1rem;
}

.recaptcha-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #666;
}

.recaptcha-loading .preloader-wrapper {
    margin-right: 1rem;
}

/* Responsive reCAPTCHA */
@media (max-width: 320px) {
    .recaptcha-container {
        transform: scale(0.85);
        transform-origin: center;
        margin: 0.5rem 0;
    }
}

@media (max-width: 280px) {
    .recaptcha-container {
        transform: scale(0.75);
        transform-origin: center;
        margin: 0.25rem 0;
    }
}

/* Loading state for forms with reCAPTCHA */
.form-loading {
    opacity: 0.7;
    pointer-events: none;
}

.form-loading .btn {
    position: relative;
}

.form-loading .btn::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

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

/* Disabled submit button state */
.btn[disabled],
.btn.disabled {
    background-color: #e0e0e0 !important;
    color: #9e9e9e !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

.btn[disabled]:hover,
.btn.disabled:hover {
    background-color: #e0e0e0 !important;
    box-shadow: none !important;
}

/* reCAPTCHA iframe adjustments for Material Design */
.recaptcha-container iframe {
    border-radius: 4px;
}

/* Error state styling */
.recaptcha-error-state .recaptcha-container {
    border: 2px solid #f44336;
    border-radius: 4px;
    padding: 0.5rem;
    background-color: #ffebee;
}

/* Attempt to blend Google's widget with our theme */
.recaptcha-container iframe {
    border-radius: 6px !important;
    overflow: hidden;
}

/* Create overlay effect to soften Google's green background */
.recaptcha-success-state .recaptcha-container {
    border: 2px solid #1976d2;
    border-radius: 8px;
    padding: 0.75rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
    transition: all 0.3s ease-in-out;
    position: relative;
}

/* Add subtle overlay to reduce green background prominence */
.recaptcha-success-state .recaptcha-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(25, 118, 210, 0.05);
    border-radius: 6px;
    pointer-events: none;
    z-index: 1;
}

/* Success badge in corner */
.recaptcha-success-state .recaptcha-container::after {
    content: "✓";
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #1976d2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: successPulse 0.6s ease-out;
    z-index: 2;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Success state with Material Design ripple effect in theme color */
.recaptcha-success-state .recaptcha-container::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(25, 118, 210, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: successRipple 0.8s ease-out;
}

@keyframes successRipple {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
    }
}

/* Enhanced success message with LabelHive branding */
.recaptcha-success-message {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.recaptcha-success-message::before {
    content: "🔒 ";
    margin-right: 0.5rem;
}

/* Alternative subtle styling that complements the Google widget */
.recaptcha-success-state-subtle .recaptcha-container {
    border: 2px solid #1976d2;
    border-radius: 6px;
    padding: 0.5rem;
    background: linear-gradient(135deg, #f8fbff 0%, #f3f8ff 100%);
    box-shadow: 0 1px 4px rgba(25, 118, 210, 0.1);
    transition: all 0.3s ease-in-out;
    position: relative;
}

.recaptcha-success-state-subtle .recaptcha-container::before {
    content: "✓";
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #1976d2;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    animation: successPulse 0.6s ease-out;
}

/* Dark theme support with LabelHive colors */
@media (prefers-color-scheme: dark) {
    .recaptcha-success-state .recaptcha-container {
        background: linear-gradient(135deg, #0d47a1 0%, #1565c0 100%);
        border-color: #42a5f5;
    }
    
    .recaptcha-success-message {
        background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    }
    
    .recaptcha-success-state-subtle .recaptcha-container {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        border-color: #42a5f5;
    }
}

/* Dark theme support for success state */
@media (prefers-color-scheme: dark) {
    .recaptcha-success-state .recaptcha-container {
        background: linear-gradient(135deg, #1f3a1f 0%, #2e5d2e 100%);
        border-color: #66bb6a;
    }
    
    .recaptcha-success-message {
        background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .recaptcha-error-state .recaptcha-container {
        background-color: #3a1f1f;
    }
    
    .recaptcha-success-state .recaptcha-container {
        background-color: #1f3a1f;
    }
}
