﻿/*
    Shared look of the citizen authentication pages (Components/Auth/*).

    Hand-authored - NOT compiled from wwwroot/css/sass like style.css is, so edit this file directly
    (same arrangement as design-system.css).

    Global rather than a scoped .razor.css because most elements here are rendered by child components
    (InputText, ValidationMessage) that never receive the page's scope attribute.

    Every page wraps its content in .auth-page > .auth-card, so page-specific selectors are not needed;
    the descendant rules below cover the Bootstrap classes the pages still use inside the card.
*/

.auth-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    min-height: 100vh;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(180deg, #d8ece1 0%, #eef7f2 60%, #f7fbf9 100%);
}

.auth-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(0, 88, 64, 0.10);
    padding: 3rem 2.5rem 2.5rem;
    max-width: 460px;
    width: 100%;
}

/* Registration carries the most fields, so it gets a roomier card. */
.auth-card--wide {
    max-width: 520px;
}

/* ── Heading ── */

.auth-icon {
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2E8B57 0%, #005840 100%);
    margin-bottom: 1.5rem;
}

    .auth-icon i {
        font-size: 1.75rem;
        color: #ffffff;
    }

.auth-title,
.auth-card h1,
.auth-card h2,
.auth-card h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: #005840;
    text-align: center;
    margin: 0 0 0.5rem;
}

.auth-subtitle {
    font-size: 0.9375rem;
    color: #495057;
    line-height: 1.6;
    margin: 0 0 1.75rem;
}

.auth-brand {
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2E8B57;
    opacity: 0.7;
}

/* ── Form ── */

.auth-page form {
    text-align: left;
}

.auth-field,
.auth-page .form-group {
    margin-bottom: 1.125rem;
}

.auth-page label,
.auth-page .auth-label {
    display: block;
    font-weight: 600;
    color: #37474f;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
}

.auth-required {
    color: #c0392b;
}

/* Beats the global .form-control rule from style.css, which squares the inputs off. */
.auth-page .auth-input,
.auth-page input.form-control {
    width: 100%;
    border: 1px solid #d7e3dd;
    border-radius: 10px;
    padding: 0.75rem 0.875rem;
    font-size: 1rem;
    line-height: 1.4;
    color: #37474f;
    background: #fbfdfc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

    .auth-page .auth-input:focus,
    .auth-page input.form-control:focus {
        border-color: #2E8B57;
        box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.15);
        background: #ffffff;
        outline: none;
    }

    /* Login locks its fields with readonly, not disabled - a disabled input is not posted (Login.razor). */
    .auth-page .auth-input:disabled,
    .auth-page .auth-input[readonly],
    .auth-page input.form-control:disabled,
    .auth-page input.form-control[readonly] {
        background: #f1f5f3;
        cursor: not-allowed;
    }

/* Selectable option cards (fake-login profile picker) — replaces the unstylable native
   <select> popup with a radio list styled like the inputs. */
.auth-choice-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-page .auth-choice {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    border: 1px solid #d7e3dd;
    border-radius: 10px;
    padding: 0.75rem 0.875rem;
    background: #fbfdfc;
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

    .auth-page .auth-choice:hover {
        border-color: #2E8B57;
    }

    /* Mirrors .auth-input:focus - the card is what reads as the control, so the ring belongs on it,
       not only on the radio dot. Every other interactive control in this file has a focus style. */
    .auth-page .auth-choice:focus-within {
        border-color: #2E8B57;
        box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.15);
        background: #ffffff;
    }

    .auth-page .auth-choice input[type="radio"] {
        accent-color: #2E8B57;
        margin: 0;
        flex-shrink: 0;
    }

.auth-page .auth-choice--selected {
    border-color: #2E8B57;
    box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.15);
    background: #ffffff;
}

.auth-page .form-check-input {
    border-color: #cfded7;
}

    .auth-page .form-check-input:checked {
        background-color: #2E8B57;
        border-color: #2E8B57;
    }

.auth-page .form-check-label {
    display: inline;
    font-weight: 400;
    color: #495057;
}

/* ── Validation ── */

