/* =========================
   LOGIN MODAL
========================= */

/* The login/forgot/reset forms use class .login-form{display:flex}; an author
   rule like that overrides the UA [hidden] rule, so honour [hidden] explicitly. */
[hidden]{
    display:none !important;
}

.login-modal{
    position:fixed;
    inset:0;

    background:rgba(28,17,10,.58);
    backdrop-filter:blur(8px);

    display:none;
    /* The box centers itself with margin:auto (see .login-box). Centering
       it with align-items:center instead clipped the top of the box, and
       the close button with it, whenever the screen was shorter than the
       box: a phone held sideways, or with the keyboard open. This way a
       short screen scrolls from the top. */
    align-items:flex-start;
    justify-content:center;

    padding:16px;
    overflow-y:auto;
    overscroll-behavior:contain;

    z-index:9999;
}

.login-modal.active{
    display:flex;
}

/* LOGIN BOX */

.login-box{
    width:560px;
    max-width:100%;
    margin:auto;

    background:var(--sg-ivory);
    border:1px solid rgba(217,184,114,.4);

    border-radius:24px;
    padding:40px 48px 36px;

    position:relative;

    box-shadow:0 32px 80px rgba(20,12,6,.4);
}

/* CLOSE (X) — top-right; same ✕ glyph as the Property Detail close */

.close-login{
    position:absolute;
    top:25px;
    right:25px;

    width:40px;
    height:40px;

    border:none;
    background:transparent;

    cursor:pointer;

    display:flex;
    align-items:center;
    justify-content:center;

    color:var(--sg-muted);
    font-size:24px;
    line-height:1;

    transition:color .2s ease, transform .2s ease;
}

.close-login:hover{
    color:var(--sg-espresso);
    transform:scale(1.08);
}

.close-login:focus-visible{
    outline:2px solid var(--sg-gold);
    outline-offset:2px;
    border-radius:8px;
}

/* HEADER IMAGE */

.login-header{
    text-align:center;
    margin-bottom:30px;
}

.login-header img{
    width:280px;
    max-width:100%;
    height:auto;
}

/* FORM */

.login-form{
    display:flex;
    flex-direction:column;
    gap:20px;
}

/* INPUT CONTAINER */

.input-group{
    display:flex;
    align-items:center;
    gap:15px;

    background:#fff;
    border:1px solid var(--sg-line);

    padding:0 16px;

    border-radius:12px;

    transition:border-color .2s ease, box-shadow .2s ease;
}

.input-group:focus-within{
    border-color:var(--sg-gold);
    box-shadow:0 0 0 3px rgba(184,138,68,.2);
}

/* USER + KEY ICON */

.input-icon{
    width:28px;
    height:28px;
    object-fit:contain;
    flex-shrink:0;
    opacity:.7;
}

/* INPUT FIELD */

.input-group input{
    flex:1;

    height:54px;

    border:none;
    background:transparent;

    color:var(--sg-ink);

    font-family:inherit;
    font-size:18px;
    outline:none;
}

.input-group input::placeholder{
    color:#a99a88;
}

/* BROWSER AUTOFILL — the UA slaps its own light-blue-grey background onto
   autofilled fields; push the container's grey back over it. Each browser's
   form of the pseudo-class sits in its own rule so an unknown selector in
   one browser never voids the rules the others support. */
.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus,
.input-group input:-webkit-autofill:active{
    -webkit-box-shadow:0 0 0 1000px #fff inset;
    box-shadow:0 0 0 1000px #fff inset;
    -webkit-text-fill-color:#2a1d14;
}
.input-group input:autofill{
    -webkit-box-shadow:0 0 0 1000px #fff inset;
    box-shadow:0 0 0 1000px #fff inset;
    -webkit-text-fill-color:#2a1d14;
}
.input-group input:-moz-autofill{
    box-shadow:0 0 0 1000px #fff inset;
    color:#2a1d14;
}
.input-group input{
    transition:background-color 999999s ease-out;
}

