/* Cart stock guard: the sold-out / low-stock dialog and cart highlights.
   Built on the existing .modal shell so the animation and scrim match the site. */

.stock-modal .modal__card {
  width: min(620px, 94vw);
  padding: 28px 28px 24px;
}

/* The analytics consent banner sits at 1200; the stock dialog must stay above
   it so the cart cannot be blocked by an unrelated prompt. */
.stock-modal { z-index: 1300; }

/* Some storefront rules reposition .modal__close; keep this dialog's close
   control pinned to the top-right corner. */
.stock-modal .modal__close { position: absolute; top: 14px; right: 14px; left: auto; }

.stock-modal__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(192, 57, 43, 0.1);
  color: #b23b2e;
  margin-bottom: 14px;
}

.stock-modal__icon svg { width: 24px; height: 24px; }

.stock-modal h2 {
  margin: 0 0 8px;
  font-family: var(--font-display, 'Sora', 'Inter', sans-serif);
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.25;
  color: var(--ink, #0d1b2a);
}

.stock-modal__lead {
  margin: 0 0 16px;
  color: var(--muted, #5b6b7f);
  font-size: 14px;
  line-height: 1.55;
}

.stock-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(46vh, 420px);
  overflow: auto;
  padding: 2px;
  margin: 0 0 14px;
  list-style: none;
}

.stock-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(13, 71, 161, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.stock-item__img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(13, 71, 161, 0.08);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.stock-item__img img { width: 100%; height: 100%; object-fit: contain; }

.stock-item__body { min-width: 0; }

.stock-item__name {
  display: block;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--ink, #0d1b2a);
  overflow-wrap: anywhere;
}

.stock-item__meta {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted, #5b6b7f);
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stock-badge--out { color: #8f2a1f; background: rgba(192, 57, 43, 0.12); }
.stock-badge--partial { color: #8a5600; background: rgba(214, 137, 16, 0.16); }

.stock-modal__note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(13, 71, 161, 0.06);
  color: var(--muted, #5b6b7f);
  font-size: 12.5px;
  line-height: 1.5;
}

.stock-modal__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.stock-modal__actions .btn { min-height: 44px; }
.stock-modal__actions .btn-primary { flex: 1 1 240px; }
.stock-modal__actions .btn-ghost { flex: 0 1 auto; }

/* Cart page banner + affected line styling */
.stock-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(192, 57, 43, 0.22);
  border-radius: 12px;
  background: rgba(192, 57, 43, 0.06);
}
.stock-banner[hidden] { display: none; }
.stock-banner b { display: block; font-size: 13px; color: #8f2a1f; }
.stock-banner span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted, #5b6b7f); }
.stock-banner .btn { flex: 0 0 auto; white-space: nowrap; }

.cart-line--flagged {
  border-color: rgba(192, 57, 43, 0.35) !important;
  background: rgba(192, 57, 43, 0.04);
}

.cart-line__warn {
  display: inline-flex;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: #b23b2e;
}

.cart-line__warn--partial { color: #9a6200; }

body.stock-modal-open { overflow: hidden; }

@media (max-width: 560px) {
  .stock-modal .modal__card { padding: 22px 18px 18px; width: 96vw; }
  .stock-item { grid-template-columns: 44px minmax(0, 1fr); }
  .stock-item__img { width: 44px; height: 44px; }
  .stock-item .stock-badge { grid-column: 2; justify-self: start; margin-top: 2px; }
  .stock-list { max-height: 42vh; }
  .stock-modal__actions { flex-direction: column-reverse; align-items: stretch; }
  .stock-modal__actions .btn { flex: 0 0 auto; width: 100%; min-height: 46px; }
  .stock-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stock-banner .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .stock-modal .modal__card { transition: none; transform: none; }
  .stock-modal .modal__scrim { transition: none; }
}
