/* Roommate matching portal pages.
   Authored against the Web Awesome design tokens already on :root. */

/* ---- Matches index ---- */

.roommate-matches {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
}

.roommate-matches__title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin-bottom: 1rem;
}

.roommate-matches__section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin: 1.5rem 0 0.75rem;
}

.roommate-matches__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.roommate-match-card {
  background: var(--wa-color-surface-raised);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  padding: 1rem;
}

.roommate-matches__section-sub {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0 0 0.75rem;
}

.roommate-matches__section-title + .roommate-matches__section-sub {
  margin-top: -0.5rem;
}

.roommate-matches__search {
  display: block;
  margin: 0.75rem 0;
}

.roommate-match-card--suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.roommate-match-card--suggestion .roommate-match-card__suggestion-body {
  flex: 1;
  min-width: 0;
}
.roommate-match-card--suggestion .roommate-match-card__actions {
  margin-top: 0;
  flex: none;
}
@media (max-width: 640px) {
  .roommate-match-card--suggestion { flex-wrap: wrap; }
  .roommate-match-card--suggestion .roommate-match-card__actions { width: 100%; justify-content: flex-end; }
}

.roommate-match-card__name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.roommate-match-card__meta {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin-top: 0.25rem;
}

.roommate-match-card__preferences {
  color: var(--wa-color-text-normal);
  margin-top: 0.5rem;
}

.roommate-match-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.roommate-match-card__accept,
.roommate-match-card__request {
  background: var(--wa-color-brand-fill-normal);
  color: var(--wa-color-brand-on-normal);
  border: none;
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.roommate-match-card__decline {
  background: transparent;
  color: var(--wa-color-text-quiet);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.roommate-match-card__decline-reason {
  width: 100%;
  color: var(--wa-color-text-normal);
  background: var(--wa-color-surface-default);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem;
}

/* Incoming request card: horizontal booking-style layout (Figma). */
.roommate-match-card--request {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.roommate-match-card__thumb {
  flex: none;
  width: 5rem;
  height: 5rem;
  border-radius: var(--wa-border-radius-m);
  overflow: hidden;
  background: var(--wa-color-surface-lowered);
}

.roommate-match-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.roommate-match-card__thumb-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
}

.roommate-match-card__body {
  flex: 1;
  min-width: 0;
}

.roommate-match-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.roommate-match-card__hotel {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

.roommate-match-card__status {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-match-card__status--confirmed,
.roommate-match-card__status--checked_in {
  color: var(--wa-color-success-on-quiet);
  background: var(--wa-color-success-fill-quiet);
  border-color: var(--wa-color-success-fill-quiet);
}

.roommate-match-card__stay {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin-top: 0.25rem;
}

.roommate-match-card__request-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.roommate-match-card__avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-normal);
  font-size: 0.75rem;
  font-weight: 600;
}

.roommate-match-card__request-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--wa-color-text-normal);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.roommate-match-card__pending {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.125rem 0.5rem;
}

.roommate-match-card__explainer {
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
  margin: 0.5rem 0 0;
}

.roommate-match-card--request .roommate-match-card__actions {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.5rem;
}

.roommate-match-card--request .roommate-match-card__actions form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* HMS-823 — Reason + Decline stay on one row: the form never wraps
   internally; if space is short the whole form wraps as one unit. */
.roommate-match-card--request .roommate-match-card__decline-form {
  flex-wrap: nowrap;
}

.roommate-match-card--request .roommate-match-card__decline-form .roommate-match-card__reason {
  min-width: 0;
  flex: 1 1 10rem;
}

.roommate-match-card__view-details {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-s);
  background: transparent;
  color: var(--wa-color-text-normal);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.roommate-match-card__accept-match {
  display: inline-block;
  background: var(--wa-color-success-fill-normal);
  color: var(--wa-color-success-on-normal);
  border: none;
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.roommate-match-card__decline-match {
  display: inline-block;
  background: transparent;
  color: var(--wa-color-danger-on-quiet);
  border: 1px solid var(--wa-color-danger-fill-quiet);
  border-radius: var(--wa-border-radius-s);
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.roommate-match-card__ref {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--wa-color-text-quiet);
}

.roommate-matches__empty {
  color: var(--wa-color-text-quiet);
  text-align: center;
  padding: 2rem;
}

/* ---- Confirmation ---- */

.roommate-confirmation {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ---- Match show (Figma 516:7197) — centered card, hero, shared summary ---- */

.roommate-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--wa-color-surface-raised);
  border: 1px solid var(--wa-color-neutral-border-quiet);
  border-radius: var(--wa-border-radius-m);
  padding: 1.5rem;
}

/* Green confirm hero: icon disc + title/subtitle row. The --confirmed modifier
   is the only coloured hero; pending keeps the quiet neutral disc. */
.roommate-card__hero {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-card__hero-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  border-radius: 50%;
  background: var(--wa-color-surface-lowered);
  color: var(--wa-color-text-quiet);
  font-size: 1.125rem;
}

.roommate-card__hero-icon--confirmed {
  background: var(--wa-color-success-fill-quiet);
  color: var(--wa-color-success-on-quiet);
}

.roommate-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--wa-color-text-normal);
  margin: 0;
}

