/* NextGen AI Captcha Pro - Frontend Styles */

/* Main captcha wrapper */
.ngacp-captcha-wrapper {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ngacp-captcha-container {
    max-width: 500px;
}

/* Challenge box */
.ngacp-challenge-box {
    background: #ffffff;
    border: 2px solid #cbd5e0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ngacp-challenge-box:hover {
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
}

/* Header */
.ngacp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.ngacp-icon {
    font-size: 32px;
    line-height: 1;
}

.ngacp-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

/* Loading state */
.ngacp-loading {
    text-align: center;
    padding: 20px;
}

.ngacp-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: ngacp-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes ngacp-spin {
    to { transform: rotate(360deg); }
}

.ngacp-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Challenge content */
.ngacp-challenge-content {
    animation: ngacp-fade-in 0.4s ease;
}

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

.ngacp-question-wrapper {
    margin-bottom: 16px;
}

.ngacp-question {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 16px;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ngacp-hint {
    background: #fff9e6;
    border-left: 4px solid #f39c12;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
    margin-top: 8px;
}

.ngacp-hint strong {
    color: #f39c12;
}

/* Answer input */
.ngacp-answer-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.ngacp-answer-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.ngacp-answer-input::placeholder {
    color: #95a5a6;
}

/* Button group */
.ngacp-button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.ngacp-button-group button {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Verify button */
.ngacp-verify-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.ngacp-verify-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
}

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

.ngacp-verify-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Refresh button */
.ngacp-refresh-btn {
    padding: 12px 20px;
    background: #ecf0f1 !important;
    color: #34495e !important;
    border: 2px solid #bdc3c7 !important;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important;
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: auto !important;
    position: relative;
    z-index: 100;
    outline: none;
}

.ngacp-refresh-btn:hover {
    background: #d5dbdb !important;
    border-color: #95a5a6 !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ngacp-refresh-btn:active {
    transform: translateY(0);
    background: #bdc3c7 !important;
}

.ngacp-refresh-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Result message */
.ngacp-result {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: ngacp-fade-in 0.3s ease;
}

.ngacp-result.success {
    background: #d4edda;
    border: 2px solid #c3e6cb;
    color: #155724;
}

.ngacp-result.error {
    background: #f8d7da;
    border: 2px solid #f5c6cb;
    color: #721c24;
}

.ngacp-result::before {
    font-size: 20px;
    line-height: 1;
}

.ngacp-result.success::before {
    content: "✓";
}

.ngacp-result.error::before {
    content: "✗";
}

/* Dark theme variant */
.ngacp-captcha-wrapper.dark .ngacp-challenge-box {
    background: #2c3e50;
    border-color: #34495e;
}

.ngacp-captcha-wrapper.dark .ngacp-header h4 {
    color: #ecf0f1;
}

.ngacp-captcha-wrapper.dark .ngacp-header {
    border-bottom-color: #34495e;
}

.ngacp-captcha-wrapper.dark .ngacp-answer-input {
    background: #34495e;
    border-color: #4a5f7f;
    color: #ecf0f1;
}

.ngacp-captcha-wrapper.dark .ngacp-answer-input:focus {
    border-color: #3498db;
}

.ngacp-captcha-wrapper.dark .ngacp-loading p {
    color: #95a5a6;
}

/* Verified state */
.ngacp-challenge-box.verified {
    border-color: #27ae60;
    background: linear-gradient(135deg, #ffffff 0%, #e8f5e9 100%);
}

.ngacp-verified-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: #27ae60;
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
}

.ngacp-verified-badge::before {
    content: "✓";
    font-size: 24px;
}

/* Loading button state */
.ngacp-verify-btn.loading {
    position: relative;
    color: transparent;
}

.ngacp-verify-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ngacp-spin 0.8s linear infinite;
}

/* Accessibility focus styles */
.ngacp-answer-input:focus-visible,
.ngacp-verify-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Hidden inputs */
input[name="ngacp_hp_field"] {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .ngacp-challenge-box {
        padding: 20px;
    }
    
    .ngacp-header h4 {
        font-size: 16px;
    }
    
    .ngacp-question {
        font-size: 15px;
        padding: 14px 16px;
    }
    
    .ngacp-answer-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .ngacp-button-group {
        flex-direction: column;
    }
    
    .ngacp-verify-btn,
    .ngacp-refresh-btn {
        width: 100%;
        min-width: unset;
    }
}

/* RTL support */
[dir="rtl"] .ngacp-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .ngacp-result {
    flex-direction: row-reverse;
}

/* Print styles */
@media print {
    .ngacp-captcha-wrapper {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ngacp-challenge-box {
        border-width: 3px;
    }
    
    .ngacp-answer-input {
        border-width: 3px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ngacp-spinner,
    .ngacp-challenge-box,
    .ngacp-verify-btn,
    .ngacp-challenge-content {
        animation: none;
        transition: none;
    }
}
