/* ──────────────────────────────────────────────────────────────────────────
 * Right panel ("rp") — Pawfectly Yours
 *
 * Vertically scrollable container with:
 *   - Shirt Options card (top)
 *   - Tab nav + active tab panel (middle, fills available space)
 *   - Sticky Add-to-Cart bar (bottom)
 * ────────────────────────────────────────────────────────────────────────── */

.rp {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: transparent;
  border-left: none;
  overflow: hidden;
}

.rp__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-pink-soft) transparent;
}

/* Direct children of .rp__scroll must NOT shrink.
 *
 * Without this, every section in the scroll column (Shirt Options card,
 * the .rp__tools tab card, .rp__layers) is a flex item with the default
 * `flex-shrink: 1` plus `min-height: auto`. When the total intrinsic
 * height of those sections exceeds .rp__scroll's available height, flex
 * layout tries to SHRINK them proportionally to fit — rather than
 * leaving them at natural size and letting the container scroll. That
 * collides badly with .rp__tools having its own `overflow: hidden`:
 * once .rp__tools is forced shorter than its intrinsic content, the
 * bottom of the active tab (e.g. the Text tab's "Add text to canvas"
 * submit button) gets clipped by the card's own overflow, even though
 * .rp__scroll would happily provide a scrollbar if asked.
 *
 * Setting `flex-shrink: 0` keeps each section at its natural height.
 * The combined column then legitimately overflows .rp__scroll, the
 * container's `overflow-y: auto` kicks in, and the user scrolls to
 * reach the bottom of the tab card. This invariant only became
 * visible after Change 13 in [[Refinements_2026-05-20_Part2]] gave
 * .rp__scroll a definite height for the first time — before that,
 * the chain was all min-height and the scroll container just expanded
 * to fit. */
.rp__scroll > * {
  flex-shrink: 0;
}

.rp__scroll::-webkit-scrollbar { width: 8px; }
.rp__scroll::-webkit-scrollbar-track { background: transparent; }
.rp__scroll::-webkit-scrollbar-thumb {
  background: var(--brand-pink-soft);
  border-radius: 999px;
}

.rp__tools {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Layers card — sibling of .rp__tools, sits below it inside .rp__scroll.
 * Same card chrome (white bg, rounded, hairline border, soft shadow) so
 * the two surfaces read as a stacked pair. Padding matches the
 * .rp__tabpanel inset so the LayersPanel's titlebar lines up with the
 * tab panel content visually. The LayersPanel itself handles its own
 * empty state and titlebar, so this section just provides the frame. */
.rp__layers {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem 1.2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Tabs --------------------------------------------------------------------- */

.rp__tabs {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-x: auto;
  scrollbar-width: none;
}

.rp__tabs::-webkit-scrollbar { display: none; }

.rp__tab {
  flex: 1 1 auto;
  min-width: 84px;
  padding: 0.85rem 0.4rem 0.7rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  border-bottom: 2.5px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.rp__tab svg {
  color: var(--text-muted);
  transition: color 0.12s ease;
}

.rp__tab:hover {
  color: var(--brand-pink-strong);
  background: rgba(236, 72, 153, 0.04);
}

.rp__tab:hover svg {
  color: var(--brand-pink-strong);
}

.rp__tab.is-active {
  color: var(--brand-pink);
  border-bottom-color: var(--brand-pink);
  background: #fff;
}

.rp__tab.is-active svg {
  color: var(--brand-pink);
}

.rp__tabpanel {
  padding: 1rem 1.1rem 1.2rem;
}

/* Sticky cart bar ---------------------------------------------------------- */

.rp__cart-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.rp__add-to-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.95rem 1.4rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--brand-pink);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  box-shadow: 0 8px 16px -4px rgba(236, 72, 153, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.rp__add-to-cart:hover {
  background: var(--brand-pink-strong);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -6px rgba(236, 72, 153, 0.6);
}

.rp__add-to-cart:active {
  transform: translateY(1px);
}

/* Disabled state — paired with bounds-violation warning. The button is
 * dimmed, not-allowed cursor, and the colored shadow drops away so it
 * stops looking like a primary CTA. The :hover and :active rules above
 * are overridden so the user gets no visual response that suggests
 * clicking it would do something. */
.rp__add-to-cart:disabled,
.rp__add-to-cart.is-disabled {
  background: #e5e7eb;
  color: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: auto; /* keep the title tooltip working on hover */
}

.rp__add-to-cart:disabled:hover,
.rp__add-to-cart.is-disabled:hover {
  background: #e5e7eb;
  transform: none;
  box-shadow: none;
}

.rp__add-to-cart:disabled:active,
.rp__add-to-cart.is-disabled:active {
  transform: none;
}

/* Reason caption shown above the disabled button. */
.rp__cart-reason {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 235, 0.95);
  border: 1px solid #fbbf24;
  color: #92400e;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.rp__add-to-cart-price {
  font-weight: 800;
  margin-left: 0.5rem;
  letter-spacing: 0;
}

@media (max-width: 480px) {
  .rp__scroll { padding: 0.6rem; gap: 0.6rem; }
  .rp__tabpanel { padding: 0.85rem 0.85rem 1rem; }
  .rp__layers { padding: 0.85rem 0.85rem 1rem; }
  .rp__tab { min-width: 76px; font-size: 11.5px; }
  .rp__tab svg { width: 16px; height: 16px; }
}
