/* ==========================================================
   Roommate Finder: auth pages (login + register)
   Self-contained. Does not depend on Tailwind or Vite.
   ========================================================== */

/* Colours come from brand.css (load it first). */

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

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

body.auth {
    font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.auth-shell {
    display: grid;
    grid-template-columns: minmax(340px, 5fr) 7fr;
    min-height: 100vh;
}

.auth-side {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    color: var(--paper);
    background: var(--pine);
}

.auth-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.01em;
    color: var(--paper);
    text-decoration: none;
}

.auth-brand-logo {
    display: block;
    height: 120px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.auth-pitch {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-pitch h2 {
    margin: 0 0 16px;
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 3.6vw, 48px);
    line-height: 1.08;
    letter-spacing: -0.025em;
}

.auth-pitch p {
    margin: 0;
    max-width: 34ch;
    color: color-mix(in srgb, var(--paper) 70%, var(--pine));
}

.auth-plan {
    position: absolute;
    right: -60px;
    bottom: -40px;
    width: 460px;
    max-width: 90%;
    color: var(--pine-line);
    pointer-events: none;
}

.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.auth-panel {
    width: 100%;
    max-width: 400px;
}

.auth-panel--wide {
    max-width: 520px;
}

/* ---------- Headings ---------- */

.auth-panel h1 {
    margin: 0 0 6px;
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.auth-lede {
    margin: 0 0 32px;
    color: var(--muted);
}

/* ---------- Form ---------- */

.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field select {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%235d6f6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.field input:hover,
.field select:hover {
    border-color: #a9bab5;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--pine);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--pine) 16%, transparent);
}

.field input::placeholder {
    color: #94a4a0;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    box-shadow: 0 0 0 100px var(--white) inset;
}

.field.has-error input,
.field.has-error select {
    border-color: var(--error);
}

.field-hint {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--muted);
}

.field-error {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--error);
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.form-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -4px 0 24px;
    font-size: 14px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    cursor: pointer;
}

.check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--pine);
}

/* ---------- Buttons + links ---------- */

.btn {
    display: block;
    width: 100%;
    height: 48px;
    font: inherit;
    font-weight: 700;
    color: var(--white);
    background: var(--pine);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover {
    background: var(--pine-deep);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible,
.auth-panel a:focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 3px;
}

.auth-panel a {
    color: var(--pine);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.auth-panel a:hover {
    color: var(--pine-deep);
}

.auth-switch {
    margin: 24px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--pine-deep);
    background: color-mix(in srgb, var(--pine) 10%, white);
    border-left: 4px solid var(--pine);
    border-radius: 6px;
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-side {
        padding: 20px 24px;
    }

    .auth-pitch,
    .auth-plan {
        display: none;
    }

    .auth-brand-logo {
        height: 64px;
    }

    .auth-main {
        align-items: flex-start;
        padding: 32px 24px 48px;
    }
}

@media (max-width: 480px) {
    .row-2 {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
