/* identity.css
   Look of every /Identity page (Areas/Identity/Pages/_AuthLayout.cshtml): a dark, rounded hero with one
   centered white card, everything stacked in a single centered column.

   The pages are built COMPACT on purpose: sizes are chosen so that a page fits a phone screen (e.g. iPhone 12 Pro
   in Safari) without scrolling, and wwwroot/js/identity-ui.js scales the hero down further whenever the content is
   still taller than the visible screen (fit-to-screen, also after the content changes). Keep new elements small.

   The rules also restyle the markup of the Identity UI library pages that are not overridden in this project
   (their own headings, rows and columns), so all pages look alike. */

/* The Identity pages use the whole screen below the navigation: no page caption, no news ticker */
body.page-identity #caption-container,
body.page-identity #newsticker-container,
body:has(.auth-shell) #caption-container,
body:has(.auth-shell) #newsticker-container {
    display: none !important;
}

body.page-identity #mainContent,
body:has(.auth-shell) #mainContent {
    padding-bottom: 0 !important;
}

.auth-shell {
    --auth-ink: #0f2238;
    --auth-muted: #5b6b7d;
    --auth-line: rgba(15, 34, 56, 0.16);
    --auth-field: #f7fafd;
    --auth-accent: #3598dc;
    --auth-accent-dark: #1f6fb0;
    --auth-accent-light: #7cc4f5;
    --auth-on-dark: #eaf3fb;
    /* centered in the visible screen; min-height and the scale of the hero are set by identity-ui.js */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    overflow-x: clip;
}

.auth-hero {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    max-width: 1100px;
    padding: 10px 12px 14px;
    border-radius: 20px;
    color: var(--auth-on-dark);
    background:
        radial-gradient(circle at 88% 8%, rgba(53, 152, 220, 0.34), rgba(0, 0, 0, 0) 46%),
        radial-gradient(circle at 4% 96%, rgba(124, 196, 245, 0.18), rgba(0, 0, 0, 0) 50%),
        linear-gradient(160deg, #10294a, #061220);
    box-shadow: 0 18px 40px -24px rgba(6, 18, 32, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: top center;
}

/* Back button: always top left, on the line of the title */
.auth-top {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--auth-on-dark);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(234, 243, 251, 0.28);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

.auth-back:hover,
.auth-back:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.auth-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    max-width: 560px;
    margin: 0 0 10px;
    padding: 0 82px; /* room for the Back button, on both sides so the title stays centered */
    text-align: center;
}

/* The badge is decoration: only where there is room to spare */
.auth-badge {
    display: none;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    color: var(--auth-accent-light);
    background: rgba(124, 196, 245, 0.12);
    box-shadow: inset 0 0 0 1px rgba(124, 196, 245, 0.28);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0;
    color: var(--auth-on-dark);
    font-size: clamp(1.1rem, 4.4vw, 1.7rem);
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.auth-subtitle {
    margin: 2px 0 0;
    color: rgba(234, 243, 251, 0.78);
    font-size: 0.8rem;
    line-height: 1.25;
}

/* Account pages: one centered row of small pills */
.auth-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 720px;
    margin: 0 0 10px;
}

.auth-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 11px;
    border-radius: 999px;
    color: var(--auth-on-dark);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px rgba(234, 243, 251, 0.22);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.auth-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    text-decoration: none;
}

.auth-nav-link.active {
    color: #fff;
    background: linear-gradient(110deg, var(--auth-accent-light) 0%, var(--auth-accent) 45%, var(--auth-accent-dark) 100%);
    box-shadow: none;
}

/* The card */
.auth-panel {
    width: 100%;
    max-width: 400px;
    padding: 16px;
    border-radius: 16px;
    color: var(--auth-ink);
    background: #fff;
    box-shadow: 0 1px 0 rgba(15, 34, 56, 0.04), 0 18px 40px -26px rgba(15, 34, 56, 0.55);
}

.auth-panel-wide {
    max-width: 680px;
}

.auth-body {
    display: flex;
    flex-direction: column;
    text-align: center;
    font-size: 0.92rem;
}

/* Library pages bring their own page heading and rules: the hero already shows the title */
.auth-body > h1,
.auth-body > h3:first-child,
.auth-body hr {
    display: none;
}

.auth-body h2,
.auth-body h3,
.auth-body h4,
.auth-body h5 {
    margin: 0 0 8px;
    color: var(--auth-ink);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.3;
}

.auth-body p {
    margin-bottom: 0.5rem;
    color: var(--auth-muted);
}

/* One centered column, whatever grid the page declares */
.auth-body .row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    gap: 10px;
}

.auth-body .row > [class*="col-"] {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    padding: 0;
}

.auth-body section,
.auth-body form {
    width: 100%;
}

