/* Auth Pages Styles */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f6f6f7 0%, #e8e9eb 100%);
    padding: var(--space-4) 0;
    margin: 0;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: var(--space-4);
}

.auth-container.wide {
    max-width: 480px;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--color-primary);
}

.auth-back-link svg {
    width: 16px;
    height: 16px;
}

.auth-card {
    background: var(--color-bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-8);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.auth-logo img {
    max-width: 180px;
    max-height: 80px;
    width: auto;
    height: auto;
}

.auth-logo svg {
    width: 56px;
    height: 56px;
    padding: 12px;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    color: white;
}

.auth-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-1) 0;
}

.auth-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 500;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.auth-divider span {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

/* Login: two ways to log in as a segmented control above the form */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: var(--space-5);
    background: var(--color-bg-surface-secondary, #f1f2f4);
    border-radius: var(--radius-lg);
}

.auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-md);
    background: none;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.auth-tab svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.auth-tab:hover {
    color: var(--color-text);
}

.auth-tab.active {
    background: var(--color-bg-surface);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.auth-pane {
    display: none;
}

.auth-pane.active {
    display: block;
}

.auth-code {
    text-transform: uppercase;
    letter-spacing: 4px;
    font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: var(--font-size-lg);
    text-align: center;
}

.form-hint {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.forgot-link {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-align: right;
    display: block;
    margin-top: var(--space-1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* Phones: the card fills the width, everything above the form shrinks so the form fits one screen */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    /* full-bleed: the form sits directly on the page, no card, no gradient */
    .auth-page {
        padding: 0;
        background: var(--color-bg-surface);
        align-items: center;
    }

    .auth-container,
    .auth-container.wide {
        padding: var(--space-4);
        max-width: none;
    }

    .auth-card {
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        background: none;
    }

    .auth-header {
        margin-bottom: var(--space-4);
    }

    .auth-logo {
        margin-bottom: var(--space-2);
    }

    .auth-logo img {
        max-height: 48px;
        max-width: 140px;
    }

    .auth-title {
        font-size: var(--font-size-xl);
    }

    .auth-tabs {
        margin-bottom: var(--space-4);
    }

    .auth-tab {
        padding: 8px 6px;
        font-size: var(--font-size-xs);
    }

    .auth-form {
        gap: var(--space-3);
    }

    .auth-footer {
        margin-top: var(--space-4);
    }

    .alert {
        margin-bottom: var(--space-3);
    }
}

/* Short landscape phones: top-align so the keyboard does not push the card off screen */
@media (max-height: 560px) {
    .auth-page {
        align-items: flex-start;
    }
}

.terms {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-align: center;
    margin-top: var(--space-2);
}

.terms a {
    color: var(--color-primary);
}

/* Alert messages */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
