/*
 * UMS Login Theme — Portal Kinabalu /logon design
 * Keycloak 26.3.5 / keycloak.v2
 * Semantic .logon-* classes (custom template.ftl shell).
 * Native IdPs: Microsoft 365, MyDigitalID, Google (via ${p.loginUrl}).
 */

:root {
    --logon-navy: #0a3b78;
    --logon-navy-deep: #063777;
    --logon-navy-heading: #0f2d52;
    --logon-white: #ffffff;
    --logon-surface: #f8fafc;
    --logon-text: #334155;
    --logon-muted: #64748b;
    --logon-border: #d7e2ef;
    --logon-info-bg: #eef5fc;
    --logon-info-border: #cfe0f3;
    --logon-accent: #2563eb;
    --logon-hero-padding: clamp(2rem, 4vw, 4rem);
    --logon-auth-padding: clamp(2rem, 5vw, 5rem);
    --logon-content-max: 460px;
    --logon-radius: 11px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

body.logon-body {
    font-family: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--logon-text);
    background: var(--logon-white);
    -webkit-font-smoothing: antialiased;
}

.logon-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
}

/* ── Left hero panel ── */

.logon-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(6, 55, 119, 0.97) 0%, rgba(10, 59, 120, 0.94) 62%, rgba(10, 59, 120, 0.88) 100%);
    background-color: var(--logon-navy-deep);
    color: var(--logon-white);
    overflow: hidden;
}

.logon-hero__mountain {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: clamp(200px, 38vh, 300px);
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.72) 45%, rgba(0, 0, 0, 0.2) 78%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.72) 45%, rgba(0, 0, 0, 0.2) 78%, transparent 100%);
}

.logon-hero__mountain img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: bottom center;
    opacity: 1;
    transform: scale(1.08);
    transform-origin: bottom center;
}

.logon-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 78% 18%, rgba(147, 197, 253, 0.1) 0, transparent 42%);
    pointer-events: none;
    z-index: 0;
}

.logon-hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--logon-hero-padding);
    padding-bottom: 5rem;
}

.logon-hero__logo {
    display: block;
    width: min(220px, 42vw);
    height: auto;
    margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.logon-hero__headline {
    margin: 0 0 1rem;
    max-width: 14ch;
    font-size: clamp(2rem, 3.2vw, 2.75rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--logon-white);
}

.logon-hero__description {
    margin: 0 0 2rem;
    max-width: 34rem;
    font-size: clamp(1rem, 1.35vw, 1.125rem);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.88);
}

.logon-hero__features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 36rem;
}

.logon-hero__feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.logon-hero__feature-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    color: rgba(255, 255, 255, 0.92);
}

.logon-hero__feature-icon svg {
    width: 100%;
    height: 100%;
}

.logon-hero__feature-title {
    margin: 0 0 0.2rem;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
}

.logon-hero__feature-text {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

.logon-hero__copyright {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 1.25rem var(--logon-hero-padding) 1.75rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.62);
}

/* ── Right auth panel ── */

.logon-auth {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 100vh;
    background: var(--logon-white);
    padding: var(--logon-auth-padding);
}

.logon-auth__back {
    position: absolute;
    top: clamp(1.25rem, 3vw, 2rem);
    right: clamp(1.25rem, 3vw, 2.25rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    color: var(--logon-navy-heading);
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.logon-auth__back:hover {
    background: var(--logon-surface);
    color: var(--logon-navy);
}

.logon-auth__back:focus-visible {
    outline: 2px solid var(--logon-accent);
    outline-offset: 2px;
}

.logon-locale {
    position: absolute;
    top: clamp(1.25rem, 3vw, 2rem);
    left: clamp(1.25rem, 3vw, 2.25rem);
    z-index: 2;
}

.logon-locale select {
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--logon-navy-heading);
    background: var(--logon-white);
    border: 1px solid var(--logon-border);
    border-radius: 8px;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    cursor: pointer;
}

.logon-auth__inner {
    width: 100%;
    max-width: var(--logon-content-max);
    margin-top: -2vh;
}

.logon-auth__heading {
    margin: 0 0 0.875rem;
    font-size: clamp(2rem, 3vw, 2.625rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--logon-navy-heading);
}

.logon-auth__lead {
    margin: 0 0 1.75rem;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--logon-muted);
}

/* ── Provider buttons ── */

.logon-auth__providers {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-bottom: 1.75rem;
}

.logon-auth__provider-group {
    margin: 0;
    font-family: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: var(--logon-navy-heading);
}

.logon-auth__provider-group:not(:first-child) {
    margin-top: 1rem;
}

