/* Build Your PC, redesigned page (action/build_v2.php). Same visual language as cart_v2 / checkout_v2. */

/* The old page's mobile "Build Information" bar: this page has its own bottom bar. Two rules, so a browser without
   :has() still reads the class one (set by build_v2.js). */
body.byp2-page #buildBtn { display: none !important; }
body:has(.byp2) #buildBtn { display: none !important; }
html.byp2-noscroll { overflow: hidden; }

.byp2 {
  --byp2-red: var(--ronixa-theme-primary-color, #ff0606);
  --byp2-green: #1a8754;
  --byp2-line: #e3e6ea;
  --byp2-soft: #f0f1f3;
  --byp2-text: #1f2430;
  --byp2-muted: #6b7280;
  --byp2-bg: #f4f5f7;
  --byp2-top: 68px; /* the storefront header is fixed at 52px once scrolled (desktop) */
  background: var(--byp2-bg);
  color: var(--byp2-text);
  padding: 16px 0 48px;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.byp2 *, .byp2 *::before, .byp2 *::after { box-sizing: border-box; }
.byp2 [hidden] { display: none !important; }
.byp2 :focus { outline: none; }
.byp2 :focus-visible { outline: 2px solid var(--byp2-red); outline-offset: 2px; }
.byp2 h1, .byp2 h2, .byp2 h3, .byp2 h4 { color: var(--byp2-text); text-transform: none; letter-spacing: 0; font-family: inherit; }
.byp2 p { margin: 0; }
.byp2 button, .byp2 input, .byp2 select { font: inherit; text-transform: none; letter-spacing: 0; }
.byp2 img { max-width: 100%; }
.byp2-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.byp2-ico { flex: none; vertical-align: -3px; }

.byp2-wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.byp2-crumbs { font-size: .82rem; color: var(--byp2-muted); margin-bottom: 6px; }
.byp2-crumbs a { color: var(--byp2-muted); text-decoration: none; }
.byp2-crumbs a:hover { color: var(--byp2-text); text-decoration: underline; }

.byp2-head { margin-bottom: 18px; }
.byp2-head h1 { font-size: 1.6rem; font-weight: 700; margin: 0 0 4px; }
.byp2-head p { color: #4b5563; }
.byp2-alt { display: inline-block; margin-top: 4px; font-size: .9rem; color: var(--byp2-text); text-decoration: underline; text-underline-offset: 2px; }
.byp2-alt:hover { color: var(--byp2-red); }

.byp2-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
/* The title and the parts sit together in one white card, beside the summary card (as on the account pages) */
.byp2-left { min-width: 0; padding: 22px 22px 24px; background: #fff; border: 1px solid var(--byp2-line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.byp2-left .byp2-group-body { box-shadow: none; }
.byp2-parts { min-width: 0; }

.byp2-card { background: #fff; border: 1px solid var(--byp2-line); border-radius: 14px; padding: 20px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }

/* ---------- buttons ---------- */
.byp2-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border: 1.5px solid transparent; border-radius: 12px; background: #fff; color: var(--byp2-text); font-weight: 700; font-size: .95rem; line-height: 1.3; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.byp2-btn-primary { background: var(--byp2-red); color: #fff; }
.byp2-btn-primary:hover:not(:disabled) { filter: brightness(.92); }
.byp2-btn-primary.is-confirm { background: var(--byp2-green); box-shadow: 0 0 0 4px rgba(26, 135, 84, .22); animation: byp2-nudge .45s ease 1; }
@keyframes byp2-nudge { 0% { transform: scale(1); } 40% { transform: scale(1.045); } 100% { transform: scale(1); } }
.byp2-confirm-note { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--byp2-green); }
.byp2-btn-outline { background: #fff; border-color: #d3d7dd; }
.byp2-btn-outline:hover:not(:disabled) { border-color: var(--byp2-text); }
.byp2-btn-ghost { background: var(--byp2-bg); }
.byp2-btn-ghost:hover:not(:disabled) { background: #e9ebef; }
.byp2-btn-danger-soft { background: #fff5f5; border-color: #f3c2c2; color: #b42318; }
.byp2-btn-danger-soft:hover:not(:disabled) { background: #ffe9e9; }
.byp2-btn-sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; border-radius: 10px; }
.byp2-btn-block { display: flex; width: 100%; margin-top: 10px; }
.byp2-btn:disabled { cursor: not-allowed; opacity: .55; }
.byp2-btn-primary:disabled { background: #d9dce1; color: #6b7280; opacity: 1; filter: none; }
.byp2-btn[aria-busy="true"] { cursor: progress; opacity: .7; }

.byp2-link { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 2px; border: 0; background: none; color: var(--byp2-text); font-weight: 600; font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #c5cad3; cursor: pointer; }
.byp2-link:hover:not(:disabled) { text-decoration-color: currentColor; }
.byp2-link-muted { color: var(--byp2-muted); }
.byp2-link-muted:hover:not(:disabled) { color: var(--byp2-red); }
.byp2-link:disabled { opacity: .5; cursor: progress; }

/* ---------- groups and category rows ---------- */
/* The storefront gives <body> overflow-x: hidden, which makes it the scroll box for position: sticky although the
   page itself scrolls, so the summary never stuck. clip hides the same overflow without that side effect. */
body.byp2-page { overflow-x: clip !important; overflow-y: visible !important; }
.byp2-group + .byp2-group { margin-top: 22px; }
.byp2-group-head { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; }
.byp2-group-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.byp2-optional { padding: 2px 8px; border-radius: 999px; background: #e9ebef; color: #4b5563; font-size: .75rem; font-weight: 600; }
.byp2-group-toggle { margin-left: auto; }
.byp2-extras-hint { display: block; margin-top: 8px; text-align: left; font-size: 13px; }
.byp2-group-optional { scroll-margin-top: 76px; }
.byp2-group-body { background: #fff; border: 1px solid var(--byp2-line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); overflow: hidden; }

.byp2-cat { padding: 14px 18px; border-top: 1px solid var(--byp2-soft); scroll-margin-top: calc(var(--byp2-top) + 8px); }
.byp2-cat:first-child { border-top: 0; }
.byp2-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.byp2-cat-name { font-size: 1rem; font-weight: 600; margin: 0; }
.byp2-cat.is-chosen .byp2-cat-head { min-height: 0; margin-bottom: 8px; }
.byp2-cat.is-chosen .byp2-cat-name { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--byp2-muted); }
.byp2-choose { min-width: 104px; }
.byp2-cat-foot { margin-top: 6px; }
.byp2-flash { animation: byp2-flash 1.6s ease-out; }
@keyframes byp2-flash { 0%, 30% { background: #fff6dd; } 100% { background: #fff; } }

.byp2-item { display: flex; gap: 14px; padding: 6px 0; }
.byp2-item + .byp2-item { border-top: 1px dashed var(--byp2-line); padding-top: 12px; margin-top: 6px; }
.byp2-thumb { flex: none; width: 72px; height: 72px; border: 1px solid var(--byp2-line); border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.byp2-thumb img { width: 100%; height: 100%; object-fit: contain; }
.byp2-item-main { flex: 1; min-width: 0; display: flex; gap: 16px; }
.byp2-item-info { flex: 1; min-width: 0; }
.byp2-item-name { color: var(--byp2-text); font-weight: 600; line-height: 1.35; text-decoration: none; }
.byp2-item-name:hover { color: var(--byp2-red); text-decoration: underline; }
.byp2-item-meta { color: var(--byp2-muted); font-size: .84rem; margin-top: 2px; }
.byp2-item-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.byp2-item-ctl { display: flex; align-items: center; gap: 14px; }
.byp2-line-total { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.byp2-item-actions { display: flex; align-items: center; gap: 14px; }
.byp2-confirm { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.byp2-confirm-q { font-size: .88rem; font-weight: 600; }

.byp2-badge { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.byp2-badge-oos { border: 1px solid #f1d58a; background: #fff8e6; color: #7a5200; }

.byp2-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--byp2-line); border-radius: 10px; overflow: hidden; background: #fff; }
.byp2-step { width: 36px; height: 36px; border: 0; background: #fff; color: var(--byp2-text); padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.byp2-step:hover:not(:disabled) { background: var(--byp2-bg); }
.byp2-step:disabled { color: #c5cad3; cursor: default; }
.byp2-stepper input { width: 42px; height: 36px; border: 0; border-left: 1.5px solid var(--byp2-line); border-right: 1.5px solid var(--byp2-line); border-radius: 0; text-align: center; font-weight: 600; padding: 0; background: #fff; color: var(--byp2-text); -moz-appearance: textfield; appearance: textfield; }
.byp2-stepper input::-webkit-outer-spin-button, .byp2-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- alerts ---------- */
.byp2-alert { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 12px; border: 1px solid #f3c2c2; border-radius: 10px; background: #fff5f5; color: #7a1f1f; font-size: .86rem; }
.byp2-alert .byp2-ico { margin-top: 2px; color: #c62828; }
.byp2-alert-success { border-color: #b9e2c6; background: #f0f9f3; color: #14532d; }
.byp2-alert-success .byp2-ico { color: #1f9d55; }
.byp2-note { margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-size: .86rem; }
.byp2-note-warn { border: 1px solid #f1d58a; background: #fff8e6; color: #4a3c10; }
.byp2-load-error { text-align: center; }
.byp2-load-error p { margin-bottom: 12px; }

/* ---------- picker ---------- */
.byp2-picker { margin: 12px -18px -14px; padding: 16px 18px 18px; border-top: 1px solid var(--byp2-line); background: #fafbfc; scroll-margin-top: calc(var(--byp2-top) + 8px); }
/* The list's own heading is for screen readers only: the row above already names the part, and its button closes the list */
.byp2-pk-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.byp2-pk-close { display: none; }
.byp2-pk-title { font-size: .98rem; font-weight: 700; margin: 0; }
.byp2-pk-title:focus, .byp2-cat:focus { outline: none; } /* focus targets for screen readers, not controls */
.byp2-fit { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px !important; color: #14532d; font-size: .88rem; }
.byp2-fit .byp2-ico { color: var(--byp2-green); margin-top: 2px; }
.byp2-controls { display: grid; grid-template-columns: minmax(160px, 2fr) repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.byp2-input, .byp2-select { width: 100%; min-height: 40px; padding: 7px 10px; border: 1.5px solid var(--byp2-line); border-radius: 10px; background-color: #fff; color: var(--byp2-text); font-size: .9rem; }
.byp2-select { padding-right: 28px; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; text-overflow: ellipsis; }
.byp2-input:focus, .byp2-select:focus { border-color: #9aa1ac; }

.byp2-plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 14px; transition: opacity .15s; }
.byp2-plist.is-loading { opacity: .5; pointer-events: none; }
.byp2-pcard { display: flex; flex-direction: column; min-width: 0; padding: 12px; border: 1px solid var(--byp2-line); border-radius: 12px; background: #fff; }
.byp2-pcard:hover { border-color: #c9ced6; }
.byp2-pimg { height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.byp2-pimg img { width: 120px; height: 120px; object-fit: contain; }
.byp2-pbody { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.byp2-pname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; color: var(--byp2-text); font-weight: 600; font-size: .92rem; line-height: 1.35; text-decoration: none; }
.byp2-pname:hover { color: var(--byp2-red); text-decoration: underline; }
.byp2-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.byp2-chip { max-width: 100%; padding: 2px 8px; border-radius: 6px; background: var(--byp2-bg); color: #4b5563; font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.byp2-pfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.byp2-pprice { display: flex; flex-direction: column; line-height: 1.2; }
.byp2-pnow { font-weight: 700; font-size: 1.02rem; }
.byp2-pmrp { color: var(--byp2-muted); font-size: .8rem; }
.byp2-add { min-width: 84px; }
.byp2-pcard-skel { min-height: 268px; background: linear-gradient(90deg, #f3f4f6 25%, #eceef1 50%, #f3f4f6 75%) 0 0 / 200% 100%; border-color: var(--byp2-soft); animation: byp2-shimmer 1.2s linear infinite; }
.byp2-empty { margin-top: 14px; padding: 18px; border: 1px dashed #d3d7dd; border-radius: 12px; text-align: center; color: #4b5563; }
.byp2-empty p { margin-bottom: 10px; }
.byp2-more-wrap { text-align: center; }
.byp2-pk-more { margin-top: 14px; min-width: 160px; }

/* ---------- skeleton ---------- */
.byp2-skel-h { width: 140px; height: 20px; margin: 4px 0 10px; border-radius: 6px; background: #e6e8ec; }
.byp2-skel-h + .byp2-skel-row { border-radius: 14px 14px 0 0; }
.byp2-skel-row { height: 73px; border: 1px solid var(--byp2-line); border-top: 0; background: linear-gradient(90deg, #fff 25%, #f5f6f8 50%, #fff 75%) 0 0 / 200% 100%; animation: byp2-shimmer 1.2s linear infinite; }
.byp2-skel-h + .byp2-skel-row { border-top: 1px solid var(--byp2-line); }
.byp2-skel-row + .byp2-skel-h { margin-top: 22px; }
@keyframes byp2-shimmer { to { background-position: -200% 0; } }

/* ---------- summary ---------- */
.byp2-summary { position: sticky; top: var(--byp2-top); }
.byp2-sum-head { display: flex; align-items: center; justify-content: space-between; }
.byp2-sum-head h2 { font-size: 1.1rem; font-weight: 700; margin: 0 0 8px; }
.byp2-sheet-close { display: none; }
.byp2-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.byp2-label { color: var(--byp2-muted); font-size: .9rem; }
.byp2-total { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.byp2-meta { color: var(--byp2-muted); font-size: .86rem; text-align: right; }
.byp2-progress { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--byp2-soft); }
.byp2-progress-text { font-weight: 600; font-size: .92rem; }
.byp2-bar-track { height: 6px; margin-top: 8px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.byp2-bar-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--byp2-green); transition: width .3s ease; }
.byp2-missing { margin-top: 6px !important; color: var(--byp2-muted); font-size: .82rem; }
.byp2-compat { display: flex; align-items: flex-start; gap: 6px; margin: 12px 0 4px !important; color: #4b5563; font-size: .84rem; }
.byp2-compat .byp2-ico { color: var(--byp2-green); margin-top: 1px; }
.byp2-summary .byp2-btn-primary { min-height: 52px; font-size: 1.05rem; margin-top: 14px; }

.byp2-saved { margin-top: 12px; padding: 12px; border: 1px solid #b9e2c6; border-radius: 10px; background: #f0f9f3; }
.byp2-saved-title { display: flex; align-items: center; gap: 6px; color: #14532d; font-weight: 700; font-size: .92rem; }
.byp2-saved-title .byp2-ico { color: #1f9d55; }
.byp2-saved-row { display: flex; gap: 8px; margin-top: 8px; }
.byp2-saved-row input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid #b9e2c6; border-radius: 8px; background: #fff; color: var(--byp2-text); font-size: .84rem; }

.byp2-share .byp2-btn { justify-content: space-between; }
.byp2-caret { transition: transform .15s; }
#byp2-share-btn[aria-expanded="true"] .byp2-caret { transform: rotate(180deg); }
.byp2-share-menu { margin: 6px 0 0; padding: 4px; list-style: none; border: 1px solid var(--byp2-line); border-radius: 12px; background: #fff; }
.byp2-share-menu button { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 8px; background: none; color: var(--byp2-text); font-size: .92rem; text-align: left; cursor: pointer; }
.byp2-share-menu button:hover { background: var(--byp2-bg); }

.byp2-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0 0; font-size: .9rem; color: #4b5563; cursor: pointer; }
.byp2-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--byp2-text); }

.byp2-dock, .byp2-backdrop { display: none; }

/* ---------- below 992px: one column, bottom bar, summary as a bottom sheet ---------- */
@media (max-width: 991.98px) {
  .byp2 { --byp2-top: 58px; padding-bottom: calc(var(--byp2-dock-offset, 0px) + 96px); }
  .byp2-grid { grid-template-columns: minmax(0, 1fr); }

  .byp2-dock { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: var(--byp2-dock-offset, 0px); z-index: 360; padding: 10px 16px max(10px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--byp2-line); box-shadow: 0 -4px 16px rgba(16, 24, 40, .08); }
  .byp2-dock-info { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--byp2-text); text-align: left; cursor: pointer; }
  .byp2-dock-total { font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
  .byp2-dock-meta { display: inline-flex; align-items: center; gap: 4px; color: var(--byp2-muted); font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; }
  .byp2-dock .byp2-btn { flex: none; min-height: 48px; padding: 10px 20px; }

  .byp2-backdrop { display: block; position: fixed; inset: 0; z-index: 1044; background: rgba(15, 15, 25, .45); }
  .byp2-summary { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1045; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain; transform: translateY(100%); visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  .byp2-sheet-open .byp2-summary { transform: none; visibility: visible; transition: transform .25s ease; }
  .byp2-summary .byp2-card { border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .byp2-sheet-close { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -10px 0 0; border: 0; border-radius: 10px; background: none; color: var(--byp2-muted); cursor: pointer; }
  .byp2-sheet-close:hover { background: var(--byp2-bg); }
}

@media (max-width: 767.98px) {
  .byp2-left { padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; } /* phones: no outer card, the rows keep the full width */
  .byp2 { padding-top: 10px; font-size: 14.5px; }
  .byp2-head h1 { font-size: 1.35rem; }
  .byp2-wrap { padding: 0 12px; }
  .byp2-cat { padding: 12px 14px; }
  .byp2-picker { margin: 12px -14px -12px; padding: 14px; }
  .byp2-item-main { flex-direction: column; gap: 8px; }
  .byp2-item-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
  .byp2-controls { grid-template-columns: 1fr 1fr; }
  .byp2-pk-search { grid-column: 1 / -1; }
  .byp2-link, .byp2-btn-sm, .byp2-step, .byp2-input, .byp2-select, .byp2-share-menu button { min-height: 44px; }
  .byp2-step { width: 44px; height: 44px; }
  .byp2-stepper input { height: 44px; }
  .byp2-link { padding: 4px 6px; }
}

/* Phones: product cards become horizontal rows */
@media (max-width: 575.98px) {
  .byp2-plist { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .byp2-pcard { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 10px; }
  .byp2-pimg { height: 88px; margin: 0; }
  .byp2-pimg img { width: 88px; height: 88px; }
  .byp2-pname { min-height: 0; }
  .byp2-pcard-skel { min-height: 150px; }
  .byp2-thumb { width: 60px; height: 60px; }
  .byp2-item { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .byp2 *, .byp2 *::before, .byp2 *::after { animation: none !important; transition: none !important; }
  .byp2-flash { background: #fff6dd; }
}
