/*
 * Passkeys: styles for the management page (/xmFront/passkeys.php) and the sign-in page option.
 * Hand-written plain CSS (not compiled from /xmFront/scss).
 */

/* ---------- management page ---------- */
/* Same blues as the sign-in page (xmBlue #4094bc, link blue #006C9B, panel #F5F5F5).
   Scoped here on purpose: signIn.css restyles every label on the page. */

body.passkeyBody,
body.passkeyBody #pageContent {
    background: #4094bc;
}

#thisPage.passkeyPage {
    max-width: 46rem;
    margin: 2rem auto 3rem;
    padding: 0 1rem;
    line-height: 1.5;
    background: transparent;
}

#thisPage.passkeyPage .passkeyTabBar {
    background: #4094bc;
    margin: 0;
    padding: 0;
}

#thisPage.passkeyPage .passkeyTabBar h1 {
    display: inline-block;
    margin: 0;
    padding: 0.85rem 1.6rem;
    border: 0;
    border-radius: 0.35rem 0.35rem 0 0;
    background: #F5F5F5;
    color: #555;
    font-size: 1.15rem;
    font-weight: normal;
    line-height: 1.2;
}

#thisPage.passkeyPage .passkeyPanel {
    background: #F5F5F5;
    border-radius: 0 0.5rem 0.5rem 0.5rem;
    padding: 1.75rem 1.75rem 2rem;
}

#thisPage.passkeyPage .passkeyPanel p {
    margin: 0 0 0.75rem;
    padding: 0;
    color: #444;
    line-height: 1.5;
}

#thisPage.passkeyPage section {
    margin-bottom: 1.75rem;
}

#thisPage.passkeyPage section:last-child {
    margin-bottom: 0;
}

#thisPage.passkeyPage h2 {
    margin: 0 0 0.45rem;
    padding: 0;
    border: 0;
    color: #006C9B;
    font-size: 1.2rem;
    font-weight: normal;
}

.passkeyHelp,
.passkeyEmpty {
    color: #555;
}

.passkeyAddRow {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    max-width: 24rem;
    margin-bottom: 0.9rem;
}

.passkeyAddRow label {
    color: #555;
}

.passkeyAddRow input[type="text"] {
    width: 100%;
    height: 42px;
    padding: 0 0.65rem;
    border: 1px solid #bbb;
    background: #fff;
    box-sizing: border-box;
}

.passkeyAddRow input[type="text"]:focus {
    border-color: #4094bc;
    background: #ECF8FC;
    outline: none;
}

.passkeyChoices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.passkeyDefer {
    margin: 0;
}

/* Rules like ".passkeyChoices { display: flex }" would otherwise beat the browser's "hidden" styling. */
#thisPage.passkeyPage [hidden] {
    display: none !important;
}

#thisPage.passkeyPage #addPasskeyButton,
#thisPage.passkeyPage #passkeyLoginButton,
#thisPage.passkeyPage .passkeyChoices .passkeyDefer button,
#thisPage.passkeyPage a.passkeyPortfolioLink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    margin: 0;
    padding: 0 1.15rem;
    border-radius: 3px;
    font: inherit;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}

#thisPage.passkeyPage #addPasskeyButton,
#thisPage.passkeyPage #passkeyLoginButton {
    border: 1px solid #4094bc;
    background: #4094bc;
    color: #fff;
}

#thisPage.passkeyPage #addPasskeyButton:hover,
#thisPage.passkeyPage #addPasskeyButton:focus-visible,
#thisPage.passkeyPage #passkeyLoginButton:hover,
#thisPage.passkeyPage #passkeyLoginButton:focus-visible {
    border-color: #006C9B;
    background: #006C9B;
    color: #fff;
}

#thisPage.passkeyPage #addPasskeyButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#thisPage.passkeyPage .passkeyChoices .passkeyDefer button,
#thisPage.passkeyPage a.passkeyPortfolioLink {
    border: 1px solid #4094bc;
    background: #fff;
    color: #006C9B;
}

