/* =========================================================
   PHASE 5 HOA - PUBLIC AUTH PAGES
   login.php, forgot_password.php, reset_password.php
   Frosted card over the blurred HOA office photo.
   Built on ui.css / tokens.css. Header: public-auth-header.css.
========================================================= */

@import url("ui.css?v=1");

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

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

body {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--hoa-maroon-900);
    color: var(--hoa-ink);
    font-family: var(--hoa-font-body);
    font-size: var(--hoa-fs-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(40, 18, 22, .42), rgba(40, 18, 22, .58)),
        url("../image/HOAOFFICE.jpg") center / cover no-repeat;
    content: "";
    pointer-events: none;
    filter: blur(4px);
    transform: scale(1.05);
}

/* ---------- Layout ---------- */
.main,
.forgot-main {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: var(--hoa-s-7) var(--hoa-s-4);
}

/* reset_password.php has no header or <main>: center the card in body */
body > .reset-container {
    margin: auto;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
}

/* ---------- Card ---------- */
.login-card,
.forgot-container,
.reset-container {
    width: 100%;
    max-width: 440px;
    padding: var(--hoa-s-6);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--hoa-r-lg);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--hoa-shadow-2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: auth-card-in .35s var(--hoa-ease);
}

.reset-container {
    margin-block: var(--hoa-s-7);
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Logo */
.card-brand,
.forgot-container .logo,
.reset-container .logo {
    width: 76px;
    height: 76px;
    margin: 0 auto var(--hoa-s-3);
}

.card-brand img,
.forgot-container .logo img,
.reset-container .logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: translateY(4px) scale(1.75);
}

/* Titles */
.login-title,
.forgot-container h2,
.reset-container h2 {
    margin: 0 0 var(--hoa-s-2);
    color: var(--hoa-maroon-900);
    font-family: var(--hoa-font-display);
    font-size: var(--hoa-fs-hero);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    text-align: center;
    text-wrap: balance;
}

.forgot-container h2,
.reset-container h2 {
    font-size: 1.75rem;
}

.login-subtitle,
.forgot-container .description,
.reset-container .description {
    max-width: 34ch;
    margin: 0 auto var(--hoa-s-5);
    color: var(--hoa-ink-2);
    font-size: var(--hoa-fs-md);
    line-height: 1.55;
    text-align: center;
}

.forgot-container .description {
    font-size: var(--hoa-fs-body);
}

/* ---------- Form ---------- */
.login-card form,
.forgot-container form,
.reset-container form {
    display: grid;
    gap: 6px;
}

.form-group {
    display: grid;
    gap: 6px;
    margin-bottom: var(--hoa-s-3);
}

.label-row {
    display: flex;
}

.login-card label,
.forgot-container label,
.reset-container label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    color: var(--hoa-ink);
    font-size: var(--hoa-fs-sm);
    font-weight: 600;
}

.forgot-container input + label,
.reset-container input + label {
    margin-top: var(--hoa-s-3);
}

.required-dot,
.required-marker {
    color: var(--hoa-bad);
    font-weight: 700;
}

.login-card input,
.forgot-container input,
.reset-container input {
    width: 100%;
    min-height: var(--hoa-control-h);
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--hoa-line-strong);
    border-radius: var(--hoa-r-sm);
    background: var(--hoa-surface);
    color: var(--hoa-ink);
    font: inherit;
    font-size: var(--hoa-fs-body);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.login-card input::placeholder,
.forgot-container input::placeholder,
.reset-container input::placeholder {
    color: #a89ea0;
}

.login-card input:hover,
.forgot-container input:hover,
.reset-container input:hover {
    border-color: #c9b5b0;
}

.login-card input:focus,
.forgot-container input:focus,
.reset-container input:focus {
    outline: none;
    border-color: var(--hoa-maroon-500);
    box-shadow: var(--hoa-focus-ring);
}

