/* ==========================================================
   Roommate finder pages. Loads after auth.css and reuses its
   colour variables, .field, .btn, .check and .alert styles.
   ========================================================== */

body.finder {
    background: var(--paper);
}

/* ---------- Top bar ---------- */

.f-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 32px;
    color: var(--paper);
    background: var(--pine);
}

.f-top .auth-brand-logo {
    height: 48px;
}

.f-nav {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.f-nav::-webkit-scrollbar {
    display: none;
}

.f-nav a {
    flex: none;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--paper);
    text-decoration: none;
    white-space: nowrap;
    border-radius: 8px;
}

.f-nav .lng-switch {
    margin-left: 6px;
}

.f-nav a:hover,
.f-nav a.is-active {
    background: color-mix(in srgb, var(--paper) 14%, transparent);
}

.f-nav a:focus-visible,
.finder .link:focus-visible,
.post-card:focus-visible {
    outline: 3px solid var(--sun);
    outline-offset: 2px;
}

/* ---------- Page frame ---------- */

.f-wrap {
    max-width: 1120px;
    margin: 0 auto;
    padding: 40px 24px 96px;
}

.f-wrap h1,
.f-wrap h2,
.f-wrap legend {
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    letter-spacing: -0.02em;
}

.f-wrap h1 {
    margin: 0 0 6px;
    font-size: 34px;
    line-height: 1.15;
}

.f-wrap h2 {
    margin: 0 0 4px;
    font-size: 20px;
}

.f-wrap p {
    margin: 0;
}

.muted {
    color: var(--muted);
}

.finder .link {
    font-weight: 600;
    color: var(--pine);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.f-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 20px 0 28px;
}

.alert ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.alert--error {
    color: var(--error);
    background: color-mix(in srgb, var(--error) 9%, white);
    border-left-color: var(--error);
}

/* ---------- Extra buttons + inputs ---------- */

.btn--auto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 0 24px;
    text-decoration: none;
}

a.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

a.btn.btn--auto {
    display: inline-flex;
}

.btn--ghost {
    color: var(--pine);
    background: transparent;
    border: 1.5px solid var(--pine);
}

.btn--ghost:hover {
    color: var(--pine);
    background: color-mix(in srgb, var(--pine) 8%, transparent);
}

.field input[type="number"],
.field textarea {
    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 textarea {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
    resize: vertical;
}

.field input[type="number"]:hover,
.field textarea:hover {
    border-color: #a9bab5;
}

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

.field label.check {
    display: inline-flex;
    margin: 0;
    font-weight: 500;
}

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

/* ---------- Filters + listing grid ---------- */

.filters {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 32px;
}

.filters .field {
    margin: 0;
}

.filters .btn {
    height: 46px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    color: inherit;
    text-decoration: none;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    transition: border-color 0.15s ease;
}

.post-card:hover {
    border-color: var(--pine);
}

.price {
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--pine);
}

.price small {
    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    padding: 3px 10px;
    font-size: 13px;
    color: var(--muted);
    border: 1.5px solid var(--line);
    border-radius: 999px;
}

.chip--sun {
    color: var(--ink);
    background: color-mix(in srgb, var(--sun) 30%, white);
    border-color: transparent;
}

.post-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 14px;
    font-size: 14px;
    color: var(--muted);
    border-top: 1.5px solid var(--line);
}

.post-foot span {
    font-size: 13px;
}

.pager {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 48px 0;
}

/* ---------- Detail page ---------- */

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: start;
    margin-top: 20px;
}

.badge {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
}

.badge--open {
    color: var(--pine);
    background: color-mix(in srgb, var(--pine) 12%, white);
}

.badge--closed {
    color: var(--muted);
    background: #e8ecea;
}

.facts {
    margin: 24px 0 0;
}

.facts > div {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1.5px solid var(--line);
}

