/* Authentication styles */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 150px);
    padding: 2rem;
}

.auth-form-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 450px;
}

.auth-form-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

/* Inline checkbox row (e.g. "Trust this device for future sign-ins") on auth/MFA forms.
   Keeps the box beside its label instead of stacking, and overrides the .form-container
   input { width: 100% } rule that would otherwise stretch the checkbox full width. */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: normal;
    cursor: pointer;
}

.auth-checkbox input[type='checkbox'] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.auth-links {
    /* margin-top: 1.5rem; */
    text-align: center;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* Text links styling - separate from nav.css auth-links */
.auth-text-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-text-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: normal;
}

.auth-text-links a:hover {
    text-decoration: underline;
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: var(--text-sm);
}

.success-message {
    background-color: #e8f5e8;
    color: #2e7d32;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: var(--text-sm);
}

/* ==========================================================================
   Sign-in / OTP flow (login, verify, locked)
   Universal for every user type. Layered on top of .auth-container /
   .auth-form-container above; relies on .primary-button from portal.css.
   ========================================================================== */

/* --- Card --- */
.auth-card {
    text-align: center;
}

.auth-card h1 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.auth-help-text {
    color: var(--text-secondary, #555);
    margin-bottom: var(--spacing-lg);
    line-height: 1.5;
}

.auth-card .form-group {
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.auth-card label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.auth-card input[type='email'] {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
}

.auth-btn-block {
    width: 100%;
}

.auth-actions-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

/* --- Inline field validation --- */
.auth-field-error {
    display: none;
    color: var(--error-color);
    font-size: var(--text-sm);
    margin-top: var(--spacing-sm);
}

.auth-field-error.visible {
    display: block;
}

/* --- OTP boxes --- */
.auth-otp-inputs {
    display: flex;
    /* Scale the gap down on narrow cards so six boxes plus gaps keep fitting without the
       boxes having to shrink below a legible width. */
    gap: clamp(0.25rem, 2vw, var(--spacing-sm));
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.auth-otp-box {
    /* 48px on roomy screens; min-width:0 lets the boxes shrink equally (overriding the flex
       default of min-width:auto) so six boxes plus gaps never overflow the card on narrow
       phones. box-sizing keeps the global form padding from inflating the width. */
    box-sizing: border-box;
    width: 48px;
    min-width: 0;
    height: 56px;
    /* Reset the global form input padding (var(--spacing-md) each side = 32px). With box-sizing:
       border-box that padding eats into the 48px box and leaves almost no room for the centered
       digit once the boxes flex-shrink on narrow phones, squishing the numbers. The digit is
       centered, so no horizontal padding is needed. */
    padding: 0;
    text-align: center;
    /* Scale the digit with the box so it is never clipped or hidden as the boxes shrink on
       narrow screens; floors at 1rem for legibility and caps at --text-xl on roomy ones. */
    font-size: clamp(1rem, 5vw, var(--text-xl));
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

.auth-otp-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(250, 114, 104, 0.25);
}

.auth-attempts-text {
    color: var(--text-secondary, #666);
    font-size: var(--text-sm);
    margin-bottom: var(--spacing-md);
}

/* --- Secondary actions (resend / change email) --- */
.auth-secondary-actions {
    margin-top: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
}

.auth-resend-form {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary, #666);
}

.auth-link-button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
}

.auth-link-button:hover {
    text-decoration: underline;
}

.auth-secondary-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: var(--text-sm);
}

.auth-secondary-link:hover {
    text-decoration: underline;
}

/* --- Locked icon badge --- */
.auth-icon-badge {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius-pill);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.auth-icon-badge--locked {
    background-color: var(--warning-amber-bg);
    color: var(--warning-amber-text);
}

.auth-icon-badge .material-symbols-outlined {
    font-size: 28px;
}
