/*
 * Login / sign-up as a ticket: coloured header stub, perforation, form body, tear-off footer.
 * Loaded only by login.php. Gradients and outlines only (cheap on low-end devices).
 */

.tk-auth-page {
    --au-brand: var(--brand-primary, #047857);
    --au-accent: var(--brand-accent, #10b981);
    --au-line: #cfd8e3;
    --au-bg: #f5f5f5;
    --au-ink: #0f172a;
    --au-muted: #64748b;
    --au-n: 9px;
    display: grid;
    place-items: start center;
    min-height: calc(100vh - 200px);
    padding: 1.75rem 1rem 3rem;
}

.tk-auth-page *,
.tk-auth-page *::before,
.tk-auth-page *::after { box-sizing: border-box; }

.tk-auth-page .auth-container.tk-auth {
    width: min(100%, 440px);
    max-width: 440px;
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 28px 50px -24px rgba(15, 23, 42, .45);
    color: var(--au-ink);
}

/* ---------- header stub ---------- */
.tk-auth-head {
    padding: 1.35rem 1.6rem 1.25rem;
    color: #fff;
    background:
        radial-gradient(120% 140% at 100% 0, rgba(255, 255, 255, .18), transparent 55%),
        linear-gradient(135deg, #064e3b, var(--au-brand) 55%, var(--au-accent));
}

.tk-auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #a7f3d0;
}

.tk-auth-kicker svg { width: 14px; height: 14px; }

.tk-auth-page .tk-auth-title {
    margin: .5rem 0 .2rem;
    font-size: 1.65rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
}

.tk-auth-sub { margin: 0; font-size: .92rem; color: rgba(255, 255, 255, .82); }

/* dashed tear line with a notch at each edge */
.tk-auth-perf {
    height: calc(var(--au-n) * 2);
    margin-top: calc(var(--au-n) * -1);
    position: relative;
    background:
        radial-gradient(circle var(--au-n) at 0 50%, var(--au-bg) calc(var(--au-n) - 1px), #e3e9f1 calc(var(--au-n) - .5px), #0000 var(--au-n)),
        radial-gradient(circle var(--au-n) at 100% 50%, var(--au-bg) calc(var(--au-n) - 1px), #e3e9f1 calc(var(--au-n) - .5px), #0000 var(--au-n)),
        repeating-linear-gradient(90deg, var(--au-line) 0 6px, #0000 6px 11px) center / calc(100% - var(--au-n) * 2 - 14px) 2px no-repeat;
}

/* ---------- body ---------- */
.tk-auth-body { padding: .35rem 1.6rem 1.1rem; }

.tk-alert {
    margin: 0 0 .9rem;
    padding: .7rem .9rem;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.4;
}

.tk-alert.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.tk-alert.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tk-alert--info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.tk-alert a { color: inherit; font-weight: 700; text-decoration: underline; }
.tk-alert[hidden] { display: none; }

.tk-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 1.1rem;
    border-radius: 14px;
    background: #f1f5f9;
}

.tk-tab {
    padding: .6rem .5rem;
    border: 0;
    border-radius: 11px;
    background: transparent;
    font: inherit;
    font-size: .92rem;
    font-weight: 700;
    color: var(--au-muted);
    cursor: pointer;
    transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.tk-tab[aria-selected="true"] {
    color: var(--au-brand);
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .1), 0 4px 10px -4px rgba(15, 23, 42, .18);
}

.tk-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--au-accent) 55%, transparent); outline-offset: 2px; }

.tk-field { margin-bottom: .95rem; position: relative; }
.tk-field label { display: block; margin-bottom: .35rem; font-size: .85rem; font-weight: 700; color: #334155; }
.tk-field small { display: block; margin-top: .35rem; font-size: .78rem; color: var(--au-muted); }

.tk-field input[type="email"],
.tk-field input[type="text"],
.tk-field input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 .9rem;
    border: 1.5px solid #dbe3ec;
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 1rem;
    color: var(--au-ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tk-field input:focus {
    outline: 0;
    border-color: var(--au-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--au-accent) 20%, transparent);
}

.tk-pw { position: relative; }
.tk-pw input { padding-right: 3rem !important; }

.tk-pw-toggle {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--au-muted);
    cursor: pointer;
}

.tk-pw-toggle svg { width: 20px; height: 20px; }
.tk-pw-toggle:hover, .tk-pw-toggle.is-on { color: var(--au-brand); background: #f1f5f9; }
.tk-pw-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--au-accent) 55%, transparent); }

