/*
 * Sign-in screen.
 *
 * The brand ramp comes from app-chrome.css, which the login layout loads first:
 * the indigo here is the same indigo the signed-in app marks the active menu
 * item with, and changing it in one place changes both.
 */

/*
 * app-chrome.css locks the document so the signed-in shell can own the only
 * scrolling region (#521). This page has no such shell — it is one card that
 * has to stay reachable on a short viewport (a laptop in landscape with the
 * on-screen keyboard up), so the lock is lifted here.
 */
html,
body.kk-login {
    height: auto;
    min-height: 100%;
    overflow: auto;
}

body.kk-login {
    margin: 0;
    color: var(--kk-slate-900);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /*
     * Two indigo glows over deep slate. Fixed attachment keeps the gradient
     * still while a short viewport scrolls the card.
     */
    background-color: #0b1120;
    background-image:
        radial-gradient(900px 520px at 12% -10%, rgba(99, 102, 241, .55), rgba(99, 102, 241, 0) 62%),
        radial-gradient(760px 480px at 108% 108%, rgba(79, 70, 229, .50), rgba(79, 70, 229, 0) 58%);
    background-attachment: fixed;
}

.kk-login-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2.5rem 1rem;
    box-sizing: border-box;
}

@supports (min-height: 100dvh) {
    .kk-login-stage {
        min-height: 100dvh;
    }
}

/* ------------------------------------------------------------------- card */

.kk-login-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem 2rem 1.5rem;
    background: #fff;
    border-radius: 18px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, .18),
        0 24px 60px rgba(2, 6, 23, .45);
}

/* ------------------------------------------------------------------ brand */

.kk-login-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.75rem;
}

.kk-login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--kk-accent-bright), var(--kk-accent));
    box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
    color: #fff;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.kk-login-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.kk-login-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: .06em;
}

.kk-login-tagline {
    font-size: .8rem;
    color: var(--kk-slate-500);
}

/* --------------------------------------------------------------- headings */

.kk-login-heading {
    margin: 0 0 .25rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.kk-login-lead {
    margin: 0 0 1.5rem;
    color: var(--kk-slate-500);
    font-size: .9rem;
}

/* ------------------------------------------------------------------ form */

.kk-login-card .form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--kk-slate-700);
}

.kk-login-field .input-group-text {
    background: var(--kk-slate-100);
    border-color: var(--kk-slate-200);
    color: var(--kk-slate-500);
}

.kk-login-field .form-control {
    padding: .6rem .75rem;
    border-color: var(--kk-slate-200);
}

.kk-login-field .form-control:focus {
    border-color: var(--kk-accent-bright);
    box-shadow: 0 0 0 .2rem var(--kk-accent-soft);
}

/*
 * Bootstrap raises the focused control above its neighbours so its ring is not
 * clipped by them. The addons have to come along, or the ring stops at the
 * leading icon and the trailing reveal button.
 */
.kk-login-field:focus-within .input-group-text,
.kk-login-field:focus-within .kk-login-reveal {
    border-color: var(--kk-accent-bright);
}

.kk-login-reveal {
    border-color: var(--kk-slate-200);
    color: var(--kk-slate-500);
}

.kk-login-reveal:hover,
.kk-login-reveal:focus {
    background: var(--kk-slate-100);
    border-color: var(--kk-slate-300);
    color: var(--kk-slate-700);
}

.kk-login-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1rem;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--kk-accent-bright), var(--kk-accent));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(79, 70, 229, .30);
    transition: filter .15s ease, box-shadow .15s ease;
}

.kk-login-submit:hover,
.kk-login-submit:focus {
    color: #fff;
    filter: brightness(1.06);
}

.kk-login-submit:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 .25rem var(--kk-accent-soft);
}

.kk-login-submit:disabled {
    filter: none;
    opacity: .75;
}

/* ------------------------------------------------------------- footnotes */

.kk-login-help {
    margin: 1.25rem 0 0;
    color: var(--kk-slate-500);
    font-size: .8rem;
    text-align: center;
}

.kk-login-foot {
    margin: 1.25rem 0 0;
    color: rgba(255, 255, 255, .55);
    font-size: .78rem;
}

/*
 * The Flash element renders `.message error` (templates/element/flash/*), which
 * only cake.css styles — and cake.css is not loaded here. Give those messages
 * the same shape as the inline alert beside them.
 */
.kk-login-card .message {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: .875rem;
    cursor: pointer;
}

.kk-login-card .message.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.kk-login-card .message.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.kk-login-card .message.hidden {
    display: none;
}

@media (max-width: 480px) {
    .kk-login-card {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 14px;
    }
}