/* PASSWORD */

.password-group{
    position:relative;
}

/* EYE ICON */

/* eye container */
.eye-toggle{
    width:26px;
    height:26px;
    position:relative;
    cursor:pointer;
    flex-shrink:0;
}

/* Finger-sized tap area around the 26px icon, without changing its size or
   the layout. */
.eye-toggle::after{
    content:'';
    position:absolute;
    inset:-9px;
}

/* both eye images stacked */
.eye-toggle img{
    position:absolute;
    top:0;
    left:0;

    width:100%;
    height:100%;

    object-fit:contain;
    transition:0.2s ease;

    /* The eye artwork is white (it was drawn for a grey field); on the
       white field it is turned to a soft dark tone, keeping its shape. */
    filter:brightness(0);
}

/* default: show closed eye */
.eye-toggle .closed{
    opacity:.65;
}

.eye-toggle .open{
    opacity:0;
}

/* active state */
.eye-toggle.active .open{
    opacity:.65;
}

.eye-toggle.active .closed{
    opacity:0;
}

/* NATIVE REVEAL / CLEAR — the browser draws its own eye/clear button inside
   the password field on top of our custom .eye-toggle; hide it. Each
   pseudo-element is a separate rule because a selector Edge doesn't know
   is dropped whole-rule (never whole-list). */
.input-group input[type="password"]::-ms-reveal{
    display:none;
}
.input-group input[type="password"]::-ms-clear{
    display:none;
}
.input-group input[type="password"]::-webkit-reveal{
    display:none;
}
.input-group input[type="password"]::reveal{
    display:none;
}
.input-group input[type="password"]::reveal-icon{
    display:none;
}
.input-group input[type="password"]::clear-icon{
    display:none;
}



/* ACCESS BUTTON */

/* Primary action on the ivory card = espresso, like the page's other
   light-surface buttons. min-width keeps the old 140px size while letting
   a longer label (UPDATE PASSWORD on the reset page) fit. */
.access-btn{
    min-width:150px;
    height:50px;
    padding:0 30px;

    margin:10px auto 0;

    border:none;

    background:var(--sg-espresso);
    color:#fbf6ec;

    border-radius:12px;

    font-family:inherit;
    font-size:14px;
    font-weight:600;
    letter-spacing:.14em;
    white-space:nowrap;

    cursor:pointer;

    transition:background .25s ease, box-shadow .25s ease;
}

.access-btn:hover{
    background:var(--sg-brand);
    box-shadow:0 10px 22px rgba(var(--sg-shadow),.22);
}

.access-btn:focus-visible{
    outline:3px solid rgba(184,138,68,.5);
    outline-offset:3px;
}

.access-btn:disabled{
    background:#cdbfaa;
    box-shadow:none;
    cursor:not-allowed;
}

/* TEXT LINK BUTTONS (Forgot Password? / Back to login) */

.link-btn{
    align-self:center;

    border:none;
    background:transparent;

    color:var(--sg-brand);

    font-family:inherit;
    font-size:14px;
    font-weight:600;

    padding:2px 6px;

    cursor:pointer;

    transition:.2s;

    position:relative;
}

/* Invisible extra tap area; the link looks and sits exactly as before. */
.link-btn::after{
    content:'';
    position:absolute;
    inset:-10px -8px;
}

.link-btn:hover{
    color:var(--sg-brand-dark);
    text-decoration:underline;
    text-underline-offset:3px;
}

/* Pull the link up tight under the password field. */
#loginForm .link-btn{
    margin-top:-10px;
}

/* Disabled inputs during a lockout (greyed, non-editable) */

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

/* MESSAGE BANNERS — #auth-error (login form) and #forgot-msg (forgot form)
   share one banner style. #auth-error defaults to hidden here because
   login-modal.js shows it with an inline style.display; #forgot-msg is
   shown/hidden through the hidden attribute (the [hidden] rule above).
   The error / warning / success variant classes are set from
   login-modal.js (setMsgKind). */

