/**
 * Adaptive Smart CAPTCHA - Styles
 * Modern, minimal styling for CAPTCHA challenge
 */

/* ========================================
   STEP 1: Checkbox Container Styles
   ======================================== */

.asc-captcha-checkbox-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.asc-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 12px 16px;
    max-width: 320px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asc-checkbox-wrapper:hover {
    border-color: #9ca3af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#asc-human-checkbox-woocommerce_login, #asc-human-checkbox-login{
    visibility: hidden;
}

.asc-human-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.asc-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

.asc-checkbox-box {
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    background: white;
    margin-right: 12px;
    transition: all 0.2s ease;
}

.asc-checkbox-box:hover {
    border-color: #9ca3af;
}

.asc-human-checkbox:checked + .asc-checkbox-label .asc-checkbox-box {
    background: #10b981;
    border-color: #10b981;
}

.asc-checkmark {
    width: 16px;
    height: 16px;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
    position: relative;
    left: 2px;    
    top: 2px;
}

.asc-human-checkbox:checked + .asc-checkbox-label .asc-checkmark {
    opacity: 1;
    transform: scale(1);
}

.asc-checkbox-text {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.asc-logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.asc-logo svg {
    width: 24px;
    height: 24px;
    color: #0ea5e9;
}

.asc-branding {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.asc-brand-name {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
}

.asc-links {
    display: flex;
    gap: 4px;
    font-size: 10px;
    color: #9ca3af;
}

.asc-link {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.asc-link:hover {
    color: #6b7280;
    text-decoration: underline;
}

.asc-checkbox-wrapper.verified {
    animation: asc-success-pulse 0.5s ease;
}

@keyframes asc-success-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ========================================
   STEP 2: Modal Overlay Styles
   ======================================== */

.asc-captcha-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.asc-captcha-modal.active {
    display: flex;
}

.asc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    animation: asc-fade-in 0.2s ease;
}

@keyframes asc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.asc-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: asc-slide-up 0.3s ease;
}

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

.asc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0px 24px;
    border-bottom: none;
}

.asc-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.asc-modal-close {
    background: none !important;
    border: none !important;
    font-size: 28px !important;
    color: #9ca3af !important;
    cursor: pointer !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px;
    transition: all 0.2s;
}

.asc-modal-close:hover {
    background: #f3f4f6;
    color: #374151 !important;
}

.asc-modal-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
}

.asc-footer-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 12px;
}

.asc-footer-branding svg {
    width: 16px;
    height: 16px;
    color: #0ea5e9;
}

/* ========================================
   STEP 3: Existing CAPTCHA Container (Inside Modal)
   ======================================== */

/* CAPTCHA Container */
.asc-captcha-wrapper {
    margin: 0;
    max-width: 100%;
}

.asc-captcha-container {
    background: #ffffff;
    border: none;
    border-radius: 0;
    padding: 24px;
    box-shadow: none;
}

.asc-captcha-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

/* CAPTCHA Challenge */
.asc-captcha-challenge {
    position: relative;
}

.asc-captcha-image-wrapper {
    width: 100%;
    height: 300px;
    background: #f5f5f5;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.asc-captcha-image {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s ease;
    object-fit: contain;
}

/* Controls */
.asc-captcha-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.asc-rotate-btn,
.asc-refresh-btn {
    background: #fff !important;
    color: #000000 !important;
    border: 2px solid #000 !important;
    border-radius: 6px !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-width: auto !important;
}

.asc-rotate-btn:hover,
.asc-refresh-btn:hover {
    background: #135e96;
}

.asc-rotate-btn:active,
.asc-refresh-btn:active {
    transform: scale(0.95);
}

.asc-rotate-btn:disabled,
.asc-refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.asc-rotate-icon,
.asc-refresh-icon {
    font-size: 18px;
    line-height: 1;
}

/* Instruction Text */
.asc-captcha-instruction {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-top: 10px;
}

/* Verify Button Container */
.asc-verify-button-container {
    text-align: center;
    margin: 20px 0 10px;
}

.asc-verify-btn {
    background: #0ea5e9;
    color: white;
    border: none;
    padding: 14px 48px !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    min-width: 100% !important;
}

.asc-verify-btn:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.asc-verify-btn:active {
    transform: translateY(0);
}

.asc-verify-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.asc-captcha-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    display: none;
}

.asc-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.asc-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Loading State */
.asc-captcha-wrapper.asc-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.asc-captcha-wrapper.asc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: asc-spin 1s linear infinite;
}

@keyframes asc-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Blocked Message */
.asc-blocked-message {
    background: #fef2f2;
    border: 1px solid #dc2626;
    padding: 12px;
    margin: 16px 0;
    border-radius: 4px;
    color: #991b1b;
}

.asc-blocked-message strong {
    display: block;
    margin-bottom: 5px;
}

/* WooCommerce Specific */
.asc-wc-checkout-captcha {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

.asc-wc-checkout-captcha h3 {
    margin-top: 0;
}

/* WooCommerce Registration */
.asc-wc-registration-captcha {
    margin: 20px 0;
    clear: both;
}

.woocommerce-form-register .asc-wc-registration-captcha {
    margin-bottom: 1em;
}

/* WooCommerce Login */
.asc-wc-login-captcha {
    margin: 20px 0;
    clear: both;
}

/* Elementor Specific */
.asc-elementor-captcha {
    margin: 20px 0;
}

.asc-elementor-captcha .elementor-field {
    width: 100%;
}

/* Comment Form Specific */
.asc-comment-captcha {
    margin: 20px 0;
}

/* Login Form Specific */
.asc-login-captcha-container {
    margin: 20px 0;
}

/* Registration Form Specific */
.asc-registration-captcha {
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .asc-modal-content {
        width: 95%;
        margin: 16px;
    }
    
    .asc-checkbox-wrapper {
        max-width: 100%;
    }
    
    .asc-captcha-container {
        padding: 16px;
    }
    
    .asc-captcha-image-wrapper {
        height: 200px;
    }
    
    .asc-captcha-controls {
        flex-direction: column;
    }
    
    .asc-rotate-btn,
    .asc-refresh-btn {
        width: 100%;
        padding: 12px;
        justify-content: center;
    }
    
    .asc-verify-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Accessibility */
.asc-checkbox-label:focus-within .asc-checkbox-box {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

.asc-rotate-btn:focus,
.asc-refresh-btn:focus,
.asc-modal-close:focus,
.asc-verify-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .asc-modal-content,
    .asc-captcha-container {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .asc-modal-header,
    .asc-modal-footer {
        border-color: #444;
        background: #2a2a2a;
    }
    
    .asc-modal-header h3,
    .asc-captcha-label {
        color: #e0e0e0;
    }
    
    .asc-captcha-image-wrapper {
        background: #2a2a2a;
    }
    
    .asc-captcha-instruction {
        color: #aaa;
    }
}

/* Animation for image rotation */
.asc-captcha-image {
    will-change: transform;
}

/* Hidden fields */
.asc-captcha-token,
.asc-captcha-response,
.asc-behavioral-data,
.asc-checkbox-verified {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
