/* AI-Header: Authentication V2 - Enhanced UX features with security focus */
/* Date: 2025-08-13 */

/* ===========================================
   AUTHENTICATION V2 - ENHANCED SECURITY FEATURES
   These styles enhance the existing unauthenticated layout CSS with security-focused UX
   =========================================== */

/* Enhanced error messaging with recovery guidance */
.error-message-v2 {
    color: #ffffff !important;
    font-weight: 300 !important;
    font-size: 0.875rem;
    line-height: 1.4;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    text-align: center;
    letter-spacing: 0.01em;
}

.error-guidance-v2 {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.error-reference-v2 {
    color: #6b7280;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Monaco, Consolas, monospace;
}

/* ===========================================
   SECURITY-FOCUSED ENHANCEMENTS
   =========================================== */

/* Security alert for rate limiting */
.security-alert {
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    border: 1px solid #dc2626;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #fecaca;
    font-size: 0.875rem;
    text-align: center;
    animation: security-pulse 2s ease-in-out infinite;
}

@keyframes security-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Progressive security warning states */
.form-input.security-warning {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
    background-color: rgba(245, 158, 11, 0.05);
}

.form-input.security-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
    background-color: rgba(220, 38, 38, 0.05);
}

/* Security lockout visual state */
.auth-submit-btn.security-locked {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-submit-btn.security-locked:hover {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    transform: none;
}

/* Password strength indicator (subtle, non-intrusive) */
.password-strength-indicator {
    height: 2px;
    background: #374151;
    border-radius: 1px;
    margin-top: 0.25rem;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 1px;
}

.password-strength-weak {
    background-color: #dc2626;
    width: 25%;
}

.password-strength-fair {
    background-color: #f59e0b;
    width: 50%;
}

.password-strength-good {
    background-color: #10b981;
    width: 75%;
}

.password-strength-strong {
    background-color: #059669;
    width: 100%;
}

/* Field interaction tracking */
.field-interaction-v2 {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1) !important;
}

.field-interaction-v2.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

.field-interaction-v2.valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1) !important;
}

/* Field error styling */
.field-error {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
}

/* Override forms.css validation pseudo-elements for auth pages */
.dark-auth-container .validation-message-enhanced::before,
.dark-auth-container .validation-success::before,
.dark-auth-container .field-error::before {
    content: none !important;
}

/* Clean validation message styling for auth pages */
.dark-auth-container .validation-message-enhanced,
.dark-auth-container .validation-success {
    display: block !important;
    gap: 0 !important;
}

/* Clean alert-error styling for crisp text display */
.dark-auth-container .alert-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: 8px !important;
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
    display: block !important;
    text-align: center !important;
}

/* Force white text color for all alert error content */
.dark-auth-container .alert-error * {
    color: #ffffff !important;
    font-weight: 300 !important;
}

/* Enhanced validation feedback */
.validation-feedback-v2 {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.validation-error-v2 {
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.validation-success-v2 {
    color: #10b981;
}

/* Register link styling enhancement */
.register-link-v2 {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Screen reader accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced loading spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced button loading state */
.auth-submit-btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

/* ===========================================
   MOBILE ENHANCEMENTS
   =========================================== */

@media (max-width: 768px) {
    .error-guidance-v2 {
        font-size: 0.8rem;
    }
    
    .error-reference-v2 {
        font-size: 0.7rem;
    }
}

/* ===========================================
   ACCESSIBILITY ENHANCEMENTS
   =========================================== */

/* Focus management for keyboard navigation */
.form-input:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .error-message-v2 {
        color: #ff6b6b;
        font-weight: 600;
    }
    
    .field-interaction-v2 {
        border-width: 2px !important;
    }
}

.brand-title-v2 {
    font-family: var(--font-family-primary);
    font-size: 2rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}

.brand-subtitle-v2 {
    font-family: var(--font-family-primary);
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0;
}

/* Form Styling */
.form-group-v2 {
    margin-bottom: 1.5rem;
}

.form-label-v2 {
    display: block;
    font-family: var(--font-family-primary);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input-v2 {
    width: 100%;
    background: #2d0000 !important;
    border: 1px solid var(--burgundy-border) !important;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    color: #ffffff !important;
    font-size: 1rem;
    font-family: var(--font-family-primary);
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.form-input-v2::placeholder {
    color: #9ca3af !important;
    opacity: 0.8;
}

.form-input-v2:focus {
    background: #3d0000 !important;
    border-color: var(--burgundy-accent) !important;
    box-shadow: 0 0 0 2px rgba(204, 85, 0, 0.2);
    transform: translateY(-1px);
}

/* Field interaction states */
.field-interaction-v2 {
    border-color: var(--burgundy-accent) !important;
    box-shadow: 0 0 0 1px rgba(204, 85, 0, 0.1);
}

.form-input-v2.disabled {
    background: #1a0000 !important;
    color: #666666 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Validation Feedback */
.validation-feedback-v2 {
    min-height: 18px;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    font-family: var(--font-family-primary);
}

.validation-success-v2 {
    border-color: var(--success-color) !important;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

.validation-error-v2 {
    color: #fca5a5;
    font-weight: 500;
    animation: slideIn 0.2s ease;
}

/* Error Recovery Section */
.error-recovery-v2 {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    font-family: var(--font-family-primary);
}

.error-message-v2 {
    color: #ff6b6b;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.error-guidance-v2 {
    color: #d1d5db;
    font-size: 0.8rem;
    line-height: 1.4;
}

.error-reference-v2 {
    color: #9ca3af;
    font-size: 0.7rem;
    margin-top: 0.5rem;
    font-family: monospace;
}

/* Submit Button */
.auth-submit-btn-v2 {
    width: 100%;
    background: #4285f4;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1rem;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.auth-submit-btn-v2:hover:not(:disabled) {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.auth-submit-btn-v2:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-submit-btn-v2.loading {
    background: #6c757d;
    position: relative;
}

/* Loading Spinner */
.spinner-v2 {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 2px solid #ffffff;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Links */
.auth-link-v2 {
    color: #4285f4;
    text-decoration: none;
    font-family: var(--font-family-primary);
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-link-v2:hover {
    color: #3367d6;
    text-decoration: underline;
}

.forgot-password-v2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.register-link-v2 {
    text-align: center;
    font-size: 0.9rem;
    color: #9ca3af;
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .auth-v2-container {
        padding: 1rem 0.5rem;
    }
    
    .auth-v2-card {
        padding: 2rem 1.5rem;
        max-width: 100%;
        margin: 0 0.5rem;
    }
    
    .brand-title-v2 {
        font-size: 1.75rem;
    }
    
    .brand-logo-v2 {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .auth-v2-card {
        padding: 1.5rem 1rem;
    }
    
    .brand-title-v2 {
        font-size: 1.5rem;
    }
    
    .brand-logo-v2 {
        width: 50px;
        height: 50px;
    }
}
