/* Hisense Anti-Spam - Frontend Styles */

.hisense-math-captcha {
    margin: 15px 0;
}

.hisense-math-captcha label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.hisense-math-captcha input[type="number"] {
    width: 100px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hisense-math-captcha input[type="number"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

/* Password strength meter */
.password-strength-meter {
    margin-top: 10px;
    display: none;
}

.strength-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.strength-fill.weak {
    background: #dc3545;
    width: 25%;
}

.strength-fill.medium {
    background: #ffc107;
    width: 50%;
}

.strength-fill.strong {
    background: #28a745;
    width: 75%;
}

.strength-fill.very-strong {
    background: #007bff;
    width: 100%;
}

.strength-text {
    font-size: 12px;
    color: #666;
}

.strength-text.weak {
    color: #dc3545;
}

.strength-text.medium {
    color: #ffc107;
}

.strength-text.strong {
    color: #28a745;
}

.strength-text.very-strong {
    color: #007bff;
}

/* Error messages */
.antispam-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    margin: 15px 0;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    font-size: 14px;
}

.antispam-error ul {
    margin: 0;
    padding-left: 20px;
}

.antispam-error li {
    margin-bottom: 5px;
}

/* Success messages */
.antispam-success {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    margin: 15px 0;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    font-size: 14px;
}

/* Loading states */
.antispam-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.antispam-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: antispam-spin 1s linear infinite;
    z-index: 1000;
}

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

/* Form validation */
.form-field.error input,
.form-field.error select,
.form-field.error textarea,
.form-row.error input,
.form-row.error select,
.form-row.error textarea {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1) !important;
    transition: all 0.3s ease;
}

.form-field.success input,
.form-field.success select,
.form-field.success textarea,
.form-row.success input,
.form-row.success select,
.form-row.success textarea {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1) !important;
    transition: all 0.3s ease;
}

.field-validation {
    font-size: 12px;
    margin-top: 5px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    animation: fadeInUp 0.3s ease-out;
}

.field-validation.error {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.field-validation.success {
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

/* Password confirmation specific styling */
input[name="password2"],
input[name="reg_password_confirm"] {
    position: relative;
}

/* Real-time validation feedback */
.password-match-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}

.password-match-indicator.match {
    color: #28a745;
}

.password-match-indicator.no-match {
    color: #dc3545;
}

/* Honeypot fields (should be invisible) */
.antispam-honeypot {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* Registration form enhancements */
.woocommerce-form-register {
    position: relative;
}

.woocommerce-form-register .form-row {
    margin-bottom: 20px;
}

.woocommerce-form-register .required {
    color: #dc3545;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .hisense-math-captcha input[type="number"] {
        width: 80px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .antispam-error,
    .antispam-success {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .password-strength-meter {
        margin-top: 8px;
    }
    
    .strength-bar {
        height: 6px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .strength-fill.weak {
        background: #ff0000;
    }
    
    .strength-fill.medium {
        background: #ff8800;
    }
    
    .strength-fill.strong {
        background: #00aa00;
    }
    
    .strength-fill.very-strong {
        background: #0066cc;
    }
    
    .antispam-error {
        background: #ffffff;
        color: #000000;
        border: 2px solid #ff0000;
    }
    
    .antispam-success {
        background: #ffffff;
        color: #000000;
        border: 2px solid #00aa00;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .strength-fill,
    .antispam-loading::after {
        transition: none;
        animation: none;
    }
}

/* Focus management */
.hisense-math-captcha input:focus,
.woocommerce-form-register input:focus,
.woocommerce-form-register select:focus,
.woocommerce-form-register textarea:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .antispam-error,
    .antispam-success,
    .password-strength-meter {
        display: none;
    }
}

/* Animation for form validation feedback */
.validation-feedback {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Tooltip styles for help text */
.antispam-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.antispam-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.antispam-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.antispam-tooltip:hover::after,
.antispam-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Accessibility improvements */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Form progress indicator */
.form-progress {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.form-progress-bar {
    height: 100%;
    background: #0073aa;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Security indicator */
.security-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.security-indicator::before {
    content: '🔒';
    margin-right: 5px;
}

.security-indicator.secure {
    color: #28a745;
}

.security-indicator.secure::before {
    content: '🔐';
}