.tk-caps { color: #b45309 !important; font-weight: 600; }
.tk-caps[hidden] { display: none; }

.tk-suggest {
    margin-top: .4rem;
    padding: .3rem .7rem;
    border: 1px dashed #93c5fd;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
}

.tk-suggest[hidden] { display: none; }

.tk-register[hidden], #login-password-group[hidden], #remember-row[hidden] { display: none; }

/* password strength: four segments */
.tk-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: .5rem; }
.tk-strength i { height: 5px; border-radius: 4px; background: #e2e8f0; }
.tk-strength span { grid-column: 1 / -1; margin-top: .25rem; font-size: .78rem; color: var(--au-muted); }
.tk-strength[data-level="1"] i:nth-child(-n+1) { background: #ef4444; }
.tk-strength[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.tk-strength[data-level="3"] i:nth-child(-n+3) { background: #84cc16; }
.tk-strength[data-level="4"] i { background: #10b981; }

.tk-match.ok { color: #047857; }
.tk-match.bad { color: #b45309; }
.tk-match[hidden] { display: none; }

.tk-terms { display: flex; gap: .6rem; align-items: flex-start; margin: .2rem 0 1rem; font-size: .86rem; color: #475569; cursor: pointer; }
.tk-terms input { margin-top: .2rem; width: 18px; height: 18px; accent-color: var(--au-accent); flex: none; }
.tk-terms a { color: var(--au-brand); font-weight: 700; }

.tk-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin: .1rem 0 1rem; font-size: .88rem; }
.tk-check { display: inline-flex; align-items: center; gap: .5rem; color: #475569; cursor: pointer; }
.tk-check input { width: 17px; height: 17px; accent-color: var(--au-accent); }
.tk-link { color: var(--au-brand); font-weight: 700; text-decoration: none; }
.tk-link:hover { text-decoration: underline; }

/* submit: a stub button (ticket notches come from tickets-ui.css) */
.tk-auth-page .tk-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    width: 100%;
    min-height: 52px;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: .01em;
}

.tk-spin {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tk-au-spin .7s linear infinite;
}

.tk-submit.is-loading .tk-spin { display: inline-block; }
.tk-submit:disabled { opacity: .85; cursor: progress; }

@keyframes tk-au-spin { to { transform: rotate(360deg); } }

/* "or" divider as a perforated line */
.tk-or { position: relative; margin: 1.15rem 0; text-align: center; color: var(--au-muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.tk-or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--au-line); }
.tk-or span { position: relative; padding: 0 .8rem; background: #fff; }

.tk-auth-page .tk-google {
    --n: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    width: 100%;
    min-height: 50px;
    padding: .7rem 1rem;
    border: 1.5px solid #dbe3ec;
    border-radius: 12px;
    background: #fff;
    color: #1f2937;
    font-weight: 700;
    text-decoration: none;
    -webkit-mask:
        radial-gradient(circle var(--n) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle var(--n) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
    mask:
        radial-gradient(circle var(--n) at 0 50%, #0000 98%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle var(--n) at 100% 50%, #0000 98%, #000) right / 51% 100% no-repeat;
    outline: 1px dashed #cbd5e1;
    outline-offset: -4px;
}

.tk-auth-page .tk-google:hover { background: #f8fafc; }
.tk-auth-page .tk-google:focus-visible { outline: 2px solid var(--au-brand); outline-offset: -5px; }
.tk-google svg { width: 20px; height: 20px; }

/* ---------- footer ---------- */
.tk-auth-foot { padding: .9rem 1.6rem 1.1rem; background: #f8fbfa; border-top: 2px dashed var(--au-line); text-align: center; }
.tk-secure { display: flex; align-items: center; justify-content: center; gap: .45rem; margin: 0 0 .5rem; font-size: .8rem; color: #475569; }
.tk-secure svg { width: 16px; height: 16px; flex: none; color: var(--au-brand); }
.tk-foot-links { display: flex; justify-content: center; gap: .5rem; margin: 0; font-size: .82rem; color: var(--au-muted); }
.tk-foot-links a { color: var(--au-brand); font-weight: 700; text-decoration: none; }
.tk-barcode { height: 10px; margin: .8rem auto 0; max-width: 220px; opacity: .25; background: repeating-linear-gradient(90deg, #0f172a 0 1px, #0000 1px 3px, #0f172a 3px 5px, #0000 5px 6px, #0f172a 6px 7px, #0000 7px 10px, #0f172a 10px 13px, #0000 13px 15px); }

/* bot trap: off-screen, not display:none (some bots skip hidden fields) */
.tk-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- "please wait" overlay ---------- */
.tk-busy {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(3, 26, 20, .55);
}

.tk-busy[hidden] { display: none; }

.tk-busy-card {
    display: grid;
    justify-items: center;
    gap: .35rem;
    width: min(92vw, 320px);
    padding: 1.6rem 1.4rem 1.4rem;
    text-align: center;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}

.tk-busy-card strong { font-size: 1.05rem; color: var(--au-ink); }
.tk-busy-card span { font-size: .88rem; color: var(--au-muted); }

.tk-busy-ring {
    width: 52px;
    height: 52px;
    margin-bottom: .5rem;
    border-radius: 50%;
    border: 3px dashed var(--au-accent);
    border-top-color: var(--au-brand);
    animation: tk-au-spin 1.1s linear infinite;
}

@media (max-width: 420px) {
    .tk-auth-head { padding: 1.15rem 1.25rem 1.1rem; }
    .tk-auth-body { padding-left: 1.25rem; padding-right: 1.25rem; }
    .tk-auth-foot { padding-left: 1.25rem; padding-right: 1.25rem; }
    .tk-auth-page .tk-auth-title { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tk-spin, .tk-busy-ring { animation-duration: 2.4s; }
    .tk-tab { transition: none; }
}
