/* Frontend list layout — layout-specific rules only (shared: frontend-shared.css). */

/* List layout containers */

.rmfw-layout-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rmfw-layout-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  scrollbar-gutter: stable;
  padding: 12px 0;
}

.rmfw-layout-list-items > .rmfw-card-list {
  min-width: 0;
  max-width: 100%;
}

/* List cards */

.rmfw-card-list {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  background-color: var(--card, #ffffff);
  border-radius: 0.75rem;
  border: 1px solid var(--border, #e5e7eb);
  padding: 1rem;
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

/* Row 1: logo | name + type + address */
.rmfw-card-list__top {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}

.rmfw-card-list__top .rmfw-retailer-main {
  flex: 1 1 auto;
  min-width: 0;
}

.rmfw-card-list__top .rmfw-retailer-pricing--layout-top {
  margin-left: auto;
  align-self: flex-start;
  text-align: right;
}

/* Narrow viewports: duplicate price in meta row; hide top copy (see ProductRetailers.php). */
.rmfw-card-list__meta .rmfw-retailer-pricing--layout-meta {
  display: none;
}

/* Inside bottom: stock (left) + price (right, column) — meta copy only on small screens */
.rmfw-card-list__meta {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  min-width: 0;
}

.rmfw-card-list__meta--no-stock {
  justify-content: flex-end;
}

.rmfw-card-list__meta .rmfw-card-list__stock-col {
  flex: 0 1 auto;
  min-width: 0;
}

.rmfw-card-list__divider {
  display: block;
  width: 100%;
  height: 0;
  margin: 0.75rem 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--border, #e5e7eb);
}

.rmfw-card-list--compact .rmfw-card-list__divider {
  margin-top: 0.5rem;
}

/* Bottom: meta (stock + price) | actions */
.rmfw-card-list__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  width: 100%;
}

.rmfw-card-list__bottom--actions-only {
  justify-content: flex-end;
}

.rmfw-card-list__stock-col {
  flex: 1 1 auto;
  min-width: 0;
}

.rmfw-card-list__actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.rmfw-card-list__stock-col .rmfw-retailer-stock {
  margin-top: 0;
}

.rmfw-card-list__actions .rmfw-retailer-button,
.rmfw-card-list__actions .rmfw-direction-btn {
  margin-top: 0;
}

.rmfw-card-list--compact {
  padding: 0.75rem;
}

.rmfw-card-list:hover {
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.rmfw-card-list--best-price {
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 1px
    color-mix(in oklab, var(--primary, #4f46e5) 20%, transparent);
  /* Room for absolute Best Price badge so scroll containers do not clip it */
  padding-top: 1.35rem;
}

.rmfw-badge-best-price {
  position: absolute;
  right: 1rem;
  top: -0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.375rem;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  z-index: 1;
}

/* .rmfw-badge-best-price--compact {
  top: 0.25rem;
  font-size: 0.65rem;
  padding: 0.1rem 0.5rem;
} */

.rmfw-retailer-logo {
  background-color: var(--muted, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  overflow: hidden;
}

.rmfw-retailer-logo.rmfw-retailer-logo--compact {
  width: 3rem;
  height: 3rem;
}

.rmfw-retailer-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.rmfw-retailer-logo-initial {
  color: var(--muted-foreground, #6b7280);
  font-weight: 500;
  font-size: 0.875rem;
}

.rmfw-retailer-logo-initial--compact {
  font-size: 0.75rem;
}

.rmfw-retailer-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

/* .rmfw-retailer-main-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
} */

.rmfw-retailer-name {
  font-weight: 600;
  color: var(--foreground, #111827);
  font-size: 0.9rem;
}

.rmfw-retailer-name--compact {
  font-size: 0.85rem;
}

.rmfw-retailer-type {
  border-radius: 0.25rem;
  border: 1px solid var(--border, #e5e7eb);
  background-color: color-mix(in oklab, var(--muted, #f3f4f6) 50%, transparent);
  color: var(--muted-foreground, #6b7280);
  padding: 0.125rem 0.5rem;
  font-size: 13px;
}

.rmfw-retailer-type--compact {
  font-size: 0.625rem;
  padding: 0.0625rem 0.4rem;
}

.rmfw-retailer-address {
  margin-top: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  max-width: 100%;
  min-width: 0;
  color: var(--muted-foreground, #6b7280);
  font-size: 14px;
  line-height: 1.45;
}

.rmfw-retailer-address > svg {
  flex-shrink: 0;
  margin-top: 0.12em;
  color: inherit;
  float: none;
}

.rmfw-retailer-address__text {
  flex: 1 1 0;
  min-width: 0;
  display: block;
}

.rmfw-retailer-address__text > .rmfw-retailer-address__label {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* .rmfw-retailer-address.rmfw-retailer-address--compact {
  font-size: 0.75rem;
} */

/* Truncated list view: full wrapped address on small screens; short + tooltip from 992px */
.rmfw-retailer-address--expandable .rmfw-retailer-address__label--short {
  display: none;
}

.rmfw-retailer-address--expandable .rmfw-retailer-address__label--full {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rmfw-retailer-address--expandable .rmfw-retailer-address__tooltip {
  display: none;
}

@media (min-width: 992px) {
  .rmfw-retailer-address--expandable .rmfw-retailer-address__label--short {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .rmfw-retailer-address--expandable .rmfw-retailer-address__label--full {
    display: none;
  }

  .rmfw-retailer-address--expandable .rmfw-retailer-address__tooltip {
    display: block;
  }
}

/* Full address on hover/focus when list view truncates (see ProductRetailers.php) */
.rmfw-retailer-address--expandable {
  position: relative;
  align-self: flex-start;
  max-width: 100%;
  cursor: default;
}

.rmfw-retailer-address--expandable:focus-visible {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 2px;
  border-radius: 2px;
}

.rmfw-retailer-address__tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 30;
  min-width: 12rem;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  background-color: #111827;
  color: #ffffff;
  font-size: 0.8125rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
}

.rmfw-retailer-address__tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -7px;
  border-width: 0 7px 8px 7px;
  border-style: solid;
  border-color: transparent transparent #111827 transparent;
}

.rmfw-retailer-address--expandable:hover .rmfw-retailer-address__tooltip,
.rmfw-retailer-address--expandable:focus-within
  .rmfw-retailer-address__tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.rmfw-retailer-stock {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 14px;
}

.rmfw-retailer-pricing {
  text-align: right;
  flex-shrink: 0;
}

.rmfw-retailer-price {
  font-weight: 700;
  font-size: 16px;
  color: var(--foreground, #111827);
  margin-top: 5px;
}

/* .rmfw-retailer-price--compact {
  font-size: 0.88rem;.rmfw-retailer-address
} */

.rmfw-retailer-original {
  margin-top: 0.125rem;
  font-size: 14px;
  color: var(--muted-foreground, #50575e);
  text-decoration: line-through;
}

/* .rmfw-retailer-original--compact {
  font-size: 0.75rem;
} */

.rmfw-retailer-button {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  transform-origin: center;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.rmfw-retailer-button--compact {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.rmfw-retailer-button:hover {
  transform: scale(1.03);
}

/* Button style modifiers – hover */
.rmfw-retailer-button--outline:hover,
.rmfw-retailer-button--ghost:hover {
  filter: brightness(0.97);
}
.rmfw-retailer-button--minimal:hover {
  opacity: 0.9;
}

/* Viewports under 576px — list card matches mobile mockup (address wraps under pin, stacked CTAs). */
@media (max-width: 575px) {
  .rmfw-card-list__top .rmfw-retailer-pricing--layout-top {
    display: none;
  }

  .rmfw-card-list__meta .rmfw-retailer-pricing--layout-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex: 0 0 auto;
    text-align: right;
    margin-top: 0;
  }

  .rmfw-card-list__meta
    .rmfw-retailer-pricing--layout-meta
    .rmfw-retailer-price {
    margin-top: 0;
  }

  .rmfw-card-list {
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  }

  .rmfw-card-list--compact {
    padding: 0.875rem;
  }

  .rmfw-card-list .rmfw-retailer-address {
    display: flow-root;
    align-items: unset;
    gap: 0;
  }

  .rmfw-card-list .rmfw-retailer-address > svg {
    float: left;
    margin-right: 0.375rem;
    margin-top: 0.12em;
  }

  .rmfw-card-list .rmfw-retailer-address__text {
    flex: none;
    min-width: 0;
    display: block;
  }

  .rmfw-card-list__meta {
    width: 100%;
  }

  .rmfw-card-list__bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .rmfw-card-list__actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .rmfw-card-list__actions .rmfw-direction-btn,
  .rmfw-card-list__actions .rmfw-retailer-button {
    width: 100%;
    margin-top: 0;
    justify-content: center;
    box-sizing: border-box;
    text-align: center;
  }

  .rmfw-card-list__actions .rmfw-direction-btn {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  .rmfw-card-list__actions .rmfw-retailer-button {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
}
