/* ==========================================================================
   Sangati Medika - Healthcare Portal login

   Split light/dark: a dark hero panel carries the photograph and the brand
   message, the form panel stays light so that label and input text is
   legible on cheap screens, in sunlight, and for older patients.

   Colour tokens come from public/css/brand.css. Do not hardcode hex values
   here; add a token there instead so the portal and the MCU system agree.
   ========================================================================== */

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

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

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--brand-shell, #F5F7F6);
    color: var(--brand-ink, #1B2420);
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.auth {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Hero panel (dark)
   -------------------------------------------------------------------------- */

.auth__hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.75rem 3rem;
    overflow: hidden;
    background: var(--brand-chrome, #0D1F17);
    color: #ffffff;
    isolation: isolate;
}

.auth__hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: url('../images/login-hero.webp');
    background-size: cover;
    background-position: 62% 55%;
    transform: scale(1.06);
    transition: transform 12s ease-out;
    will-change: transform;
}

.auth__hero-bg.is-loaded {
    transform: scale(1);
}

/* Deep green scrim: keeps the photograph readable as a backdrop while
   guaranteeing contrast for the text that sits on top of it. */
.auth__hero-scrim {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(13, 31, 23, .28) 0%, rgba(13, 31, 23, .60) 42%, rgba(13, 31, 23, .93) 100%),
        linear-gradient(90deg, rgba(11, 92, 49, .28) 0%, rgba(13, 31, 23, 0) 55%);
}

