/* ═══════════════════════════════════════════════════════════════════
   Log in / Sign up
   ═══════════════════════════════════════════════════════════════════

   Both pages rendered dark on a site whose homepage is light, and the
   login page carried a "Why Hubionis?" panel of four cards written for
   the old conference product — "Network: connect with organizers,
   speakers, and attendees". Somebody on the login page has already
   decided; they need the form, not a pitch.

   So these are built out of the homepage's own parts: the hero's
   gradient ground, the search card's hairline-and-shadow treatment, its
   flat fields divided by hairlines, and its filled action button. Same
   tokens, same radius, same weights — the login page should look like
   the place you just came from, not like a different product.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Ground ─────────────────────────────────────────────────────── */

.auth-page {
    min-height: calc(100vh - 220px);
    padding: clamp(2rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem);
    /* The same three stops as .td-hero, so arriving here from the
       homepage is a continuation rather than a change of scene. */
    background: linear-gradient(170deg,
        var(--hub-bg-deep) 0%,
        var(--hub-bg) 55%,
        var(--hub-elev) 100%);
    color: var(--hub-ink);
}

.auth-wrap {
    width: min(1080px, 100% - 2.5rem);
    margin-inline: auto;
}

/* Login is one decision, so one column, held near the top rather than
   floated in the middle of an empty screen. Sign-up has something worth
   reading beside it. */
.auth-wrap-narrow { width: min(460px, 100% - 2.5rem); }

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
}

/* ── Heading ────────────────────────────────────────────────────── */

.auth-head { margin-bottom: clamp(1.25rem, 3vw, 2rem); }

.auth-title {
    margin: 0 0 0.6rem;
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 800;
    text-wrap: balance;
}

.auth-sub {
    margin: 0;
    max-width: 52ch;
    font-size: clamp(0.98rem, 1.4vw, 1.08rem);
    line-height: 1.6;
    color: var(--hub-ink-muted);
}

/* ── The card ───────────────────────────────────────────────────── */

.auth-card {
    background: var(--hub-elev);
    border: 1px solid var(--hub-hairline);
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow);
    overflow: hidden;
}

.auth-card-body { padding: clamp(1.25rem, 3vw, 1.85rem); }

/* ── Fields ─────────────────────────────────────────────────────── */

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.auth-field:last-of-type { margin-bottom: 0; }

.auth-field label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hub-ink-muted);
}

.auth-field input,
.auth-field select {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--hub-hairline);
    border-radius: 10px;
    background: var(--hub-surface);
    color: var(--hub-ink);
    font: inherit;
    font-size: 0.98rem;
    transition: border-color var(--hub-transition), background var(--hub-transition);
}

.auth-field input::placeholder { color: var(--hub-ink-faint); }

.auth-field input:hover,
.auth-field select:hover { border-color: rgb(var(--hub-accent-rgb) / 0.4); }

.auth-field input:focus-visible,
.auth-field select:focus-visible {
    outline: 2px solid var(--hub-focus);
    outline-offset: 1px;
    border-color: transparent;
}

/* The reveal button sits inside the input's right edge. It is positioned
   against this wrapper and not against .auth-field-password, because that
   also contains the password rules — anchoring to the field put the button
   below the input, over the rules box. */
.auth-input-wrap { position: relative; display: block; }

.auth-field-password input { padding-right: 3rem; }

.auth-field-password .password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hub-ink-muted);
    cursor: pointer;
}

.auth-field-password .password-toggle:hover { color: var(--hub-ink); }
.auth-field-password .password-toggle svg { width: 20px; height: 20px; }

/* ── Password rules ─────────────────────────────────────────────
   js/form-enhancements.js toggles .valid on these by id, so the ids and
   the .req-icon span have to stay exactly as they are. */

.password-requirements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.35rem 1rem;
    margin-top: 0.65rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--hub-hairline);
    border-radius: 10px;
    background: var(--hub-surface);
}

.req-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--hub-ink-muted);
}

.req-icon {
    flex: none;
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgb(var(--hub-ink-rgb) / 0.1);
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    color: var(--hub-ink-muted);
}

/* The classes are req-met / req-unmet — that is what
   form-enhancements.js toggles. Styling a .valid that nothing ever sets
   left every rule looking unmet however good the password was. */
.req-item.req-met { color: var(--hub-ink); }

.req-item.req-met .req-icon {
    background: var(--hub-accent);
    color: var(--hub-on-accent);
}

.req-item.req-unmet .req-icon {
    background: rgb(var(--hub-error-rgb) / 0.15);
    color: var(--hub-error);
}