#auth-error{
    display:none;
}

.login-banner{
    position:relative;

    margin:0;
    padding:11px 14px 11px 42px;

    border:1px solid transparent;
    border-left-width:4px;
    border-radius:10px;

    font-size:14px;
    line-height:1.45;
}

/* Round icon badge on the left — drawn as an inline SVG background so the
   message text (set through textContent) stays the only readable content. */

.login-banner::before{
    content:'';
    position:absolute;
    left:12px;
    top:50%;

    width:20px;
    height:20px;
    margin-top:-10px;

    border-radius:50%;
    background-repeat:no-repeat;
    background-position:center;
    background-size:12px 12px;
}

/* error — wrong credentials, empty fields, "Email not found",
   "Something went wrong", "No portal is linked" */

.login-banner.error{
    background:#fdecea;
    border-color:#f2c4be;
    border-left-color:#c0392b;
    color:#7a2d24;
}

.login-banner.error::before{
    background-color:#c0392b;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.3 2.3l7.4 7.4M9.7 2.3l-7.4 7.4' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* warning — the login lockout countdown and the forgot-email throttle */

.login-banner.warning{
    background:#fffbf1;
    border-color:#eccf86;
    border-left-color:#d4a017;
    color:#8a6405;
}

.login-banner.warning::before{
    background-color:#d4a017;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 1.5v6.5' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='6' cy='10' r='1.4' fill='%23fff'/%3E%3C/svg%3E");
}

/* success — "Reset link sent" / "Request sent" confirmations */

.login-banner.success{
    background:var(--sg-ok-bg);
    border-color:var(--sg-ok-line);
    border-left-color:var(--sg-ok);
    color:var(--sg-ok);
}

.login-banner.success::before{
    background-color:#2d7a52;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.8 6.3l2.9 2.9 5.5-6.2' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Entrance — plays once each time a banner is shown (the display / hidden
   flip in the JS restarts it), never on the lockout countdown's 250 ms text
   updates: those only touch textContent. */

@media (prefers-reduced-motion: no-preference){

    .login-banner.warning,
    .login-banner.success{
        animation:login-banner-in .18s ease-out;
    }

    .login-banner.error{
        animation:login-banner-shake .2s ease-out;
    }

}

@keyframes login-banner-in{
    from{
        opacity:0;
        transform:translateY(-6px);
    }
}

@keyframes login-banner-shake{
    0%  { opacity:0; transform:translateX(0); }
    20% { opacity:1; }
    30% { transform:translateX(-4px); }
    55% { transform:translateX(4px); }
    80% { transform:translateX(-2px); }
    100%{ opacity:1; transform:translateX(0); }
}

/* =========================
   SMALL SCREENS + TOUCH
========================= */

/* Phones: the desktop box (45px side padding, 22px type, 28px icons) leaves
   only ~80px for typing on a 320px screen. Same layout, tighter spacing.
   Inputs stay at 18px: below 16px iOS zooms the page in on focus. */
@media screen and (max-width:480px){

    .login-box{
        padding:30px 22px 28px;
        border-radius:20px;
    }

    .close-login{
        top:14px;
        right:14px;
    }

    .login-header{
        margin-bottom:22px;
    }

    .login-form{
        gap:16px;
    }

    .input-group{
        gap:10px;
        padding:0 12px;
    }

    .input-icon{
        width:24px;
        height:24px;
    }

    .input-group input{
        font-size:18px;
    }

    .access-btn{
        font-size:13px;
    }
}

/* Landscape phones: very little height, so trim the vertical rhythm. */
@media screen and (max-height:500px){

    .login-box{
        padding-top:24px;
        padding-bottom:24px;
    }

    .login-header{
        margin-bottom:16px;
    }

    .login-header img{
        width:200px;
    }

    .login-form{
        gap:14px;
    }
}

@media (pointer:coarse){

    .close-login{
        width:44px;
        height:44px;
    }

    .access-btn{
        height:48px;
    }
}