.auth__hero-top {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.auth__hero-mark {
    height: 44px;
    width: auto;
    display: block;
}

.auth__hero-name {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.auth__hero-body {
    max-width: 34rem;
}

.auth__hero-title {
    margin: 0 0 .9rem;
    font-size: clamp(1.9rem, 3vw, 2.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.auth__hero-title .is-accent {
    color: var(--brand-yellow, #FEC302);
}

.auth__hero-sub {
    margin: 0 0 2rem;
    max-width: 30rem;
    font-size: .95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .78);
}

.auth__hero-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .14);
    padding-top: 1.6rem;
}

.auth__hero-points li {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
}

.auth__hero-points i {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: .85rem;
    color: var(--brand-yellow, #FEC302);
    background: rgba(255, 255, 255, .08);
}

.auth__hero-points strong {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .1rem;
}

.auth__hero-points em {
    display: block;
    font-style: normal;
    font-size: .8125rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .66);
}

/* --------------------------------------------------------------------------
   Form panel (light)
   -------------------------------------------------------------------------- */

.auth__form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: var(--brand-surface, #ffffff);
}

.auth__form-inner {
    width: 100%;
    max-width: 25rem;
}

.auth__mobile-brand {
    display: none;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.75rem;
}

.auth__mobile-brand img {
    height: 40px;
    width: auto;
}

.auth__mobile-brand span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--brand-ink, #1B2420);
}

/* Language toggle */
.lang-toggle {
    display: inline-flex;
    padding: 3px;
    margin-bottom: 1.75rem;
    border: 1px solid var(--brand-line, #E2E8E4);
    border-radius: 8px;
    background: var(--brand-shell, #F5F7F6);
}

.lang-btn {
    border: 0;
    background: transparent;
    padding: .35rem .8rem;
    border-radius: 6px;
    font: inherit;
    font-size: .78rem;
    font-weight: 500;
    color: var(--brand-muted, #6B7A73);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.lang-btn:hover {
    color: var(--brand-ink, #1B2420);
}

.lang-btn.active {
    background: var(--brand-surface, #ffffff);
    color: var(--brand-header, #0B5C31);
    box-shadow: 0 1px 2px rgba(27, 36, 32, .06);
}

/* Heading */
.auth__head {
    margin-bottom: 1.75rem;
}

.auth__head h2 {
    margin: 0 0 .3rem;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--brand-ink, #1B2420);
}

.auth__head p {
    margin: 0;
    font-size: .875rem;
    color: var(--brand-muted, #6B7A73);
}

/* Errors */
.auth__error {
    display: flex;
    gap: .6rem;
    padding: .8rem .9rem;
    margin-bottom: 1.1rem;
    border: 1px solid #F0C9C9;
    border-left: 3px solid var(--brand-danger, #C62828);
    border-radius: 8px;
    background: var(--brand-danger-soft, #FBEAEA);
    color: #8E1F1F;
    font-size: .8125rem;
}

.auth__error i {
    margin-top: .12rem;
}

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

/* Fields */
.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    margin-bottom: .35rem;
    font-size: .78rem;
    font-weight: 500;
    color: var(--brand-ink, #1B2420);
}

.field__control {
    position: relative;
    display: flex;
    align-items: center;
}

.field__control > i {
    position: absolute;
    left: .85rem;
    font-size: .82rem;
    color: var(--brand-muted, #6B7A73);
    pointer-events: none;
}

.field__control input {
    width: 100%;
    padding: .7rem .9rem .7rem 2.4rem;
    font: inherit;
    font-size: .875rem;
    color: var(--brand-ink, #1B2420);
    background: var(--brand-shell, #F5F7F6);
    border: 1px solid var(--brand-line, #E2E8E4);
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.field__control input::placeholder {
    color: #9AA8A1;
}

.field__control input:focus {
    outline: none;
    background: var(--brand-surface, #ffffff);
    border-color: var(--brand-accent, #01A04D);
    box-shadow: 0 0 0 3px rgba(1, 160, 77, .14);
}

.field__toggle {
    position: absolute;
    right: .5rem;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--brand-muted, #6B7A73);
    cursor: pointer;
}

.field__toggle:hover {
    color: var(--brand-ink, #1B2420);
    background: var(--brand-line, #E2E8E4);
}

/* Options */
.options {
    display: grid;
    gap: .6rem;
    margin: 1.15rem 0 1.5rem;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .7rem .8rem;
    border: 1px solid var(--brand-line, #E2E8E4);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.option:hover {
    border-color: #C8D4CD;
    background: var(--brand-shell, #F5F7F6);
}

.option input {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin: .1rem 0 0;
    accent-color: var(--brand-action, #BE4F1A);
    cursor: pointer;
}

.option__body strong {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: var(--brand-ink, #1B2420);
}

.option__body em {
    display: block;
    font-style: normal;
    font-size: .75rem;
    line-height: 1.45;
    color: var(--brand-muted, #6B7A73);
}

.option:has(input:checked) {
    border-color: var(--brand-action, #BE4F1A);
    background: var(--brand-action-soft, #FDF0E6);
}

/* Submit - the action colour, never the identity green */
.auth__submit {
    position: relative;
    width: 100%;
    padding: .8rem 1rem;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--brand-action, #BE4F1A);
    cursor: pointer;
    transition: background .15s, transform .08s;
}

.auth__submit:hover:not(:disabled) {
    background: var(--brand-action-hover, #9A3F14);
}

.auth__submit:active:not(:disabled) {
    transform: translateY(1px);
}

.auth__submit:focus-visible {
    outline: 3px solid rgba(190, 79, 26, .35);
    outline-offset: 2px;
}

.auth__submit:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.auth__submit-text {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.auth__spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    margin-right: .5rem;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
    vertical-align: -.2em;
}

.auth__submit.is-loading .auth__spinner {
    display: inline-block;
}

.auth__submit.is-loading .auth__submit-text {
    opacity: .75;
}

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

/* Notes and footer */
.auth__note {
    margin: 1.1rem 0 0;
    font-size: .78rem;
    line-height: 1.55;
    color: var(--brand-muted, #6B7A73);
}

.auth__foot {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: 1.75rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--brand-line, #E2E8E4);
    font-size: .75rem;
    color: var(--brand-muted, #6B7A73);
}

.auth__foot-sep {
    opacity: .5;
}

/* --------------------------------------------------------------------------
   Help button + tutorial
   -------------------------------------------------------------------------- */

.help-button {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 60;
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--brand-header, #0B5C31);
    color: #ffffff;
    font-size: .95rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(27, 36, 32, .22);
    transition: background .15s;
}

.help-button:hover {
    background: var(--brand-chrome, #0D1F17);
}

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    background: rgba(13, 31, 23, .62);
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-spotlight {
    position: fixed;
    z-index: 71;
    display: none;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(13, 31, 23, .62);
    pointer-events: none;
    transition: all .25s ease;
}

.tutorial-spotlight.active {
    display: block;
}

.tutorial-tooltip {
    position: fixed;
    z-index: 72;
    width: min(21rem, calc(100vw - 2rem));
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--brand-line, #E2E8E4);
    border-radius: 12px;
    background: var(--brand-surface, #ffffff);
    box-shadow: 0 8px 28px rgba(27, 36, 32, .18);
}

.tutorial-badge {
    display: inline-block;
    margin-bottom: .5rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 600;
    color: var(--brand-header, #0B5C31);
    background: var(--brand-accent-soft, #E6F5EC);
}

.tutorial-tooltip h3 {
    margin: 0 0 .4rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--brand-ink, #1B2420);
}

.tutorial-tooltip p,
.tutorial-tooltip li {
    font-size: .8125rem;
    line-height: 1.55;
    color: var(--brand-muted, #6B7A73);
}

.tutorial-tooltip p {
    margin: 0 0 .5rem;
}

.tutorial-tooltip ul {
    margin: 0 0 .5rem;
    padding-left: 1.1rem;
}

.tutorial-progress {
    display: flex;
    gap: .3rem;
    margin: .75rem 0;
}

.tutorial-progress .progress-dot {
    width: 1.1rem;
    height: 3px;
    border-radius: 2px;
    background: var(--brand-line, #E2E8E4);
}

.tutorial-progress .progress-dot.active {
    background: var(--brand-action, #BE4F1A);
}

.tutorial-buttons {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.tutorial-btn {
    padding: .4rem .8rem;
    border-radius: 7px;
    border: 1px solid transparent;
    font: inherit;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
}

.tutorial-btn.skip,
.tutorial-btn.prev {
    background: transparent;
    border-color: var(--brand-line, #E2E8E4);
    color: var(--brand-muted, #6B7A73);
}

.tutorial-btn.skip:hover,
.tutorial-btn.prev:hover {
    color: var(--brand-ink, #1B2420);
    background: var(--brand-shell, #F5F7F6);
}

.tutorial-btn.next {
    background: var(--brand-action, #BE4F1A);
    color: #ffffff;
}

.tutorial-btn.next:hover {
    background: var(--brand-action-hover, #9A3F14);
}

/* --------------------------------------------------------------------------
   Responsive: below 900px the hero becomes a short banner, and below 640px
   it is dropped entirely so the form owns the whole viewport.
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .auth__hero {
        padding: 2rem 2rem;
    }

    .auth__hero-points {
        gap: .85rem;
    }
}

@media (max-width: 900px) {
    .auth {
        grid-template-columns: 1fr;
    }

    .auth__hero {
        min-height: 15rem;
        padding: 1.5rem;
    }

    .auth__hero-points,
    .auth__hero-sub {
        display: none;
    }

    .auth__hero-title {
        font-size: 1.6rem;
        margin-bottom: 0;
    }

    .auth__form-panel {
        padding: 2rem 1.25rem 3rem;
    }
}

@media (max-width: 640px) {
    .auth__hero {
        display: none;
    }

    .auth__mobile-brand {
        display: flex;
    }
}

@media (prefers-reduced-motion: reduce) {

    .auth__hero-bg,
    .auth__hero-bg.is-loaded {
        transition: none;
        transform: none;
    }

    .auth__spinner {
        animation-duration: 2s;
    }
}