.auth-page .validation-message,
.auth-page .validation-errors {
    display: block;
    color: #c0392b;
    font-weight: 400;
    font-size: 0.8125rem;
    margin-top: 0.3125rem;
    list-style: none;
    padding: 0;
}

.auth-page input.invalid {
    border-color: #e0a3a3;
}

/* ── Alerts ── */

/* Alerts sit in centred cards, so they centre too — icon and text stay on one centred row. */
.auth-alert,
.auth-page .alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    text-align: center;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

    /* Multi-line alerts (block variants below) keep their paragraphs tight. */
    .auth-page .alert p:last-child {
        margin-bottom: 0;
    }

    /* Bulleted causes read badly centred — drop the markers and centre the items instead. */
    .auth-page .alert ul {
        list-style: none;
        padding: 0;
        margin: 0.5rem 0 0;
    }

    /* A follow-up action under the alert text (e.g. resend the confirmation e-mail) gets its own line. */
    .auth-alert__link {
        display: block;
        margin-top: 0.375rem;
    }

.auth-alert,
.auth-page .alert-danger {
    background: #fdecec;
    border: 1px solid #f3c9c9;
    color: #8f2b2b;
}

.auth-page .alert-success {
    display: block;
    background: #eaf7f1;
    border: 1px solid #bfe3d2;
    color: #1f5c45;
}

.auth-page .alert-info {
    display: block;
    background: #eaf3f7;
    border: 1px solid #bfd8e3;
    color: #1f4a5c;
}

.auth-page .alert-warning {
    display: block;
    background: #fdf4e6;
    border: 1px solid #f0d8ab;
    color: #7a5312;
}

/* ── Buttons ── */

.auth-btn,
.auth-page .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    border-radius: 999px;
    padding: 0.8125rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-btn--primary,
.auth-page .btn-primary {
    background: #005840;
    border: 1px solid #005840;
    color: #ffffff;
}

    .auth-btn--primary:hover:not(:disabled),
    .auth-btn--primary:focus-visible:not(:disabled),
    .auth-page .btn-primary:hover:not(:disabled),
    .auth-page .btn-primary:focus-visible:not(:disabled) {
        background: #004831;
        border-color: #004831;
        color: #ffffff;
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(0, 88, 64, 0.25);
    }

.auth-btn:disabled,
.auth-page .btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn--google {
    background: #ffffff;
    border: 1px solid #d7e3dd;
    color: #37474f;
}

    .auth-btn--google:hover:not(:disabled),
    .auth-btn--google:focus-visible:not(:disabled) {
        background: #f2f8f5;
        border-color: #2E8B57;
    }

.auth-google-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-btn--seznam {
    background: #ffffff;
    border: 1px solid #d7e3dd;
    color: #37474f;
}

    .auth-btn--seznam:hover:not(:disabled),
    .auth-btn--seznam:focus-visible:not(:disabled) {
        background: #f2f8f5;
        border-color: #2E8B57;
    }

.auth-seznam-logo {
    /* The Seznam mark is taller than it is wide, so only the height is pinned. */
    width: auto;
    height: 20px;
    flex-shrink: 0;
}

.auth-btn--facebook {
    background: #ffffff;
    border: 1px solid #d7e3dd;
    color: #37474f;
}

    .auth-btn--facebook:hover:not(:disabled),
    .auth-btn--facebook:focus-visible:not(:disabled) {
        background: #f2f8f5;
        border-color: #2E8B57;
    }

.auth-facebook-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* The external sign-in providers are separate forms, so they need their own spacing. */
.auth-form + .auth-form {
    margin-top: 0.75rem;
}

/* ── Bits and pieces ── */

.auth-separator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1.25rem;
    color: #8a9a93;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

    .auth-separator::before,
    .auth-separator::after {
        content: '';
        flex: 1;
        height: 1px;
        background: #e2ebe6;
    }

.auth-spinner {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: auth-spin 0.8s linear infinite;
}

.auth-links,
.auth-page .text-center {
    text-align: center;
    font-size: 0.9375rem;
    color: #495057;
}

.auth-links {
    margin-top: 1.5rem;
}

    .auth-links p {
        margin: 0 0 0.5rem;
    }