.facts dt {
    font-size: 14px;
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.side-box {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 14px;
}

/* The sidebar is too narrow for the two-column label/value layout .facts
   uses elsewhere on the page — stack label above value here instead. */
.side-box .facts > div {
    display: block;
    padding: 10px 0;
}

.side-box .facts dt {
    margin-bottom: 2px;
}

.side-box .facts dd {
    font-size: 15px;
}

.poster {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-box form {
    margin: 0;
}

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

.form-wrap {
    max-width: 720px;
}

.lede {
    margin-bottom: 32px !important;
}

.form-wrap fieldset,
.modal fieldset {
    margin: 0 0 32px;
    padding: 0;
    border: 0;
}

.f-wrap legend,
.modal legend {
    margin-bottom: 16px;
    padding: 0;
    font-size: 20px;
    font-weight: 700;
}

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

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* ---------- Lists (my posts, interested people) ---------- */

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1.5px solid var(--line);
}

.item-side {
    display: flex;
    align-items: center;
    gap: 20px;
}

.item-side .badge {
    margin: 0;
}

.interest {
    padding: 28px 0 8px;
    border-bottom: 1.5px solid var(--line);
}

.interest .facts {
    margin-top: 8px;
}

/* ---------- "I'm interested" pop-up ---------- */

.modal {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    overflow: auto;
    color: var(--ink);
    background: var(--paper);
    border: 0;
    border-radius: 16px;
}

.modal::backdrop {
    background: rgba(12, 46, 43, 0.6);
}

.modal-body {
    padding: 28px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.modal-head h2 {
    margin: 0 0 4px;
    font-family: "Bricolage Grotesque", "DM Sans", sans-serif;
    font-size: 24px;
}

.modal-head p {
    margin: 0;
}

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

@media (max-width: 860px) {
    .f-top {
        flex-wrap: wrap;
        padding: 12px 20px;
    }

    .f-wrap {
        padding: 28px 20px 72px;
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .detail {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .side-box {
        position: static;
    }

    .facts > div {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .item {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

    .f-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-body {
        padding: 20px;
    }
}

/* ---------- Photos ---------- */

.field input[type="file"]:not([hidden]) {
    display: block;
    width: 100%;
    padding: 10px;
    font: inherit;
    font-size: 14px;
    background: var(--white);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
}

/* The dropzone's own file input stays genuinely hidden — this old rule was
   written before the dropzone existed and was overriding its hidden attribute. */
.field input[type="file"][hidden] {
    display: none;
}

.thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
}

.thumb .check {
    margin-top: 6px;
    font-size: 14px;
}

.post-cover {
    display: block;
    width: calc(100% + 44px);
    height: 170px;
    margin: -22px -22px 6px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0 0;
}

.gallery a:first-child {
    grid-column: 1 / -1;
}

.gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
}

.gallery a:first-child img {
    aspect-ratio: 16 / 9;
}

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

/* ==========================================================
   Drag-and-drop photo uploader
   ========================================================== */

.dz {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 180px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--paper);
    border: 2px dashed var(--line);
    border-radius: 14px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dz:hover {
    border-color: #a9bab5;
}

.dz.is-drag {
    border-color: var(--pine);
    background: color-mix(in srgb, var(--pine) 6%, var(--paper));
}

.dz.is-over {
    border-color: var(--error);
}

.dz-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    padding: 8px;
    color: var(--pine);
    background: color-mix(in srgb, var(--pine) 10%, white);
    border-radius: 50%;
}

.dz-title {
    margin: 0;
    font-weight: 600;
    color: var(--ink);
}

.dz-sub {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.dz.is-over .dz-sub {
    color: var(--error);
    font-weight: 600;
}

.dz-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 4px;
}

.dz.has-files .dz-previews {
    margin-top: 14px;
}

.dz-thumb {
    position: relative;
    cursor: default;
}

.dz-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
}

.dz-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-size: 15px;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    background: var(--pine-deep);
    border: 2px solid var(--paper);
    border-radius: 50%;
}

/* ==========================================================
   Real Estate: tabs, deal/price badges, my-listings cards
   ========================================================== */

.re-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1.5px solid var(--line);
}

.re-tab {
    padding: 10px 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2.5px solid transparent;
    margin-right: 20px;
}

.re-tab.is-active {
    color: var(--pine);
    border-bottom-color: var(--pine);
}

.re-deal {
    display: inline-block;
    padding: 3px 10px;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
}

.re-deal--rent {
    color: #2563a8;
    background: color-mix(in srgb, #2563a8 12%, white);
}

.re-deal--sale {
    color: var(--pine-deep);
    background: var(--sun);
}

.re-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--pine);
    margin: 6px 0 14px;
}

.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.cards .card {
    display: block;
    overflow: hidden;
    text-decoration: none;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: 14px;
}

.card-photo {
    position: relative;
    aspect-ratio: 4 / 3;
    background: color-mix(in srgb, var(--pine) 8%, white);
}

.card-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
}

.card-body strong {
    color: var(--ink);
}

/* ==========================================================
   Lightbox (shared JS component lives in every layout, but this
   styling was only ever added to member.css — roommate and real
   estate photos need it here too, or clicking a photo opens an
   unstyled, effectively invisible overlay)
   ========================================================== */

[hidden] {
    display: none !important;
}

.lb-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 20, 18, 0.92);
    padding: 24px;
}

.lb-overlay img {
    max-width: min(90vw, 900px);
    max-height: 85vh;
    border-radius: 8px;
    object-fit: contain;
}

.lb-close,
.lb-prev,
.lb-next {
    position: absolute;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.lb-close {
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    font-size: 24px;
}

.lb-prev,
.lb-next {
    top: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    transform: translateY(-50%);
}

.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
    background: rgba(255, 255, 255, 0.22);
}
