/* Compare Tray - shared component (models.aspx, quick-possessions.aspx) */

.compare-tray {
  --tray-pad: 0.85rem 1rem;
  --tray-font: 0.7rem;
  --item-font: 0.72rem;
  --item-pad: 0.35rem 0.4rem 0.35rem 0.75rem;
  --item-name-w: 180px;
  --remove-size: 18px;

  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 999;
  width: min(400px, calc(100vw - 2rem));
  max-height: min(320px, calc(100vh - 2rem));
  display: flex;
  flex-direction: column;
  background: var(--main-color);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.compare-tray-header,
.compare-tray-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: var(--tray-pad);
}

.compare-tray-header {
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.compare-tray-body {
  align-content: flex-start;
  overflow-y: auto;
}

.compare-tray-title {
  margin: 0 0.6rem 0 0;
  font-size: var(--tray-font);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;

  color: white !important;
}

.compare-tray-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.compare-tray-actions .btn {
  white-space: nowrap;
}

.compare-tray-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: var(--item-pad);
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
  border-radius: 999px;
  font-size: var(--item-font);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.compare-tray-item-name {
  max-width: var(--item-name-w);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-tray-item-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--remove-size);
  height: var(--remove-size);
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.compare-tray-item-remove:hover,
.compare-tray-item-remove:focus-visible {
  background: var(--main-color);
  color: #fff;
  outline: none;
}

/* Compact, and capped (not edge-to-edge) so it clears a bottom-right chat widget */
@media (max-width: 575.98px) {
  .compare-tray {
    --tray-pad: 0.6rem 0.75rem;
    --tray-font: 0.6rem;
    --item-font: 0.66rem;
    --item-pad: 0.28rem 0.3rem 0.28rem 0.6rem;
    --item-name-w: 110px;
    --remove-size: 16px;
    left: 0.5rem;
    bottom: 0.5rem;
    width: min(300px, calc(100vw - 5rem));
    max-height: 45vh;
    border-radius: 12px;
  }

  .compare-tray-header,
  .compare-tray-body {
    gap: 0.4rem;
  }

  .compare-tray-actions .btn {
    font-size: 0.68rem;
    padding: 0.35rem 0.6rem !important;
  }

  .compare-tray-item-remove {
    font-size: 0.75rem;
  }
}

/* Stack of two trays (community.aspx: Models + Homes trays can both be visible) */
#compareTrayStack {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
  width: min(400px, calc(100vw - 2rem));
  pointer-events: none;
}

#compareTrayStack .compare-tray {
  position: relative;
  inset: auto;
  width: 100%;
  margin: 0;
  pointer-events: auto;
}

@media (max-width: 575.98px) {
  #compareTrayStack {
    left: 0.5rem;
    bottom: 0.5rem;
    width: min(300px, calc(100vw - 5rem));
  }
}