.roommate-card__subtitle {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0.25rem 0 0;
}

.roommate-card__summary {
  padding: 1rem 0;
}

.roommate-card__summary-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-color-text-normal);
  margin: 0 0 0.75rem;
}

/* The two-party header row: grey box split into "You (Primary)" | "Roommate". */
.roommate-card__parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  background: var(--wa-color-surface-lowered);
  border-radius: var(--wa-border-radius-m);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

/* The right column hugs the grey box's right edge so the roommate name lines
   up with the right-aligned values in the detail rows below. */
.roommate-card__party:last-child {
  text-align: right;
}

.roommate-card__party-role {
  display: block;
  font-size: 0.75rem;
  color: var(--wa-color-text-quiet);
}

.roommate-card__party-name {
  display: block;
  font-weight: 600;
  color: var(--wa-color-text-normal);
}

/* Details read as a label/value split — the label left, value right-aligned. */
.roommate-card__details {
  margin: 0;
}

.roommate-card__detail {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.9375rem;
}

.roommate-card__detail dt {
  color: var(--wa-color-text-quiet);
}

.roommate-card__detail dd {
  margin: 0;
  color: var(--wa-color-text-normal);
  text-align: right;
}

/* Blue-left-border info note under the summary. */
.roommate-card__note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0.625rem 0.875rem;
  border-left: 3px solid var(--wa-color-brand);
  background: var(--wa-color-brand-fill-quiet);
  font-size: 0.875rem;
  color: var(--wa-color-text-normal);
}

/* Footer actions: outlined + plain + filled primary, wrapping at mobile widths. */
.roommate-card__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--wa-color-neutral-border-quiet);
}

.roommate-card__action {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--wa-border-radius-m);
  background: transparent;
  color: var(--wa-color-text-normal);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.roommate-card__action--outlined {
  border: 1px solid var(--wa-color-neutral-border-quiet);
  background: var(--wa-color-surface-raised);
}

.roommate-card__action--primary {
  background: var(--wa-color-brand);
  color: var(--wa-color-brand-on-loud);
}

@media (max-width: 40rem) {
  .roommate-card__hero {
    flex-direction: column;
    text-align: center;
  }

  .roommate-card__actions .roommate-card__action,
  .roommate-card__actions form {
    width: 100%;
  }

  .roommate-card__actions .roommate-card__action {
    text-align: center;
  }
}

@media (max-width: 40rem) {
  /* Stack the hotel thumb above the body so request content gets the full
     card width (matches the stacked booking card on My Bookings). */
  .roommate-match-card--request {
    flex-direction: column;
  }

  /* Keep the avatar beside the name: wrapping the row itself drops the whole
     text block under the avatar. Only the text wraps, inside the row. */
  .roommate-match-card--request .roommate-match-card__request-text {
    flex-wrap: wrap;
    min-width: 0;
  }

  .roommate-match-card--request .roommate-match-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .roommate-match-card--request .roommate-match-card__actions .roommate-match-card__view-details,
  .roommate-match-card--request .roommate-match-card__actions form,
  .roommate-match-card--request .roommate-match-card__actions button {
    width: 100%;
  }

  /* Mobile keeps the stacked look: reason on its own full-width row,
     Decline wrapping below it, so re-allow the internal wrap here. */
  .roommate-match-card--request .roommate-match-card__actions .roommate-match-card__decline-form {
    flex-wrap: wrap;
  }

  .roommate-match-card--request .roommate-match-card__actions .roommate-match-card__decline-form .roommate-match-card__reason {
    max-width: none;
    flex: 1 1 100%;
  }

  .roommate-match-card--request .roommate-match-card__ref {
    margin-left: 0;
    text-align: right;
  }
}

/* HMS-744/750/762 — request details, decline-reason input, resolved badges */

.roommate-match-card__sent {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0;
}

.roommate-match-card__share {
  font-size: 0.875rem;
  color: var(--wa-color-text-normal);
  margin: 0;
}

.roommate-match-card__note {
  font-size: 0.875rem;
  color: var(--wa-color-text-quiet);
  margin: 0;
}

/* Decline-with-reason form: input + button on one row, wraps on narrow. */
.roommate-match-card__decline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.roommate-match-card__reason {
  max-width: 14rem;
}

/* Resolved badges — Declined reads as danger, Cancelled as neutral. */
.roommate-match-card__pending--declined {
  color: var(--wa-color-danger-on-quiet);
  background: var(--wa-color-danger-fill-quiet);
  border-color: var(--wa-color-danger-fill-quiet);
}

.roommate-match-card__pending--cancelled {
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border-color: var(--wa-color-neutral-border-quiet);
}

/* HMS-909 — expired reads the same as cancelled: terminal, not anyone's act. */
.roommate-match-card__pending--expired {
  color: var(--wa-color-text-quiet);
  background: var(--wa-color-surface-lowered);
  border-color: var(--wa-color-neutral-border-quiet);
}

.roommate-match-card--closed {
  opacity: 0.85;
}
