/*
 * auth.css — Crew2Sea Identity Pages
 * ─────────────────────────────────────────────────────────────────────
 * Scope: ALL Identity/Account pages (Login, Register, ForgotPassword,
 *        ResetPassword, 2FA, RecoveryCode, Lockout, AccessDenied,
 *        Logout, ConfirmEmail, ConfirmEmailChange)
 *
 * Rules:
 *   1. Every variable references an existing token from app.css / BS.
 *   2. No hex colour literals — only var(--bs-*) tokens.
 *   3. Classes are grouped by layer:
 *        A. Layout shell      — page-level positioning
 *        B. Card              — the white container
 *        C. Brand block       — logo + wordmark + tagline
 *        D. Input helpers     — icon-prefix wrapper
 *        E. Typography        — repeated text styles
 *        F. State pages       — icon + heading for status pages
 *        G. Role selector     — Register page only
 *        H. Footer / meta     — links below card, copyright
 *        I. Modifiers         — .auth-card--center for status pages
 * ─────────────────────────────────────────────────────────────────────
 */

/* ═══════════════════════════════════════════════════════════════════
   A. LAYOUT SHELL
   Full-page centering wrapper. Replaces .row .col-md-4 on every page.
   Applied to the <main> or outermost div on all Identity pages.
═══════════════════════════════════════════════════════════════════ */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgb(var(--bs-body-bg-rgb));
    padding: 24px 16px 56px;
}


/* ═══════════════════════════════════════════════════════════════════
   B. CARD
   One reusable white card for every identity page.
   .auth-card--center: modifier for status pages (Lockout, Logout, etc.)
   that centre all their content.
═══════════════════════════════════════════════════════════════════ */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-light-border-subtle);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
    padding: 32px 28px 24px;
}

.auth-card--center {
    text-align: center;
}


/* ═══════════════════════════════════════════════════════════════════
   C. BRAND BLOCK
   Logo + wordmark + tagline. Used on every page via shared partial.
═══════════════════════════════════════════════════════════════════ */
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    text-align: center;
}

.auth-brand__logo {
    display: flex;
    align-items: center;
    gap: 9px;
}

.auth-brand__wordmark {
    font-size: 20px;
    font-weight: 700;
    color: var(--bs-emphasis-color);
    letter-spacing: -0.2px;
}

/* The green "2" in Crew2Sea */
.auth-brand__wordmark em {
    font-style: normal;
    color: var(--bs-green);
}

.auth-brand__tagline {
    font-size: 12px;
    color: var(--bs-secondary-color);
}


/* ═══════════════════════════════════════════════════════════════════
   D. INPUT HELPERS
   Icon-prefix wrapper. Positions a .bi icon inside the left edge
   of any .form-control child. Used on every form page.
═══════════════════════════════════════════════════════════════════ */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > .bi {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--bs-gray-500);
    pointer-events: none;
    z-index: 4;
}

/* Indent the input text so it doesn't sit under the icon */
.auth-input-wrap .form-control,
.auth-input-wrap .form-floating .form-control {
    padding-left: 32px;
}

/* Special: monospace OTP input (2FA page) */
.auth-input-otp {
    font-family: var(--bs-font-monospace);
    letter-spacing: 0.2em;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

/* Special: monospace recovery code input */
.auth-input-code {
    font-family: var(--bs-font-monospace);
    letter-spacing: 0.1em;
}


/* ═══════════════════════════════════════════════════════════════════
   E. TYPOGRAPHY HELPERS
   Repeated text patterns extracted from inline styles.
   All colours reference existing BS tokens — no new values.
═══════════════════════════════════════════════════════════════════ */

/* Page heading inside card — used on ForgotPassword, ResetPassword, 2FA, RecoveryCode */
.auth-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--bs-emphasis-color);
    margin-bottom: 4px;
}

/* Register page title line ("Create your account") */
.auth-register-title {
    font-size: 16px;
    color: var(--bs-emphasis-color);
    margin-bottom: 3px;
}

/* Compact validation summary text size */
.auth-alert-sm {
    font-size: 13px;
}

/* Danger variant — Lockout, AccessDenied */
.auth-heading--danger {
    color: var(--bs-danger-text-emphasis);
}

/* Sub-text below heading inside card */
.auth-subtext {
    font-size: 13px;
    color: var(--bs-secondary-color);
}

/* Intro block — wraps auth-state-icon + auth-heading + auth-subtext */
.auth-intro {
    text-align: center;
    margin-bottom: 20px;
}

