/* =========================================================
   LOGIN PAGE — matches the SA glass / monochrome theme
   (uses variables from style.css)
   ========================================================= */

.login-page {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        calc(env(safe-area-inset-top, 0px) + 5rem)
        1.25rem
        calc(env(safe-area-inset-bottom, 0px) + 2rem);
}

/* ---------- Back link ---------- */
.login-back {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 1.25rem);
    left: 1.25rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.1rem;
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.login-back:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.35); transform: translateX(-3px); }

/* ---------- Card ---------- */
.login-wrap { width: 100%; display: flex; justify-content: center; }

.login-card {
    --mx: 50%;
    --my: 0%;
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: clamp(1.75rem, 5vw, 2.75rem);
    overflow: hidden;
    animation: loginIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Soft spotlight that follows the cursor (set in login.js) */
.login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.07), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.login-card:hover::before { opacity: 1; }

@keyframes loginIn {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Header ---------- */
.login-head { text-align: center; margin-bottom: 2rem; position: relative; }
.login-logo { height: 56px; width: auto; margin-bottom: 1.2rem; }
.login-head h1 {
    font-size: clamp(1.8rem, 6vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.2;
    margin-bottom: 0.6rem;
    padding-bottom: 0.1em;
}
.login-head p { color: var(--text-muted); font-size: 0.95rem; font-weight: 300; }

/* ---------- Form ---------- */
.login-form { display: flex; flex-direction: column; gap: 1.2rem; position: relative; }

.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-wrap { position: relative; }
.field-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.3s ease;
}
.input-wrap input {
    width: 100%;
    padding: 1.05rem 3rem 1.05rem 2.9rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;              /* 16px: stops iOS zoom on focus */
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.input-wrap input::placeholder { color: rgba(255, 255, 255, 0.28); }
.input-wrap input:focus {
    outline: none;
    border-color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}
.input-wrap:focus-within .field-icon { color: var(--text-main); }

/* Chrome autofill: keep the dark look */
.input-wrap input:-webkit-autofill {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #111 inset;
    caret-color: #fff;
}

/* Show/hide password */
.toggle-pass {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    border-radius: 12px;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.toggle-pass:hover { color: var(--text-main); }

/* Validation */
.field.invalid .input-wrap input { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.1); }
.field.invalid .field-icon { color: #f87171; }
.field-error {
    display: none;
    font-size: 0.8rem;
    color: #f87171;
    padding-left: 0.2rem;
}
.field.invalid .field-error { display: block; }

/* Remember / Forgot row */
.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: -0.2rem;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    user-select: none;
}
.remember input { position: absolute; opacity: 0; pointer-events: none; }
.check-box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: transparent;
    transition: all 0.25s ease;
}
.remember input:checked + .check-box { background: var(--text-main); border-color: var(--text-main); color: var(--bg-base); }
.remember input:focus-visible + .check-box { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12); }

.link-btn {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.4rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}
.link-btn:hover { color: var(--text-main); border-color: rgba(255, 255, 255, 0.4); }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Submit */
.login-submit {
    position: relative;
    width: 100%;
    margin-top: 0.4rem;
    padding: 1.05rem 1.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}
.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: var(--bg-base);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.login-submit.loading { pointer-events: none; opacity: 0.85; }
.login-submit.loading .btn-spinner { display: inline-block; }

.login-foot {
    text-align: center;
    margin-top: 1.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    position: relative;
}
.login-foot a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    transition: border-color 0.3s ease;
}
.login-foot a:hover { border-color: var(--text-main); }

/* Little shake when validation fails */
.login-card.shake { animation: shake 0.45s ease; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}

/* =========================================================
   TOAST NOTIFICATIONS (bottom-right)
   ========================================================= */
