/* ==================== FORM VALIDATION & INTERACTIVE STATES ==================== */

/* Input Field States */
.input-field {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: white;
    width: 100%;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.input-field:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-field::placeholder {
    color: #6b7280;
}

/* Validation States */
.input-field.border-red-500,
.input-field.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.input-field.border-green-500,
.input-field.success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

/* Field Error Messages */
.field-error {
    color: #f87171;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: fadeIn 0.3s ease;
}

.field-error::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.625rem;
}

.field-success {
    color: #4ade80;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: fadeIn 0.3s ease;
}

.field-success::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.625rem;
}

/* ==================== PASSWORD STRENGTH METER ==================== */
.password-strength-meter {
    animation: fadeIn 0.3s ease;
}

.strength-fill {
    background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #10b981);
    background-size: 400% 100%;
    transition: width 0.3s ease;
}

.strength-fill.weak { width: 25%; background: #ef4444; }
.strength-fill.fair { width: 50%; background: #f97316; }
.strength-fill.good { width: 75%; background: #eab308; }
.strength-fill.strong { width: 100%; background: #22c55e; }

/* ==================== ALERT MESSAGES ==================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    animation: slideIn 0.4s ease;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.alert-info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.alert i {
    margin-top: 0.125rem;
}

/* ==================== LOADING STATES ==================== */
.btn-primary.loading,
.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* ==================== TOGGLE PASSWORD BUTTON ==================== */
.toggle-password {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: white;
}

/* ==================== 2FA INPUT STYLING ==================== */
#2fa_code {
    letter-spacing: 0.5em;
    font-family: 'Courier New', monospace;
}

/* ==================== RESPONSIVE FORM IMPROVEMENTS ==================== */
@media (max-width: 640px) {
    .glass {
        padding: 1.5rem;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .text-3xl {
        font-size: 1.5rem;
    }
}

/* ==================== TRUST BADGES ==================== */
.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 9999px;
    color: #10b981;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==================== LOCKOUT TIMER ==================== */
#lockout-timer {
    font-family: 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
}

/* ==================== FORM CONTAINER CENTERING ==================== */
.max-w-md {
    max-width: 28rem;
}

.w-full {
    width: 100%;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.space-y-8 > * + * {
    margin-top: 2rem;
}

/* ==================== Z-INDEX LAYERING ==================== */
.relative {
    position: relative;
}

.z-10 {
    z-index: 10;
}

/* ==================== HIDDEN UTILITY ==================== */
.hidden {
    display: none !important;
}

/* ==================== FOCUS VISIBLE FOR ACCESSIBILITY ==================== */
.input-field:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ==================== SMOOTH SCROLLING ==================== */
html {
    scroll-behavior: smooth;
}

/* ==================== SELECTION COLORS ==================== */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: white;
}