/* Inline divider with optional label text ("I am a", "Or") */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    font-size: 11.5px;
    color: var(--bs-secondary-color);
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bs-light-border-subtle);
}

/* Forgot-password link next to Password label */
.auth-field-link {
    font-size: 12px;
    color: var(--bs-primary);
    text-decoration: none;
}

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

/* Generic quiet link — "Back to sign in", "Resend confirmation" */
.auth-link-quiet {
    font-size: 12px;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.auth-link-quiet:hover {
    color: var(--bs-body-color);
    text-decoration: underline;
}

/* Strong CTA link — "Sign in", "Request access" */
.auth-link-cta {
    font-weight: 600;
    color: var(--bs-primary);
    text-decoration: none;
}

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

/* Register legal copy block */
.auth-terms-copy {
    margin-bottom: 14px;
}

/* Register submit button sizing */
.auth-register-submit {
    padding: 10px;
    font-size: 14px;
}


/* ═══════════════════════════════════════════════════════════════════
   F. STATE PAGES — icon + heading
   Used on: ForgotPassword, ResetPassword, 2FA, RecoveryCode,
            Lockout, AccessDenied, Logout, ConfirmEmail
   The colour modifiers map 1:1 to BS semantic colour tokens.
═══════════════════════════════════════════════════════════════════ */
.auth-state-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin: 0 auto 18px;
    flex-shrink: 0;
}

.auth-state-icon--primary {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

.auth-state-icon--success {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success);
}

.auth-state-icon--danger {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger);
}

.auth-state-icon--warning {
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
}

.auth-state-icon--info {
    background: var(--bs-info-bg-subtle);
    color: var(--bs-info);
}


/* ═══════════════════════════════════════════════════════════════════
   G. ROLE SELECTOR
   Two-column grid. Register page only.
   .auth-role-btn.active: managed by Blazor / JS toggling.
═══════════════════════════════════════════════════════════════════ */
.auth-role-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 8px;
    border: 1px solid var(--bs-light-border-subtle);
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    text-align: center;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.auth-role-btn:hover {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.auth-role-btn.active {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

.auth-role-btn .bi {
    font-size: 18px;
}


/* ═══════════════════════════════════════════════════════════════════
   H. FOOTER & META
   .auth-footer: link block below submit button (back / register links)
   .auth-meta:   copyright line below the card
═══════════════════════════════════════════════════════════════════ */
.auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: var(--bs-secondary-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-footer--tight {
    margin-top: 14px;
}

.auth-meta {
    margin-top: 20px;
    text-align: center;
    font-size: 11px;
    color: var(--bs-gray-500);
}

.auth-meta a {
    color: var(--bs-gray-500);
    text-decoration: none;
}

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


/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   On very small screens (< 420px) remove card side padding
   so the card fills edge-to-edge.
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
    .auth-shell {
        padding: 0 0 48px;
        justify-content: flex-start;
    }

    .auth-card {
        max-width: 100%;
        border-left: none;
        border-right: none;
        border-radius: 0;
        box-shadow: none;
        padding: 28px 20px 20px;
    }
}

/* -- Role button subtitle -------------------------------------- */
.auth-role-sub {
    font-size: 10px;
    font-weight: 400;
    color: var(--bs-secondary-color);
    line-height: 1.3;
    margin-top: 1px;
}

.auth-role-btn.active .auth-role-sub {
    color: var(--bs-primary-text-emphasis);
    opacity: 0.75;
}

/* -- Trust signals row ----------------------------------------- */
.auth-trust-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--bs-secondary-color);
}

.auth-trust-row span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.auth-trust-row .bi-shield-check,
.auth-trust-row .bi-people,
.auth-trust-row .bi-check-circle {
    color: var(--bs-success);
    font-size: 11px;
}

/* -- Auto-detected country pill -------------------------------- */
.auth-country-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--bs-light-border-subtle);
    border-radius: var(--bs-border-radius);
    background: var(--bs-tertiary-bg);
    font-size: 13px;
    width: 100%;
}

.auth-country-pill__flag {
    font-size: 16px;
    line-height: 1;
}

.auth-country-pill__name {
    flex: 1;
    color: var(--bs-body-color);
    font-weight: 500;
}

.auth-country-pill__edit {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--bs-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    text-decoration: none;
}

.auth-country-pill__edit:hover {
    text-decoration: underline;
}