/* ── Phone ──────────────────────────────────────────────────────── */

/* form-enhancements.js styles the country button as the left half of a
   single control — square inner corners, no right border — so the two must
   touch. A gap left it floating with a stray edge. */
.phone-input-group {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.phone-input-group .phone-number-input { flex: 1; min-width: 0; }

/* ── Checkboxes ─────────────────────────────────────────────────── */

.auth-consents {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin: 1.25rem 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hub-hairline);
}

.checkbox-label {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 0.65rem;
    align-items: start;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--hub-ink-muted);
    cursor: pointer;
}

/* The box itself — .checkbox-custom, its tick and its checked state — is
   styled by js/form-enhancements.js, which injects those rules at runtime
   and would override anything written here. Only the row layout above
   belongs to this file. */

.checkbox-label a { color: var(--hub-accent-strong); }

/* ── Actions ────────────────────────────────────────────────────── */

.auth-submit {
    width: 100%;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border: 0;
    border-radius: 999px;
    background: var(--hub-fill);
    color: var(--hub-on-fill);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter var(--hub-transition);
}

.auth-submit:hover { filter: brightness(1.05); }
.auth-submit:disabled { opacity: 0.6; cursor: progress; }

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.9rem 0 1.25rem;
}

.auth-row .checkbox-label { margin: 0; font-size: 0.86rem; }

.auth-link {
    color: var(--hub-accent-strong);
    font-size: 0.88rem;
    font-weight: 600;
}

.auth-foot {
    margin: 1.15rem 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--hub-ink-muted);
}

.auth-foot a { color: var(--hub-accent-strong); font-weight: 700; }

/* ── Roles, on the sign-up page ─────────────────────────────────
   Kept because it is the honest answer to "can I sell tours here" — an
   agency account is granted after the business is verified, and saying
   so beats a dropdown that pretends the choice is the visitor's. */

.auth-aside {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: clamp(1.25rem, 3vw, 1.6rem);
    border: 1px solid var(--hub-hairline);
    border-radius: var(--hub-radius);
    background: rgb(var(--hub-elev-rgb) / 0.6);
}

.auth-aside-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.auth-role {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 0.85rem;
    align-items: start;
}

.auth-role-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgb(var(--hub-accent-rgb) / 0.12);
    color: var(--hub-accent-strong);
}

.auth-role-icon svg { width: 22px; height: 22px; }

.auth-role h3 {
    margin: 0 0 0.25rem;
    font-size: 0.98rem;
    font-weight: 700;
}

.auth-role p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--hub-ink-muted);
}

/* ── Messages ───────────────────────────────────────────────────── */

.auth-alert {
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgb(var(--hub-error-rgb) / 0.45);
    border-radius: 10px;
    background: rgb(var(--hub-error-rgb) / 0.08);
    color: var(--hub-error);
    font-size: 0.9rem;
}

.auth-alert-ok {
    border-color: rgb(var(--hub-accent-rgb) / 0.45);
    background: rgb(var(--hub-accent-rgb) / 0.08);
    color: var(--hub-accent-strong);
}

/* ── Responsive ─────────────────────────────────────────────────── */

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

    /* The roles explain what an account is for, which is worth reading
       before the form rather than after eleven fields of it. */
    .auth-aside { order: -1; }
}

@media (max-width: 640px) {
    .auth-wrap, .auth-wrap-narrow { width: min(1080px, 100% - 1.75rem); }
    .password-requirements { grid-template-columns: 1fr; }
    .auth-row { flex-direction: column; align-items: flex-start; gap: 0.65rem; }
}

@media (hover: none) and (pointer: coarse) {
    .auth-field input, .auth-field select { min-height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-field input, .auth-field select, .checkbox-custom,
    .checkbox-custom::after, .auth-submit { transition: none; }
}

/* Marks a field the form does not require, so nobody fills in a phone
   number believing they must. */
.auth-optional {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    /* muted, not faint: faint measures 3.64:1 on white and this is small text */
    color: var(--hub-ink-muted);
}

/* password-toggle.js swaps which of the two eyes is displayed. */
.auth-field-password .password-toggle .eye-icon { width: 20px; height: 20px; }

/* Sign-up is a single column now: the two role notes beside it are gone, so
   the form gets a readable measure instead of half a wide grid. */
.auth-wrap-form { width: min(560px, 100% - 2.5rem); }

@media (max-width: 640px) {
    .auth-wrap-form { width: min(560px, 100% - 1.75rem); }
}