.auth-body .mb-3 {
    margin-bottom: 0.55rem !important;
}

/* Fields */
.auth-body .form-control,
.auth-body .form-select {
    border-radius: 12px;
    border: 1px solid var(--auth-line);
    background-color: var(--auth-field);
    color: var(--auth-ink);
    box-shadow: none;
}

.auth-body .form-control:focus,
.auth-body .form-select:focus {
    border-color: var(--auth-accent);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(53, 152, 220, 0.18);
}

/* Floating fields a little lower than the Bootstrap default */
.auth-body .form-floating > .form-control,
.auth-body .form-floating > .form-select {
    height: calc(3.1rem + 2px);
    min-height: calc(3.1rem + 2px);
}

.auth-body .form-floating > label {
    padding: 0.8rem 0.75rem;
}

.auth-body .form-floating > .form-control:focus,
.auth-body .form-floating > .form-control:not(:placeholder-shown),
.auth-body .form-floating > .form-select {
    padding-top: 1.4rem;
    padding-bottom: 0.35rem;
}

.auth-body .form-floating > label,
.auth-body .form-label,
.auth-body label {
    color: var(--auth-muted);
}

.auth-body .form-floating,
.auth-body .form-group {
    text-align: left;
}

.auth-body .form-check,
.auth-body .checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-left: 0;
    text-align: left;
}

.auth-body .form-check .form-check-input,
.auth-body .checkbox .form-check-input {
    float: none;
    margin: 0 6px 0 0;
    flex: 0 0 auto;
}

.auth-body .text-danger,
.auth-body .field-validation-error {
    display: block;
    font-size: 0.8rem;
    text-align: left;
}

.auth-body .validation-summary-errors ul {
    margin: 0 0 8px;
    padding-left: 0;
    list-style: none;
    text-align: center;
}

/* Password field with show / hide button */
.auth-password {
    position: relative;
}

.auth-password .form-control {
    padding-right: 2.8rem;
}

.auth-password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: calc(3.1rem + 2px);
    width: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    z-index: 5;
}

/* Buttons: rounded, full width, stacked */
.auth-body .btn {
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
}

.auth-body .btn-sm {
    font-size: 0.82rem;
    padding: 0.25rem 0.8rem;
}

.auth-body .btn-lg {
    font-size: 0.98rem;
    padding: 0.58rem 1rem;
}

.auth-body form > .btn,
.auth-body form > div > .btn,
.auth-body .d-grid > .btn,
.auth-body > .btn {
    width: 100%;
}

