/*
    Two-step sign-in (authenticator app and passkeys).
    Layout, spacing and colours come from the tw- utilities in tailwind-generated.css; this file holds the
    pieces that need the site's brand colours, animation, or states Tailwind's generated set doesn't include.

    Sizing is set explicitly: parts of the site (the login box among them) inherit content-box sizing, which
    would add padding and borders on top of a 100% width and push full-width buttons out of their box.
*/

.ts-scope, .ts-scope *, .ts-scope *::before, .ts-scope *::after,
.twostep, .twostep *, .twostep *::before, .twostep *::after {
    box-sizing: border-box;
}

/* ----- buttons --------------------------------------------------------------------------------- */
.ts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 100%;
    margin: 0;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: 600 15px/1.25 'Plus Jakarta Sans', sans-serif;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.ts-btn:hover:not([disabled]) { transform: translateY(-1px); }
.ts-btn:active:not([disabled]) { transform: translateY(1px); box-shadow: none; }
.ts-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255, 150, 35, .35); }
.ts-btn[disabled] { opacity: .6; cursor: not-allowed; }

.ts-btn-primary { background: var(--orange, #ff9623); color: #fff !important; }
.ts-btn-primary:hover:not([disabled]) { background: var(--lorange, #ffaf57); box-shadow: 0 6px 14px rgba(255, 150, 35, .28); }

.ts-btn-secondary { background: #fff; color: #374151 !important; border-color: #d1d5db; }
.ts-btn-secondary:hover:not([disabled]) { background: #f9fafb; border-color: #9ca3af; box-shadow: 0 4px 10px rgba(0, 0, 0, .06); }

.ts-btn-danger { background: #fff; color: #b91c1c !important; border-color: #fecaca; }
.ts-btn-danger:hover:not([disabled]) { background: #fef2f2; border-color: #f87171; }

.ts-btn-passkey { background: #fff; color: #1f2937 !important; border-color: #cbd5e1; padding: 13px 18px; font-size: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.ts-btn-passkey:hover:not([disabled]) { border-color: var(--orange, #ff9623); box-shadow: 0 6px 14px rgba(0, 0, 0, .08); }
.ts-btn-passkey .fa-fingerprint { color: var(--orange, #ff9623); font-size: 1.25em; }

.ts-btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.ts-btn-block { display: flex; width: 100%; }

/* ----- inputs (the site styles every input; these win on specificity) ---------------------------- */
input.ts-input {
    width: 100%;
    max-width: 320px;
    margin: 0;
    padding: 11px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    line-height: 1.3;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input.ts-input:focus { outline: none; border-color: var(--orange, #ff9623); box-shadow: 0 0 0 3px rgba(255, 150, 35, .2); }

/* one-time code: large, spaced, centred */
input.ts-code-input {
    display: block;
    max-width: 260px;
    margin: 0 auto;
    padding: 12px 8px;
    text-align: center;
    font: 600 28px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: .3em;
    text-indent: .3em;
}
input.ts-code-input::placeholder { letter-spacing: normal; text-indent: 0; font: 400 16px 'Plus Jakarta Sans', sans-serif; color: #9ca3af; }

/* ----- expanders: clearly clickable, animated by twoStep.js ------------------------------------- */
.ts-accordion { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; transition: box-shadow .2s ease, border-color .2s ease; text-align: left; }
.ts-accordion:hover { border-color: #d1d5db; box-shadow: 0 4px 12px rgba(0, 0, 0, .05); }
.ts-accordion[open] { border-color: #fed7aa; box-shadow: 0 4px 14px rgba(255, 150, 35, .10); }
.ts-accordion > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px 12px 16px;
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 15px;
    color: #374151;
    transition: background-color .2s ease;
}
.ts-accordion > summary::-webkit-details-marker { display: none; }
.ts-accordion > summary::marker { content: ""; }
.ts-accordion > summary:hover { background: #fafafa; }
.ts-accordion > summary:active { background: #f3f4f6; }
.ts-accordion > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 3px rgba(255, 150, 35, .35); }
.ts-accordion > summary .ts-summary-label { display: flex; align-items: center; gap: 10px; }

/* the round chevron button that shows it opens */
.ts-chevron {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 12px;
    transition: transform .25s ease, background-color .2s ease, color .2s ease;
}
.ts-accordion > summary:hover .ts-chevron { background: #fff4e6; color: #c2410c; }
.ts-accordion[open] > summary .ts-chevron { transform: rotate(180deg); background: var(--orange, #ff9623); color: #fff; }
.ts-accordion.ts-closing > summary .ts-chevron { transform: rotate(0deg); background: #f3f4f6; color: #6b7280; }
.ts-accordion[open] > summary { border-bottom: 1px solid #f3f4f6; }

.ts-accordion-body { padding: 14px 16px 16px; color: #4b5563; font-size: 14px; font-weight: normal; line-height: 1.55; }
.ts-accordion-body ul, .ts-accordion-body ol { margin: 0; padding-left: 20px; }
.ts-accordion-body li { margin-bottom: 6px; }
.ts-accordion-body p:last-child { margin-bottom: 0; }

/* login box variant: reads like the box's own links on the grey background, opens into a white panel */
.ts-accordion-login,
.ts-accordion-login:hover,
.ts-accordion-login[open] { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.ts-accordion-login > summary {
    justify-content: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 0 auto;
    width: fit-content;
    border-radius: 10px;
    color: var(--oltmaincolour, #3d8bd9);
    font-size: 15px;
    font-weight: 600;
}
.ts-accordion-login > summary:hover { background: rgba(0, 0, 0, .05); }
.ts-accordion-login > summary:active { background: rgba(0, 0, 0, .08); }
.ts-accordion-login[open] > summary { border-bottom: 0; }
.ts-accordion-login .ts-chevron { width: 22px; height: 22px; font-size: 10px; background: rgba(0, 0, 0, .06); color: inherit; }
.ts-accordion-login > summary:hover .ts-chevron { background: rgba(0, 0, 0, .1); color: inherit; }
.ts-accordion-login[open] > summary .ts-chevron { background: var(--oltmaincolour, #3d8bd9); color: #fff; }
.ts-accordion-login.ts-closing > summary .ts-chevron { background: rgba(0, 0, 0, .06); color: inherit; }
.ts-accordion-login > .ts-accordion-body {
    margin: 6px 0 4px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    font-size: 14px;
}

/* the passkey button on the login page: the site's .button, white instead of orange */
.button.ts-passkey-button {
    background-color: #fff;
    color: var(--olttext, #333) !important;
    box-shadow: none;
    transition: background-color .2s ease, box-shadow .2s ease;
}
/* on a white card, a light grey fill tells the button apart without an outline */
.button.ts-passkey-button.ts-passkey-on-white { background-color: #f1f1f1; }
.button.ts-passkey-button.ts-passkey-on-white:hover,
.button.ts-passkey-button.ts-passkey-on-white:focus { background-color: #fff; }

/* space between the code box and the Continue button */
.ts-code-wrap { margin: 0 0 20px; }
.button.ts-passkey-button:hover,
.button.ts-passkey-button:focus {
    background-color: #fff;
    box-shadow: inset 0 0 0 2px var(--orange, #ff9623);
}
.button.ts-passkey-button[disabled] { opacity: .6; cursor: not-allowed; }
.button.ts-passkey-button .fa-fingerprint { color: var(--orange, #ff9623); font-size: 1.1em; margin: 0 6px 0 0; vertical-align: -1px; }

/* ----- authenticator setup steps ---------------------------------------------------------------- */
.ts-steps { list-style: none; margin: 0; padding: 0; counter-reset: ts-step; }
.ts-steps > li { position: relative; padding: 0 0 20px 44px; counter-increment: ts-step; }
.ts-steps > li::before {
    content: counter(ts-step);
    position: absolute;
    left: 0;
    top: -2px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff4e6;
    color: #c2410c;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fed7aa;
}
.ts-steps > li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 30px; bottom: 4px; width: 1px; background: #fed7aa; }

.ts-qr { display: inline-block; padding: 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.ts-qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.ts-key { display: inline-block; padding: 6px 10px; border-radius: 8px; background: #f3f4f6; font: 600 15px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .08em; word-break: break-all; }

/* ----- "how passkeys work" explainer ---------------------------------------------------------- */
.ts-how { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 0 0 16px; padding: 0; list-style: none; }
.ts-how > li { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px; border-radius: 12px; background: #faf5ff; border: 1px solid #ede9fe; }
.ts-how-icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #7c3aed; border: 1px solid #ddd6fe; font-size: 15px; }
.ts-how-title { font-weight: 600; color: #1f2937; font-size: 14px; margin: 0 0 2px; }
.ts-how-text { color: #4b5563; font-size: 13px; line-height: 1.5; margin: 0; }
.ts-devices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ts-device { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid #e5e7eb; font-size: 12px; color: #374151; }
.ts-device i { color: #6b7280; }

/* ----- messages ---------------------------------------------------------------------------------- */
.ts-alert { display: none; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; font-size: 14px; font-weight: normal; text-align: left; line-height: 1.45; }
.ts-alert.ts-show { display: flex; }
.ts-alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ts-alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ts-alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* ----- login page ------------------------------------------------------------------------------- */
.ts-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: #6b7280; font-size: 13px; font-weight: 600; }
.ts-divider::before, .ts-divider::after { content: ""; flex: 1; height: 1px; background: #d1d5db; }
.ts-login-passkey { margin: 0 0 22px; }
.ts-login-passkey .ts-accordion { margin-bottom: 12px; }

/* ----- the second-step page: styled like the login box (.login_box_lower in Styles.css) ---------- */
.ts-auth-wrap { max-width: 480px; margin: 40px auto; padding: 0 16px; }
.ts-auth-card { background-color: #ececec; border-radius: 15px; padding: 20px; text-align: center; }
.ts-auth-card h1, .ts-auth-card h2 { margin: 0 0 6px; }
.ts-auth-card .ts-lead { color: #6b7280; font-size: 15px; margin: 0 0 22px; }
.ts-field-label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 10px; }

/* the old site-wide button margins don't apply inside these screens */
.twostep .button, .ts-scope .button { margin: 0; }

@media (prefers-reduced-motion: reduce) {
    .ts-btn, .ts-chevron, .ts-accordion { transition: none; }
    .ts-btn:hover:not([disabled]), .ts-btn:active:not([disabled]) { transform: none; }
}
