/* styles/auth.css */
:root{color-scheme:dark}
html,body{height:100%}
body{font-family:'Inter',sans-serif}
.hidden-content{display:none}

/* Fixed styles for stable password fields */
.field-container {
    position: relative;
    margin-bottom: 1.75rem; /* Consistent spacing */
}

.error-message {
    position: absolute;
    bottom: -1.25rem;
    left: 0;
    right: 0;
    height: 1rem;
    font-size: 0.875rem;
    line-height: 1rem;
    overflow: hidden;
    transition: opacity 0.2s ease;
    opacity: 0;
}

.password-strength-meter {
    height: 1.25rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    transition: opacity 0.2s ease;
    opacity: 0;
}

/* Ensure consistent height for all input fields */
.input-field {
    height: 3.25rem; /* Fixed height */
    transition: border-color 0.2s ease;
}

/* Focus styles */
.input-field:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Error state */
.input-field[aria-invalid="true"] {
    border-color: #f43f5e;
}

/* Show elements when they have content */
.error-message:not(:empty) {
    opacity: 1;
}

.password-strength-meter:not(:empty) {
    opacity: 1;
}

/* OTP input styling */
.otp-input {
    width: 3rem;
    height: 3.5rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid #374151;
    background-color: #1f2937;
    color: white;
}

.otp-input:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Prevent iOS zoom-on-focus and keep caret stable */
.input-field { font-size: 16px; }

/* Give a bit more right padding so the toggle never overlaps text */
.input-field { padding-right: 3.5rem; }

/* Make the eye button a fixed-width hit target to avoid reflow */
.pw-toggle { width: 2.75rem; justify-content: center; }

/* Reserve enough vertical space under fields that can show strength/errors */
.field-container { margin-bottom: 2.5rem; }
.field-container:has(.password-strength-meter) { margin-bottom: 3.5rem; }

/* Slightly taller message rows so text never wraps and pushes layout */
.error-message,
.password-strength-meter {
    bottom: -1.5rem;
    height: 1.25rem;
    line-height: 1.25rem;
}

/* Enhanced password strength indicator */
.strength-meter {
    height: 6px;
    width: 100%;
    background: #374151;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-0 { width: 20%; background: #ef4444; } /* Very weak */
.strength-1 { width: 40%; background: #f97316; } /* Weak */
.strength-2 { width: 60%; background: #eab308; } /* Fair */
.strength-3 { width: 80%; background: #84cc16; } /* Good */
.strength-4 { width: 100%; background: #22c55e; } /* Strong */

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Improved focus styles for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .otp-input {
        width: 2.5rem;
        height: 3rem;
        font-size: 1.25rem;
    }

    .input-field {
        height: 2.75rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}