.auth-page a:not(.btn) {
    color: #2E8B57;
    font-weight: 600;
    text-decoration: none;
}

    .auth-page a:not(.btn):hover {
        color: #005840;
        text-decoration: underline;
    }

.auth-page .form-text {
    display: block;
    color: #6b7c75;
    font-size: 0.8125rem;
    margin-top: 0.3125rem;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Password field with show/hide toggle (Components/Shared/PasswordField.razor) ──
   Deliberately not scoped under .auth-page: the same component is used on /osobni-udaje.
   Must stay AFTER the .auth-input / input.form-control rules above - equal specificity,
   so source order decides the padding reservation. */
.auth-password-field {
    position: relative;
    width: 100%;
}

.auth-password-field .auth-input,
.auth-password-field input.form-control {
    padding-right: 2.75rem;
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #6b7c75;
    cursor: pointer;
    z-index: 2;
}

.auth-password-toggle:hover {
    background: #eef5f1;
    color: #2E8B57;
}

.auth-password-toggle:focus-visible {
    outline: 2px solid #2E8B57;
    outline-offset: 2px;
}

/* Neutral placeholder while a prerendered auth page waits for the circuit to resolve its state.
   Unlike .auth-spinner (white, sits inside a primary button) this one shows on the card. */
.auth-loading {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

    .auth-loading::after {
        content: "";
        width: 1.75rem;
        height: 1.75rem;
        border-radius: 50%;
        border: 3px solid #dfe8e3;
        border-top-color: #2E8B57;
        animation: auth-spin 0.8s linear infinite;
    }

/* ── Redirect interstitial (Components/Auth/FakeLogin.razor) ──
   Shown while the browser is on its way to the identity provider, so it has to look busy
   rather than broken: a rotating ring around the icon plus three travelling dots. */
.auth-icon--pending {
    position: relative;
}

    .auth-icon--pending::after {
        content: "";
        position: absolute;
        inset: -7px;
        border-radius: 50%;
        border: 3px solid rgba(46, 139, 87, 0.18);
        border-top-color: #2E8B57;
        animation: auth-spin 1s linear infinite;
    }

.auth-dots {
    display: flex;
    justify-content: center;
    gap: 0.4375rem;
    margin-top: 0.25rem;
}

    .auth-dots span {
        width: 0.5rem;
        height: 0.5rem;
        border-radius: 50%;
        background: #2E8B57;
        animation: auth-dot-pulse 1.2s ease-in-out infinite;
    }

        .auth-dots span:nth-child(2) {
            animation-delay: 0.15s;
        }

        .auth-dots span:nth-child(3) {
            animation-delay: 0.3s;
        }

@keyframes auth-dot-pulse {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: translateY(0) scale(0.85);
    }

    40% {
        opacity: 1;
        transform: translateY(-0.25rem) scale(1);
    }
}

/* ── Maintenance page (Components/NotPublished.razor) ──
   A slow breathing halo, deliberately not the --pending spinner: nothing is progressing here, and a
   spinner would promise a page that is about to change on its own. */
.auth-icon--pulse {
    position: relative;
}

    .auth-icon--pulse::after {
        content: "";
        position: absolute;
        inset: -7px;
        border-radius: 50%;
        border: 3px solid rgba(46, 139, 87, 0.35);
        animation: auth-halo-pulse 2.8s ease-out infinite;
    }

/* The subtitle carries a bottom margin for the form that usually follows it; on a card that ends
   there, that margin doubles up with the card padding. */
.auth-subtitle--last {
    margin-bottom: 0;
}

@keyframes auth-halo-pulse {
    0% {
        transform: scale(0.92);
        opacity: 0.55;
    }

    70%, 100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

/* Respect the OS "reduce motion" setting - keep the state visible, drop the movement. */
@media (prefers-reduced-motion: reduce) {
    .auth-icon--pending::after {
        animation-duration: 3s;
    }

    .auth-dots span {
        animation: none;
        opacity: 0.7;
    }

    .auth-icon--pulse::after {
        animation: none;
        opacity: 0.35;
    }
}