.logon-provider-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 68px;
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--logon-border);
    border-radius: var(--logon-radius);
    background: var(--logon-white);
    color: var(--logon-navy-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.logon-provider-btn + .logon-provider-btn {
    margin-top: -0.375rem;
}

.logon-provider-btn:hover {
    border-color: #b8cbe0;
    background: #fbfdff;
}

.logon-provider-btn:active {
    background: var(--logon-surface);
}

.logon-provider-btn:focus-visible {
    outline: 2px solid var(--logon-accent);
    outline-offset: 2px;
}

.logon-provider-btn__logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: var(--logon-surface);
    border: 1px solid var(--logon-border);
    overflow: hidden;
}

.logon-provider-btn__icon-img {
    max-width: 1.5rem;
    max-height: 1.5rem;
    object-fit: contain;
}

.logon-provider-btn__icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--logon-navy);
}

.logon-provider-btn__label {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
    text-align: left;
}

.logon-provider-btn__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--logon-navy-heading);
}

.logon-provider-btn__sub {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--logon-muted);
}

.logon-provider-btn__arrow {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    color: #94a3b8;
}

/* ── Message / alert (Keycloak native) ── */

.pf-v5-c-alert {
    margin: 0 0 1.25rem 0;
    border-radius: var(--logon-radius);
    border: 1px solid var(--logon-info-border);
    background: var(--logon-info-bg);
    color: var(--logon-navy-heading);
    box-shadow: none;
}

.pf-v5-c-alert.pf-m-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.pf-v5-c-alert.pf-m-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.pf-v5-c-alert.pf-m-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.pf-v5-c-alert.pf-m-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.pf-v5-c-alert .kc-feedback-text {
    color: inherit;
}

/* ── Registration / info ── */

.logon-auth__info {
    text-align: center;
    padding: 0.25rem 0 1.5rem 0;
    font-size: 0.9375rem;
}

#kc-registration span {
    color: var(--logon-muted);
}

#kc-registration a {
    color: var(--logon-navy);
    font-weight: 600;
    text-decoration: underline;
}

#kc-registration a:hover {
    color: var(--logon-navy-heading);
}

/* ── Help panel ── */

.logon-help {
    padding: 1.25rem;
    border: 1px solid var(--logon-border);
    border-radius: var(--logon-radius);
    background: var(--logon-white);
}

.logon-help__title {
    margin: 0 0 1rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--logon-navy-heading);
}

.logon-help__list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.logon-help__item {
    display: grid;
    grid-template-columns: 1.75rem 7.5rem 1fr;
    gap: 0.5rem 0.75rem;
    align-items: center;
    font-size: 0.9375rem;
    line-height: 1.4;
}

.logon-help__icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--logon-navy);
}

.logon-help__label {
    font-weight: 600;
    color: var(--logon-navy-heading);
}

.logon-help__value {
    color: var(--logon-muted);
    text-align: right;
}

.logon-help__value a {
    color: var(--logon-muted);
    text-decoration: none;
}

.logon-help__value a:hover {
    color: var(--logon-navy-heading);
    text-decoration: underline;
}

.logon-help__item--hours {
    align-items: start;
}

.logon-help__hours {
    grid-column: 2 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    color: var(--logon-muted);
}

.logon-help__hours-group {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 1rem;
    align-items: start;
}

.logon-help__hours-times {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    text-align: right;
}

.logon-help__hours-day {
    font-weight: 600;
    color: var(--logon-navy-heading);
    white-space: nowrap;
}

/* ── Responsive ── */

@media (max-width: 1199px) {
    .logon-hero__headline {
        max-width: 16ch;
    }
}

@media (max-width: 767px) {
    html,
    body {
        height: auto;
        overflow: auto;
    }

    .logon-page {
        grid-template-columns: 1fr;
    }

    .logon-auth {
        order: 1;
        min-height: auto;
        align-items: flex-start;
        padding-top: 4.5rem;
        padding-bottom: 2rem;
    }

    .logon-auth__inner {
        margin-top: 0;
    }

    .logon-hero {
        order: 2;
        min-height: auto;
        flex: none;
    }

    .logon-hero__inner {
        padding-bottom: 2rem;
    }

    .logon-hero__logo {
        width: min(180px, 55vw);
        margin-bottom: 1.5rem;
    }

    .logon-hero__headline {
        max-width: none;
        font-size: 1.75rem;
    }

    .logon-hero__features {
        gap: 1.125rem;
    }

    .logon-hero__copyright {
        padding-top: 0.5rem;
    }

    .logon-help__item {
        grid-template-columns: 1.75rem 6.5rem 1fr;
    }

    .logon-help__hours-group {
        grid-template-columns: 1fr;
        row-gap: 0.125rem;
    }

    .logon-help__hours-times {
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    .logon-provider-btn,
    .logon-auth__back {
        transition: none;
    }
}