#thisPage.passkeyPage .passkeyChoices .passkeyDefer button:hover,
#thisPage.passkeyPage .passkeyChoices .passkeyDefer button:focus-visible,
#thisPage.passkeyPage a.passkeyPortfolioLink:hover,
#thisPage.passkeyPage a.passkeyPortfolioLink:focus-visible {
    background: #4094bc;
    color: #fff;
}

.passkeyStatus {
    margin-top: 0.75rem;
}

.passkeyError {
    color: #b00020;
}

.passkeyList ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.passkeyList li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #ddd;
}

.passkeyName {
    display: block;
    font-weight: bold;
    color: #333;
}

.passkeyMeta {
    display: block;
    color: #666;
    font-size: 0.9em;
}

.passkeyActions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#thisPage.passkeyPage .passkeyActions button {
    height: auto;
    padding: 0.35rem 0.75rem;
    border: 1px solid #4094bc;
    border-radius: 3px;
    background: #fff;
    color: #006C9B;
    font: inherit;
    cursor: pointer;
}

#thisPage.passkeyPage .passkeyActions button:hover,
#thisPage.passkeyPage .passkeyActions button:focus-visible {
    background: #4094bc;
    color: #fff;
}

.passkeyRequired {
    margin-top: 1rem;
    font-weight: bold;
}

#passkeyUnsupported a {
    display: inline-block;
    margin-left: 0.35rem;
    color: #006C9B;
}

/* ---------- sign-in page option ---------- */
/* Sit in the same column as the username/password fields and the Sign In button
   (those widths live in signIn.scss). The form's .submitBar has a large bottom
   margin because it used to be the end of the form; pull that in when we follow it. */
form#signIn .submitBar:has(+ .passkeyOption) {
    margin-bottom: 1.25rem;
}

.passkeyOption {
    margin: 0 0 2.5rem;
}

.passkeyOption[hidden],
.passkeyMessage[hidden],
.passkeyOffer[hidden],
.passkeyStatus[hidden] {
    display: none;
}

.passkeyOffer {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

.passkeyOffer p {
    margin: 0 0 0.6rem;
}

/* The sign-in form adds a colon and a fixed label column to every label.
   This checkbox is a sentence, so it opts out of both. */
#thisPage form label.passkeyOfferChoice {
    display: flex;
    width: auto;
    margin: 0;
    padding: 0;
    justify-content: flex-start;
    gap: 0.5rem;
    align-items: flex-start;
    cursor: pointer;
}

#thisPage form label.passkeyOfferChoice::after {
    content: none;
}

.passkeyOfferChoice input {
    margin-top: 0.2rem;
}

@media (min-width: 800px) {
    .passkeyOption {
        width: 15rem;
        margin-left: 15.5rem;
    }

    /* The invitation is a short paragraph; give it more room than the button column. */
    .passkeyOption:has(#passkeyOffer:not([hidden])) {
        width: 26rem;
    }
}

@media (min-width: 1200px) {
    .passkeyOption {
        width: 18rem;
    }
}

#thisPage .passkeyOr {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
    padding: 0;
    color: #888;
    font-size: 0.85rem;
    line-height: 1;
}

.passkeyOr::before,
.passkeyOr::after {
    content: "";
    flex: 1;
    border-top: 1px solid #ccc;
}

#passkeySignInButton {
    display: block;
    width: 100%;
    padding: 0.55rem 1rem;
    border: 1px solid #4094bc;
    border-radius: 3px;
    background: #fff;
    color: #2f7ea6;
    font: inherit;
    cursor: pointer;
}

#passkeySignInButton:hover,
#passkeySignInButton:focus-visible {
    background: #4094bc;
    color: #fff;
}

#passkeySignInButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#thisPage .passkeyMessage {
    margin: 0.75rem 0 0;
    padding: 0;
    color: #b00020;
    font-size: 0.9rem;
    line-height: 1.35;
}
