/**
 * =============================================================================
 * CAPTCHA Instant Verification - Modern UI Styles
 * Location: assets/css/captcha-instant-verify.css
 * 
 * Features:
 * - Modern notification design
 * - Input state colors (success/error/loading)
 * - Shake animation
 * - Button state transitions
 * - Mobile-responsive
 * =============================================================================
 */

/* ========================================
   CAPTCHA Reload Button
   ======================================== */

.captcha-reload-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: auto;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.captcha-reload-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

[data-theme="dark"] .captcha-reload-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.captcha-reload-icon {
    display: inline-block;
    font-size: 1.15rem;
    line-height: 1;
    font-weight: 700;
}

.captcha-reload-btn:focus-visible {
    outline: 2px solid var(--primary, #6366f1);
    outline-offset: 2px;
    opacity: 1;
}

.captcha-reload-btn:active {
    transform: rotate(180deg) scale(0.95);
}

.captcha-reload-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.captcha-math-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

/* ========================================
   CAPTCHA Notification
   ======================================== */

.captcha-notification {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease;
}

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

.captcha-notification-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.captcha-notification-text {
    flex: 1;
}

/* Loading State */
.captcha-notification-loading {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    color: #1565c0;
}

.captcha-notification-loading .captcha-notification-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success State */
.captcha-notification-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid #81c784;
    color: #2e7d32;
}

/* Error State */
.captcha-notification-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 1px solid #e57373;
    color: #c62828;
}

/* ========================================
   Input States
   ======================================== */

.captcha-math-input {
    transition: all 0.3s ease;
}

/* Loading State */
.captcha-input-loading {
    border-color: #64b5f6 !important;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.15);
}

/* Success State */
.captcha-input-success {
    border-color: #66bb6a !important;
    box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
    background: #f1f8f4;
}

/* Error State */
.captcha-input-error {
    border-color: #ef5350 !important;
    box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.2);
    background: #fff5f5;
}

/* ========================================
   Shake Animation
   ======================================== */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.captcha-shake {
    animation: shake 0.5s ease;
}

/* ========================================
   Button States
   ======================================== */

/* Disabled State (default until CAPTCHA verified) */
.btn-disabled,
button[disabled][data-captcha-gate] {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    background: #9e9e9e !important;
    border-color: #757575 !important;
}

/* Enabled State (after CAPTCHA verified) */
.btn-enabled {
    opacity: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Upload Button Specific */
.upload-btn {
    transition: all 0.3s ease;
}

.upload-btn.btn-disabled {
    background: #bdbdbd !important;
    color: #757575 !important;
}

.upload-btn.btn-enabled {
    background: linear-gradient(135deg, #42a5f5 0%, #1976d2 100%) !important;
    color: white !important;
}

.upload-btn.btn-enabled:hover {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

/* Submit Button Generic */
button[type="submit"].btn-disabled {
    background: #bdbdbd !important;
    color: #757575 !important;
}

button[type="submit"].btn-enabled {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%) !important;
    color: white !important;
}

button[type="submit"].btn-enabled:hover {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 160, 71, 0.3);
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 768px) {
    .captcha-notification {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
        margin-top: 8px;
    }

    .captcha-notification-icon {
        font-size: 14px;
    }

    /* Stack notification text */
    .captcha-notification {
        flex-direction: row;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .captcha-notification {
        padding: 7px 10px;
        font-size: 11px;
    }

    /* Adjust input states for mobile */
    .captcha-input-success,
    .captcha-input-error,
    .captcha-input-loading {
        box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.15);
    }
}

/* ========================================
   CAPTCHA Widget Enhancements
   ======================================== */

.captcha-widget {
    position: relative;
    transition: all 0.3s ease;
}

/* Add subtle highlight when verification in progress */
.captcha-widget:has(.captcha-input-loading) {
    background: rgba(100, 181, 246, 0.03);
}

.captcha-widget:has(.captcha-input-success) {
    background: rgba(102, 187, 106, 0.03);
}

.captcha-widget:has(.captcha-input-error) {
    background: rgba(239, 83, 80, 0.03);
}

/* ========================================
   Accessibility
   ======================================== */

.captcha-notification[role="status"] {
    /* Screen reader announcements */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .captcha-notification-success {
        background: #c8e6c9;
        border: 2px solid #2e7d32;
    }

    .captcha-notification-error {
        background: #ffcdd2;
        border: 2px solid #c62828;
    }

    .captcha-notification-loading {
        background: #bbdefb;
        border: 2px solid #1565c0;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .captcha-notification,
    .captcha-math-input,
    .upload-btn,
    button[type="submit"] {
        transition: none;
    }

    .captcha-shake {
        animation: none;
    }

    .captcha-notification-loading .captcha-notification-icon {
        animation: none;
    }

    @keyframes slideDown {
        from, to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