.auth-body .btn-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(110deg, var(--auth-accent-light) 0%, var(--auth-accent) 45%, var(--auth-accent-dark) 100%);
    box-shadow: 0 10px 28px -12px rgba(53, 152, 220, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.auth-body .btn-primary:hover,
.auth-body .btn-primary:focus {
    color: #fff;
    filter: brightness(1.06);
}

.auth-body .btn-primary:disabled {
    filter: grayscale(0.35);
    opacity: 0.75;
}

.auth-body .btn-outline-secondary,
.auth-body .btn-outline-primary,
.auth-body .btn-secondary {
    color: var(--auth-ink);
    background: #fff;
    border: 1px solid var(--auth-line);
}

.auth-body .btn-outline-secondary:hover,
.auth-body .btn-outline-primary:hover,
.auth-body .btn-secondary:hover {
    color: var(--auth-ink);
    background: var(--auth-field);
    border-color: var(--auth-accent);
}

/* Stacked actions, two-column actions and link lists */
.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.auth-actions-grid > .btn {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-size: 0.84rem;
}

.auth-actions-grid > .btn.d-none + .btn:last-child,
.auth-actions-grid > .btn:only-child {
    grid-column: 1 / -1;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    color: var(--auth-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

.auth-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 14px;
    margin-top: 10px;
    font-size: 0.82rem;
}

.auth-body a:not(.btn) {
    color: var(--auth-accent-dark);
    font-weight: 600;
    text-decoration: none;
}

.auth-body a:not(.btn):hover {
    text-decoration: underline;
}

/* Boxes inside the card */
.auth-body .alert {
    margin-bottom: 0.55rem;
    padding: 0.4rem 0.7rem;
    border: 0;
    border-radius: 12px;
    font-size: 0.85rem;
    text-align: left;
}

.auth-body .alert.text-center {
    text-align: center;
}

.auth-body .card {
    border-radius: 12px;
    border-color: var(--auth-line);
    overflow: hidden;
    text-align: left;
}

.auth-body .list-group-item {
    border-color: var(--auth-line);
    font-size: 0.85rem;
}

.auth-body .table {
    text-align: left;
}

/* Camera and voice window: never taller than a good third of the screen */
.auth-body .face-camera {
    border-radius: 14px !important;
    margin-bottom: 0.5rem !important;
}

.auth-body .face-camera.face-fixed-ratio {
    max-height: min(38vh, 300px);
}

/* One-line state of a sign-in method (active since ...) */
.auth-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 8px;
    margin-bottom: 0.5rem;
    color: var(--auth-muted);
    font-size: 0.82rem;
}

/* Note or details shown only on demand: one line when closed, a small scrollable box when opened */
.auth-note {
    text-align: center;
    font-size: 0.82rem;
}

.auth-note > summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    color: var(--auth-muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.auth-note > summary::-webkit-details-marker {
    display: none;
}

.auth-note > summary::after {
    content: "\f078"; /* chevron-down */
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.6rem;
    margin-left: 4px;
    transition: transform 0.15s ease;
}

.auth-note[open] > summary::after {
    transform: rotate(180deg);
}

.auth-note > summary:hover {
    color: var(--auth-ink);
    background: var(--auth-field);
}

.auth-note-body {
    max-height: 6.5rem;
    overflow-y: auto;
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #fff8e6;
    color: #6b5310;
    text-align: left;
    line-height: 1.4;
    -webkit-overflow-scrolling: touch;
}

.auth-note-body.auth-note-plain {
    background: var(--auth-field);
    color: var(--auth-ink);
}

/* Several notes side by side on one line */
.auth-notes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 6px;
}

.auth-notes > .auth-note[open] {
    flex: 1 1 100%;
}

/* Voice ID: scope window (Account/_VoiceScope.cshtml) - the same window as the face camera
   (.face-camera.face-fixed-ratio in face-login.css), with an oscilloscope instead of the picture */
.voice-scope canvas {
    display: block;
}

/* Language of the speech recognition: flag button top right (like the rotate button of the face camera) */
.capture-language {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 30;
}

/* in the face camera the rotate button sits top right, so the flag goes to the left */
.capture-language.capture-language-left {
    left: 6px;
    right: auto;
}

.capture-language .dropdown-toggle {
    padding: 3px 8px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

.capture-language .dropdown-toggle > span {
    display: none; /* the flag is enough here; the menu shows the names */
}

.capture-language .dropdown-toggle img.flag {
    margin-right: 0;
}

.capture-language .dropdown-menu {
    max-height: 190px;
    text-align: left;
}

.voice-scope-status {
    position: absolute;
    top: 8px;
    left: 8px;
    max-width: calc(100% - 76px);
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #eaf3fb;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    z-index: 9;
    pointer-events: none;
}

.voice-scope-status.is-speaking {
    background: rgba(22, 163, 74, 0.9);
    color: #fff;
}

/* Recognized text */
.voice-scope-heard {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
    overflow-wrap: anywhere;
    z-index: 9;
    pointer-events: none;
}

/* The three recordings of the voice enrollment */
.voice-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.voice-step {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--auth-line);
    color: var(--auth-muted);
    font-weight: 700;
    font-size: 0.75rem;
}

.voice-step.is-done {
    border-color: #16a34a;
    background: #16a34a;
    color: #fff;
}

.voice-step.is-current {
    border-color: var(--auth-accent);
    color: var(--auth-accent-dark);
}

/* Room to spare (tablet, desktop): a little more air and the badge */
@media (min-width: 768px) and (min-height: 820px) {
    .auth-hero {
        padding: 16px 20px 26px;
        border-radius: 24px;
    }

    .auth-top {
        top: 16px;
        left: 16px;
    }

    .auth-head {
        margin-bottom: 16px;
    }

    .auth-badge {
        display: inline-flex;
    }

    .auth-panel {
        padding: 22px;
        border-radius: 18px;
    }

    .auth-panel:not(.auth-panel-wide) {
        max-width: 420px;
    }
}

/* Low screens (phone in landscape, small phones): no subtitle */
@media (max-height: 640px) {
    .auth-subtitle {
        display: none;
    }
}

/* Phones: the account pages become icons, so the row always fits without scrolling sideways */
@media (max-width: 575.98px) {
    .auth-hero {
        padding: 8px 8px 10px;
        border-radius: 16px;
    }

    .auth-top {
        top: 8px;
        left: 8px;
    }

    .auth-back span {
        display: none;
    }

    .auth-back {
        width: 34px;
        padding: 0;
        justify-content: center;
    }

    .auth-head {
        padding: 0 44px;
        margin-bottom: 8px;
    }

    .auth-panel {
        padding: 12px;
        border-radius: 14px;
    }

    .auth-nav {
        gap: 5px;
        margin-bottom: 8px;
    }

    .auth-nav-link {
        width: 36px;
        padding: 0;
    }

    .auth-nav-link span {
        display: none;
    }
}