.toast-stack {
    position: fixed;
    right: 1.5rem;
    top: calc(env(safe-area-inset-top, 0px) + 1.5rem);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    --toast-accent: #ffffff;
    --toast-time: 5000ms;
    position: relative;
    width: min(380px, calc(100vw - 2rem));
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.9rem;
    padding: 1rem 1rem 1.15rem 1.1rem;
    border-radius: 18px;
    background: rgba(16, 16, 16, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-top: 1px solid var(--glass-highlight);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    pointer-events: auto;
    animation: toastIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.toast.success { --toast-accent: #4ade80; }
.toast.error   { --toast-accent: #f87171; }
.toast.info    { --toast-accent: #ffffff; }
.toast.leaving { animation: toastOut 0.35s ease forwards; }

.toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--toast-accent);
    background: color-mix(in srgb, var(--toast-accent) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--toast-accent) 35%, transparent);
}
.toast-body { min-width: 0; }
.toast-title { font-size: 0.95rem; font-weight: 700; color: var(--text-main); line-height: 1.3; }
.toast-msg { margin-top: 0.2rem; font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.toast-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: color 0.3s ease, background 0.3s ease;
}
.toast-close:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.08); }

/* Auto-dismiss progress bar */
.toast-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    background: var(--toast-accent);
    opacity: 0.8;
    transform-origin: left;
    animation: toastBar var(--toast-time) linear forwards;
}
.toast:hover .toast-bar { animation-play-state: paused; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(40px) scale(0.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(40px) scale(0.96); } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 600px) {
    .login-page { padding-left: 1rem; padding-right: 1rem; align-items: flex-start; padding-top: calc(env(safe-area-inset-top, 0px) + 5.5rem); }
    .login-back { left: 1rem; padding: 0.55rem 1rem; }
    .login-head { margin-bottom: 1.6rem; }

    /* Toasts: full width at the bottom on phones */
    .toast-stack {
        right: 1rem;
        left: 1rem;
        top: calc(env(safe-area-inset-top, 0px) + 1rem);
        align-items: stretch;
    }
    .toast { width: 100%; }
    @keyframes toastIn  { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes toastOut { to   { opacity: 0; transform: translateY(30px); } }
}

@media (max-width: 360px) {
    .login-options { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}

@media (hover: none) {
    .login-back:hover { transform: none; }
    .login-card::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .login-card, .toast, .login-card.shake { animation: none; }
}

/* =========================================================
   PAID CLIENT ACCESS NOTICE
   ========================================================= */
.login-page.login-gated {
    overflow: hidden;
}

.access-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(3, 2, 4, 0.62);
    backdrop-filter: blur(18px) saturate(0.78);
    -webkit-backdrop-filter: blur(18px) saturate(0.78);
    animation: accessFadeIn 0.35s ease both;
}

.access-modal-backdrop.is-closing {
    animation: accessFadeOut 0.26s ease forwards;
    pointer-events: none;
}

.access-modal {
    position: relative;
    width: min(100%, 480px);
    padding: clamp(1.7rem, 5vw, 2.5rem);
    overflow: hidden;
    text-align: center;
    border: 1px solid rgba(211, 78, 99, 0.58);
    border-top-color: rgba(241, 232, 235, 0.58);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(56, 16, 28, 0.96), rgba(12, 10, 14, 0.98) 62%, rgba(47, 9, 20, 0.96));
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.8),
        0 0 46px rgba(150, 27, 52, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    animation: accessModalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.access-modal::after {
    content: "";
    position: absolute;
    left: 16%;
    right: 16%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #b93651, #e7e2e4, #b93651, transparent);
    box-shadow: 0 0 18px rgba(205, 48, 75, 0.72);
}

.access-modal-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    color: #f0e9eb;
    font-size: 1.35rem;
    border: 1px solid rgba(229, 220, 224, 0.5);
    border-radius: 18px;
    background: linear-gradient(135deg, #b8b9bf, #84243a);
    box-shadow: 0 0 24px rgba(185, 43, 68, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.access-modal-kicker {
    margin-bottom: 0.45rem;
    color: #e18a99;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.access-modal h1 {
    margin: 0;
    color: #f2eff1;
    font-size: clamp(1.65rem, 5vw, 2.2rem);
}

.access-modal-message,
.access-modal-note {
    max-width: 390px;
    margin: 0.9rem auto 0;
    color: #c6c3c9;
    line-height: 1.6;
}

.access-modal-note {
    margin-top: 0.65rem;
    color: #e5dce0;
    font-size: 0.88rem;
}

.access-modal-actions {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 0.75rem;
    margin-top: 1.6rem;
}

.access-modal-actions .btn-glow,
.access-modal-actions .btn-nav-outline {
    min-height: 48px;
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
}

.access-modal-actions .access-home {
    justify-content: center;
}

@keyframes accessFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes accessFadeOut { to { opacity: 0; } }
@keyframes accessModalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
    .access-modal {
        padding: 1.55rem 1.15rem 1.45rem;
        border-radius: 24px;
    }

    .access-modal-actions {
        grid-template-columns: 1fr;
    }

    .access-modal-actions .btn-glow,
    .access-modal-actions .btn-nav-outline {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .access-modal-backdrop,
    .access-modal,
    .access-modal-backdrop.is-closing {
        animation: none;
    }
}

/* =========================================================
   QUENDEVS RED / SILVER LOGIN FINISH
   ========================================================= */
.login-page {
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(ellipse 48% 46% at 12% 18%, rgba(112, 20, 38, 0.38), transparent 72%),
        radial-gradient(ellipse 42% 48% at 90% 86%, rgba(82, 12, 27, 0.35), transparent 74%),
        linear-gradient(135deg, #19070d 0%, #090507 44%, #020203 100%);
}

.login-wrap {
    position: relative;
    z-index: 1;
}

.login-card {
    border: 1px solid rgba(197, 71, 89, 0.42);
    border-top-color: rgba(235, 225, 228, 0.42);
    background:
        linear-gradient(145deg, rgba(48, 16, 25, 0.78), rgba(13, 13, 16, 0.9) 58%, rgba(41, 10, 19, 0.72));
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.72),
        0 0 42px rgba(126, 23, 45, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.login-card::after {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #b83b55, #e1dfe2, #b83b55, transparent);
    box-shadow: 0 0 18px rgba(184, 59, 85, 0.72);
}

.login-head {
    position: relative;
}

.login-logo {
    display: block;
    width: 220px;
    max-width: none;
    height: auto;
    margin: -1.25rem auto -0.2rem;
    filter: drop-shadow(0 0 10px rgba(201, 48, 72, 0.32));
}

.login-head p {
    color: #b9bbc2;
}

.field label {
    color: #d5d7dc;
}

.input-wrap input {
    border-color: rgba(205, 209, 217, 0.22);
    background: rgba(3, 3, 5, 0.48);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.input-wrap input:focus {
    border-color: rgba(225, 91, 112, 0.82);
    background: rgba(67, 13, 25, 0.34);
    box-shadow:
        0 0 0 4px rgba(184, 45, 68, 0.14),
        0 0 18px rgba(137, 24, 47, 0.2);
}

.input-wrap:focus-within .field-icon,
.toggle-pass:hover {
    color: #f0dce0;
}

.check-box {
    border-color: rgba(218, 221, 227, 0.38);
    background: rgba(0, 0, 0, 0.3);
}

.remember input:checked + .check-box {
    background: linear-gradient(135deg, #d9d6d9, #9b3044);
    border-color: #d9d6d9;
    color: #180a0e;
}

.link-btn {
    color: #d9aeb6;
}

.link-btn:hover {
    color: #ffffff;
    border-color: #c84a61;
}

.login-submit {
    margin-top: 0.65rem;
    min-height: 56px;
}

.login-foot a {
    color: #e2c8cd;
    border-color: rgba(204, 71, 93, 0.58);
}

.login-foot a:hover {
    color: #ffffff;
    border-color: #e27b8c;
}

.login-back {
    color: #d7d9df;
    background: rgba(17, 9, 12, 0.62);
    border-color: rgba(207, 212, 219, 0.28);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}

.login-back:hover,
.login-back:focus-visible {
    color: #ffffff;
    border-color: rgba(224, 83, 106, 0.76);
    background: rgba(91, 17, 33, 0.58);
    transform: translateX(-3px);
}

@media (max-width: 600px) {
    .login-page {
        padding-top: calc(env(safe-area-inset-top, 0px) + 5rem);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
    }

    .login-back {
        top: calc(env(safe-area-inset-top, 0px) + 0.85rem);
        left: 1rem;
        padding: 0.55rem 0.85rem;
        font-size: 0.82rem;
    }

    .login-card {
        max-width: 100%;
        padding: 1.65rem 1.15rem 1.5rem;
        border-radius: 24px;
    }

    .login-logo {
        width: 190px;
        margin-top: -1rem;
    }

    .login-head h1 {
        font-size: 1.8rem;
    }

    .login-options {
        align-items: flex-start;
    }

    .login-submit {
        min-height: 54px;
    }
}
