/* ========================================
   Staff sign-in page
   ======================================== */
:root {
    --green-900: #064e3b;
    --green-800: #065f46;
    --green-700: #047857;
    --mint: #86efac;
    --ink: #111827;
    --ink-2: #4b5563;
    --ink-3: #6b7280;
    --line: #e5e7eb;
    --danger: #b91c1c;
}

*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The page always fits the screen exactly - no scrolling */
html, body { height: 100%; overflow: hidden; }

body {
    background: #fff;
    color: var(--ink);
    font-family: 'Montserrat', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.login-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 1fr);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---------- Photo panel ---------- */
.login-visual {
    position: relative;
    overflow: hidden;
    background: var(--green-900);
}

.login-visual picture,
.login-visual img {
    display: block;
    width: 100%;
    height: 100%;
}

.login-visual img {
    object-fit: cover;
    object-position: 45% center;
}

/* Soft shade only at the bottom so the caption reads; the photo stays clear */
.login-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(6, 78, 59, 0) 55%, rgba(6, 40, 31, 0.78) 100%);
}

.login-visual-copy {
    position: absolute;
    z-index: 1;
    right: clamp(24px, 4vw, 56px);
    bottom: clamp(28px, 5vw, 56px);
    left: clamp(24px, 4vw, 56px);
    max-width: 520px;
    color: #fff;
}

.login-visual-kicker {
    margin-bottom: 10px;
    color: var(--mint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-visual-quote {
    font-size: clamp(20px, 1.9vw, 28px);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* ---------- Sign-in panel ---------- */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(32px, 5vw, 72px) clamp(24px, 5vw, 64px);
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-logo { display: inline-block; margin-bottom: clamp(20px, 4vh, 40px); }
.login-logo img { display: block; width: clamp(190px, 16vw, 240px); height: auto; }

.login-head h1 {
    color: var(--ink);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.login-head p {
    margin-top: 8px;
    color: var(--ink-3);
    font-size: 14px;
    line-height: 1.55;
}

.login-form { margin-top: 28px; }

.field { margin-bottom: 18px; }

.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.field-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.forgot-password {
    margin-bottom: 7px;
    color: var(--green-700);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}

.forgot-password:hover { text-decoration: underline; }

.field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 14.5px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: #9ca3af; }
.field input:hover { border-color: #9ca3af; }

.field input:focus {
    border-color: var(--green-800);
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.14);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }

.toggle-password {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transform: translateY(-50%);
}

.toggle-password:hover { background: #f3f4f6; color: var(--ink); }
.toggle-password:focus-visible { outline: 2px solid var(--green-800); outline-offset: 1px; }

.error-message {
    display: none;
    margin: 2px 0 16px;
    padding: 10px 12px;
    border-left: 3px solid var(--danger);
    border-radius: 6px;
    background: #fef2f2;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.45;
}

.error-message.show { display: block; }
.error-message.is-info { border-left-color: var(--green-800); background: #ecfdf5; color: var(--green-900); }

.login-btn {
    width: 100%;
    height: 46px;
    margin-top: 6px;
    border: 0;
    border-radius: 8px;
    background: var(--green-900);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.login-btn:hover { background: var(--green-800); }
.login-btn:focus-visible { outline: 2px solid var(--green-900); outline-offset: 3px; }
.login-btn:disabled { opacity: 0.85; cursor: progress; }
.login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.login-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 12.5px;
}

.login-footer a {
    color: var(--ink-2);
    font-weight: 600;
    text-decoration: none;
}

.login-footer a:hover { color: var(--green-800); }

/* ---------- Loading overlay (shown while signing in) ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
}

.loader {
    width: 36px;
    height: 36px;
    border: 3px solid #d1fae5;
    border-top-color: var(--green-900);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
    .login-card { max-width: 420px; }
}

@media (max-width: 1024px) {
    .login-page { grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr); }
}

/* Tablets & phones: photo becomes a short banner above the form */
@media (max-width: 860px) {
    .login-page {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;   /* photo takes whatever space the form leaves */
    }

    .login-visual { min-height: 0; }
    .login-visual img { object-position: center 30%; }
    .login-visual-copy { bottom: 20px; }
    .login-visual-quote { font-size: 18px; }

    .login-panel { padding: 24px 24px max(24px, env(safe-area-inset-bottom)); }
    .login-logo { margin-bottom: 18px; }
    .login-logo img { width: 190px; }
}

@media (max-width: 420px) {
    .login-visual-kicker { margin-bottom: 6px; }
    .login-visual-quote { font-size: 16px; }
    .login-head h1 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
    .loader { animation-duration: 2s; }
}

/* Phones: tighter spacing so the photo keeps a useful slice of the screen */
@media (max-width: 860px) and (max-height: 760px) {
    .login-head p { display: none; }
    .login-form { margin-top: 16px; }
    .field { margin-bottom: 12px; }
    .login-footer { margin-top: 18px; padding-top: 14px; }
    .login-visual-copy { display: none; }
}

/* Very short screens (e.g. a phone turned sideways): drop the photo, keep the form */
@media (max-height: 520px) {
    .login-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; }
    .login-visual { display: none; }
    .login-panel { align-items: center; padding: 12px 24px; }
    .login-logo { margin-bottom: 10px; }
    .login-logo img { width: 160px; }
    .login-head p, .login-footer { display: none; }
    .login-form { margin-top: 10px; }
    .field { margin-bottom: 10px; }
}

/* Short laptop screens: keep the whole form visible */
@media (min-width: 861px) and (max-height: 720px) {
    .login-panel { padding-top: 20px; padding-bottom: 20px; }
    .login-logo { margin-bottom: 16px; }
    .login-head p { display: none; }
    .login-form { margin-top: 18px; }
    .field { margin-bottom: 12px; }
    .login-footer { margin-top: 18px; padding-top: 14px; }
}