.login-card input.is-invalid,
.forgot-container input.is-invalid,
.reset-container input.is-invalid {
    border-color: var(--hoa-bad);
    box-shadow: 0 0 0 4px rgba(162, 45, 54, .1);
}

/* Password show/hide */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 50px;
}

.show-password {
    position: absolute;
    top: 50%;
    right: 4px;
    display: grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--hoa-ink-3);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .15s ease, color .15s ease;
}

.show-password:hover {
    background: #f4eeec;
    color: var(--hoa-maroon-700);
}

.show-password:focus-visible {
    outline: none;
    box-shadow: var(--hoa-focus-ring);
}

.show-password svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Forgot link */
.forgot-password {
    margin: -2px 0 var(--hoa-s-4);
    text-align: right;
}

.forgot-password a {
    color: var(--hoa-maroon-500);
    font-size: var(--hoa-fs-sm);
    font-weight: 600;
    text-decoration: none;
}

.forgot-password a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Primary button */
.login-button,
.forgot-container button,
.reset-container button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    margin-top: var(--hoa-s-3);
    padding: 0 18px;
    border: 0;
    border-radius: var(--hoa-r-sm);
    background: var(--hoa-maroon-700);
    color: #fff;
    font: inherit;
    font-size: var(--hoa-fs-md);
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(75, 29, 34, .2);
    transition: background .15s ease, box-shadow .15s ease, transform .1s ease;
}

.login-button {
    margin-top: 0;
}

.login-button:hover,
.forgot-container button:hover,
.reset-container button:hover {
    background: var(--hoa-maroon-900);
    box-shadow: 0 10px 24px rgba(75, 29, 34, .26);
}

.login-button:active,
.forgot-container button:active,
.reset-container button:active {
    transform: translateY(1px);
}

.login-button:focus-visible,
.forgot-container button:focus-visible,
.reset-container button:focus-visible {
    outline: 3px solid rgba(227, 185, 60, .75);
    outline-offset: 2px;
}

/* Secondary links / notes */
.register-section {
    margin-top: var(--hoa-s-5);
    padding-top: var(--hoa-s-4);
    border-top: 1px solid var(--hoa-line);
    color: var(--hoa-ink-2);
    font-size: var(--hoa-fs-sm);
    text-align: center;
}

.register-section a,
.back-login a {
    color: var(--hoa-maroon-500);
    font-weight: 700;
    text-decoration: none;
}

.register-section a:hover,
.back-login a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.admin-note {
    margin-top: var(--hoa-s-3);
    color: var(--hoa-ink-3);
    font-size: var(--hoa-fs-cap);
    line-height: 1.5;
    text-align: center;
}

.back-login {
    margin-top: var(--hoa-s-5);
    padding-top: var(--hoa-s-4);
    border-top: 1px solid var(--hoa-line);
    font-size: var(--hoa-fs-sm);
    text-align: center;
}

/* Footer (login.php) */
.footer {
    padding: var(--hoa-s-4) var(--hoa-s-5);
    background: rgba(34, 22, 24, .88);
    color: rgba(255, 255, 255, .86);
    font-size: var(--hoa-fs-sm);
    letter-spacing: .03em;
    text-align: center;
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
    .main,
    .forgot-main {
        padding: var(--hoa-s-6) var(--hoa-s-4);
    }

    .login-card,
    .forgot-container,
    .reset-container {
        padding: var(--hoa-s-5);
    }

    .reset-container {
        width: calc(100% - 32px);
        margin-block: var(--hoa-s-5);
    }

    .card-brand,
    .forgot-container .logo,
    .reset-container .logo {
        width: 64px;
        height: 64px;
    }

    .login-title {
        font-size: 1.875rem;
    }

    /* 16px stops iOS zooming into the field */
    .login-card input,
    .forgot-container input,
    .reset-container input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .login-card,
    .forgot-container,
    .reset-container {
        animation: none;
    }
}
