select.custom-field-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.custom-field-group .component-card {
  border: 1px solid #e7e9ee;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.custom-field-group .component-card.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.custom-field-group .component-option-img img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

#pc-builder-custom-field-table .table {
  margin-bottom: 16px;
}

#pc-builder-custom-field-table .builder-thumb {
  max-width: 64px;
  height: auto;
  border-radius: 6px;
}

.compatibility-message {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 13px;
}

#compatibility-summary.alert {
  border-radius: 12px;
}

#pc-builder-footer {
  position: static;
  bottom: 0;
  z-index: 50;
  background: #fff;
  border-top: 1px solid #e7e9ee;
  padding: 12px 16px;
}

.selection-cell-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

@media (max-width: 768px) {
  #pc-builder-footer .btn {
    width: 100%;
    margin-top: 8px;
  }
}

@media print {
  #pc-builder-footer,
  #button-save-build,
  #button-capture,
  #button-print,
  #button-review {
    display: none !important;
  }

  .custom-field-group .component-card,
  .custom-field-group .component-card.selected {
    break-inside: avoid;
  }
}

.table.table-fixed thead th {
  vertical-align: middle;
}

.table.table-fixed .thumb-container {
  width: 96px !important;
}

.table.table-fixed .price-container {
  width: 120px !important;
  text-align: right;
}

.table.table-fixed tbody td img[id^="custom-field-image"] {
  max-width: 120px;
  max-height: 120px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.pcb-fixedbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.pcb-fixedbar.hidden {
  display: none;
}

.pcb-fixedbar .pcb-fixedbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.pcb-fixedbar .pcb-total {
  font-size: 16px;
}

.pcb-fixedbar .pcb-total .pcb-total-label {
  opacity: 0.75;
  margin-right: 6px;
}

#pc-builder-container .form-group {
  margin-bottom: 12px;
}

#pc-builder-container .control-label {
  padding-top: 8px;
}

#pc-builder-custom-field-table .table-fixed thead th.component-col {
  width: 16%;
  white-space: nowrap;
}

#pc-builder-custom-field-table .table-fixed thead th.thumb-col {
  width: 96px;
}

#pc-builder-custom-field-table .table-fixed thead th.selection-col {
  width: auto;
}

#pc-builder-custom-field-table .table-fixed thead th.price-col {
  width: 120px;
  text-align: right;
}

#pc-builder-custom-field-table .component-col-td {
  width: 16%;
  vertical-align: middle;
}

#pc-builder-custom-field-table .thumb-col-td {
  width: 96px;
  vertical-align: middle;
  overflow: hidden;
}

#pc-builder-custom-field-table .selection-col-td {
  width: auto;
}

#pc-builder-custom-field-table .price-col-td {
  width: 120px;
  text-align: right;
  vertical-align: middle;
}

#pc-builder-custom-field-table .thumb-col-td img {
  max-width: 92px;
  width: 92px;
  height: auto;
  display: inline-block;
  border-radius: 6px;
}

.component-option-img img.pcb-zoom {
  max-width: 140px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

@media (hover: hover) and (pointer: fine) {
  img.pcb-zoom {
    transition: transform 0.2s ease;
    will-change: transform;
  }

  .thumb-col-td img.pcb-zoom:hover,
  .component-option-img img.pcb-zoom:hover {
    transform: scale(1.15);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pcb-zoom {
    transition: none !important;
  }
}

#form-pc-builder .label.label-success {
  background-color: var(--brand-success, #5cb85c);
}

#form-pc-builder .label.label-danger {
  background-color: var(--brand-danger, #d9534f);
}

#form-pc-builder .panel.panel-default {
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#pc-builder-custom-field-table table.table > tbody > tr > td {
  padding-top: 10px;
  padding-bottom: 10px;
}

#pc-builder-custom-field-table table.table > thead > tr > th {
  padding-top: 12px;
  padding-bottom: 12px;
  vertical-align: middle;
}

.pc-builder-header.panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pc-builder-header .pull-left,
.pc-builder-header .pull-right {
  float: none !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pc-builder-header .label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  margin-right: 6px;
  font-size: 13px;
}

@media (max-width: 575.98px) {
  .pc-builder-header .pull-right {
    width: 100%;
  }

  .pc-builder-header #button-review {
    width: 100%;
    height: 44px;
    font-weight: 600;
    border-radius: 10px;
  }

  .pc-builder-header #button-save-build,
  .pc-builder-header #button-capture,
  .pc-builder-header #button-print {
    width: 100%;
    height: 44px;
    font-weight: 600;
    border-radius: 10px;
  }

  .pc-builder-header #button-save-build {
    margin-bottom: 8px;
  }

  .pc-builder-header #button-capture {
    margin-bottom: 8px;
  }
}
/* Modal */
/* ============================================================
   Product Modal – Bootstrap 3.4.1 – Mobile-safe (Samsung Internet)
   - Removes conflicting/duplicated mobile rules
   - Avoids 100vh issues using 100dvh when supported
   - Ensures only modal-body scrolls vertically
   - Keeps horizontal scroll ONLY in intended areas
   ============================================================ */

/* Modal & backdrop layering (BS3 default: modal 1050 / backdrop 1040) */
#productModal.modal {
  z-index: 20000;
  overflow: hidden;
}
.modal-backdrop {
  z-index: 19990;
  background-color: rgba(255, 255, 255, 0.75) !important;
}
.modal-backdrop.in {
  opacity: 1 !important;
}

/* ----- Desktop / Tablet modal sizing ----- */
#productModal .modal-dialog {
  width: 70vw;
  height: 70vh;
  max-width: 95vw;
  max-height: 95vh;

  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  margin: 0;

  display: flex;
  flex-direction: column;

  /* Keep container predictable */
  overflow: hidden;
}

#productModal .modal-content {
  display: flex;
  flex-direction: column;

  height: 100%;
  max-height: 100%;
  min-height: 0;

  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);

  overflow: hidden;
}

/* Keep header accessible (mobile sticky added below) */
#productModal .modal-header {
  top: 0;
}

/* ONE vertical scroller */
#productModal .modal-body {
  flex: 1 1 auto;
  min-height: 0;

  overflow-y: auto;
  overflow-x: hidden;

  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 12px;
}

/* BS3 uses body.modal-open to lock scrolling */
body.modal-open {
  overflow: hidden;
}

/* ----- Horizontal scroll helpers ----- */
.pcb-x-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}
.pcb-x-scroll::-webkit-scrollbar {
  height: 6px;
}

#productModal .tab-content,
#productModal .tab-pane {
  max-width: 100%;
}

/* Horizontal scrolling zones for wide content/tables */
#productModal #tab-description,
#productModal #tab-specification,
#productModal #productModalDescription,
#productModal #productModalSpecification {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* Table becomes a block to allow horizontal scrolling */
#productModal .tab-pane table,
#productModal #productModalDescription table,
#productModal #productModalSpecification table {
  display: block;
  width: max-content;
  max-width: none;
}

#productModal .tab-pane img {
  max-width: 100%;
  height: auto;
}

/* ----- Footer alignment (BS3 footer defaults to text-align:right) ----- */
#productModal .modal-footer {
  background: #fff;
  z-index: 1;

  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;

  text-align: initial !important;
}

/* Your BS3 close button: push it to the left */
#productModal .modal-footer .btn-close,
#productModal .modal-footer .btn[data-dismiss="modal"] {
  margin-right: auto;
}

/* ============================================================
   Mobile (phones)
   - Fullscreen fixed modal
   - Uses 100dvh to avoid Samsung Internet picker “Done” clipping
   ============================================================ */
@media (max-width: 767px) {
  #productModal.modal .modal-dialog {
    position: fixed;
    inset: 0;

    width: 100vw !important;

    /* Fallback */
    height: 100vh !important;
    max-height: 100vh !important;

    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;

    overflow: hidden;
  }

  /* Prefer dynamic viewport height when supported */
  @supports (height: 100dvh) {
    #productModal.modal .modal-dialog.pcb-modal-dialog {
      height: 100dvh !important;
      max-height: 100dvh !important;
    }
  }

  #productModal.modal .modal-content {
    height: 100%;
    border-radius: 0;
    overflow: hidden;

    /* Safe area padding (helps some devices/browsers) */
    padding-bottom: env(safe-area-inset-bottom);
  }

  #productModal .modal-body {
    max-width: 100vw;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  /* Keep header reachable */
  #productModal .modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #fff;
  }
}


/* Intent cards */
#pc-intent-panel .intent-cards {
  margin-top: 12px;
  margin-left: 0;
  margin-right: 0;
}
#pc-intent-panel .intent-card {
  width: 100%;
  text-align: left;
  border: 1px solid #cfe8f3;
  border-radius: 16px;
  padding: 14px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
  min-height: 84px;
  white-space: normal;
  background: #f7fbfd;
  color: #0b5b77;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 10px rgba(15, 118, 150, 0.08);
  height: 100%;
}
#pc-intent-panel .intent-card .intent-icon {
  font-size: 20px;
  margin-bottom: 0;
  color: #0b7a9f;
  background: #e6f5fb;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#pc-intent-panel .intent-card .intent-title {
  font-weight: 700;
  font-size: 15px;
  color: #0b5b77;
}
#pc-intent-panel .intent-card .intent-copy {
  display: block;
  font-size: 12.5px;
  color: #3b6678;
  margin-top: 2px;
}
#pc-intent-panel .intent-card .intent-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#pc-intent-panel .intent-card.active,
#pc-intent-panel .intent-card:focus,
#pc-intent-panel .intent-card:hover {
  border-color: #0b7a9f;
  box-shadow: 0 10px 20px rgba(15, 118, 150, 0.2);
  background: #eaf7fd;
  transform: translateY(-1px);
}
#pc-intent-panel .intent-card.active {
  background: linear-gradient(135deg, #0b7a9f, #0a5f7a);
  border-color: #085a74;
  color: #fff;
}
#pc-intent-panel .intent-card.active .intent-title,
#pc-intent-panel .intent-card.active .intent-copy {
  color: #fff;
}
#pc-intent-panel .intent-card.active .intent-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Intent budget spacing (desktop) */
#pc-intent-panel .intent-budget-row {
  margin-top: 14px;
}
.intent-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.intent-selected {
  font-weight: 600;
  color: #0b7a9f;
}
.intent-budget-pill {
  vertical-align: middle;
  font-size: 12px;
}
.intent-budget-pill.tier1 { background: #38b000; }
.intent-budget-pill.tier2 { background: #2b9348; }
.intent-budget-pill.tier3 { background: #1d8adb; }
.intent-budget-pill.tier4 { background: #0b6fa4; }
.intent-budget-pill.tier5 { background: #6f42c1; }
.intent-budget-pill.tier6 { background: #8b5cf6; }
.intent-budget-pill.tier7 { background: #b5179e; }
.intent-budget-range {
  width: 100%;
  margin-top: 6px;
}
.intent-budget-scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 2px;
}
.intent-budget-desc {
  margin-top: 4px;
}
.intent-ai-tip {
  font-size: 12px;
  color: #0b7a9f;
  font-weight: 600;
}

/* Select2 option with thumbnail */
.pcb-s2-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pcb-s2-option .pcb-s2-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e1e1e1;
}
.pcb-s2-option .pcb-s2-text {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.pcb-s2-price {
  font-size: 12px;
}

.selection-row-selected {
  background: #f5fbff;
}
.intent-reco, .intent-warn {
  margin-left: 6px;
  font-size: 11px;
}
.intent-warn {
  background-color: #f0ad4e;
  border-color: #eea236;
}
.intent-reco.hidden,
.intent-warn.hidden {
  display: none !important;
}

/* Phase 6: Mobile layout (CSS-only, no DOM changes) */
@media (max-width: 768px) {
  /* Card-like rows */
  #pc-builder-custom-field-table table.table,
  #pc-builder-custom-field-table table.table tbody,
  #pc-builder-custom-field-table table.table tr,
  #pc-builder-custom-field-table table.table td {
    display: block;
    width: 100%;
  }
  #pc-builder-custom-field-table table.table tr {
    background: #fff;
    border: 1px solid #e7e9ee;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
  }
  #pc-builder-custom-field-table table.table td {
    padding: 6px 0 !important;
    border: 0 !important;
  }
  #pc-builder-custom-field-table table.table td:nth-child(1) {
    font-size: 15px;
    font-weight: 600;
  }
  /* Hide thumbs on small screens to reduce clutter */
  #pc-builder-custom-field-table .thumb-col-td {
    display: none;
  }
  /* Selection control full width */
  #pc-builder-custom-field-table select.custom-field-select,
  #pc-builder-custom-field-table .custom-field-autocomplete,
  #pc-builder-custom-field-table .form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    white-space: normal;
  }
  /* Price line */
  td.selected-product-price-container {
    font-size: 13px;
    color: #475569;
    text-align: left !important;
  }
  /* Long names wrap */
  .component-label,
  .selection-col-td,
  .selection-col-td select,
  .selection-col-td option {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

}

/* Required vs Optional clarity */
.pcb-legend {
  margin: 6px 0 12px;
}
.pcb-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.pcb-badge-required {
  background: #fff4e5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.pcb-badge-optional {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}
.selection-row-tools .pcb-status.required {
  color: #9a3412;
}
.selection-row-tools .pcb-status.optional {
  color: #64748b;
}

/* Persona guidance highlights */
tr.pcb-recommended {
  background: #f0f9ff;
  box-shadow: inset 3px 0 0 #0ea5e9;
}
tr.pcb-dim {
  background: #fafafa;
}

/* Row action cleanup */
.selection-row-tools {
  gap: 6px;
  opacity: .75;
  transition: opacity .15s ease;
}
tr:hover .selection-row-tools,
tr:focus-within .selection-row-tools {
  opacity: 1;
}
.selection-row-tools .pcb-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.selection-row-tools .pcb-status.ok {
  background: #ecfdf3;
  color: #166534;
  border-color: #bbf7d0;
}
.selection-row-tools .pcb-status.missing {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}
.selection-row-tools .pcb-clear,
.selection-row-tools .pcb-quickview {
  font-size: 0;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
}
.selection-row-tools .pcb-clear::before {
  content: "×";
  font-size: 14px;
  font-weight: 700;
}
.selection-row-tools .pcb-quickview::before {
  content: "i";
  font-size: 12px;
  font-weight: 700;
}
.selection-row-tools .pcb-clear:focus,
.selection-row-tools .pcb-quickview:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}
@media (max-width: 767px) {
  .selection-row-tools {
    opacity: 1;
  }
}

/* Sticky system summary */
.pcb-sticky-summary {
  position: sticky;
  top: 120px;
  z-index: 200;
  background: rgba(255,255,255,.98);
  border-bottom: 1px solid #e7e9ee;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
}
.pcb-sticky-summary.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.pcb-sticky-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pcb-sticky-price {
  font-weight: 700;
  font-size: 15px;
}
.pcb-sticky-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
}
.pcb-sticky-status.ok {
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.pcb-sticky-status.warn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.pcb-sticky-missing {
  font-size: 12px;
  color: #64748b;
}
.pcb-sticky-cta {
  white-space: nowrap;
}
@media (max-width: 767px) {
  .pcb-sticky-summary {
    padding: 8px 10px;
    top: 96px;
  }
  .pcb-sticky-summary .pcb-sticky-left {
    gap: 6px;
  }
}

/* Persona layout normalization
   Desktop: 4 cards on one line
   Mobile: one card per row, no float/gutter artifacts */
#account-pc-builder #pc-intent-panel .intent-cards {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 12px;
  margin-left: 0;
  margin-right: 0;
}

#account-pc-builder #pc-intent-panel .intent-cards > [class*="col-"] {
  float: none !important;
  flex: 1 1 0 !important;
  width: 0 !important;
  max-width: none !important;
  padding-left: 0;
  padding-right: 0;
  min-width: 0;
}

#account-pc-builder #pc-intent-panel .intent-cards .intent-card {
  width: 100%;
  height: 100%;
  margin: 0;
}

@media (max-width: 767px) {
  #account-pc-builder #pc-intent-panel .intent-cards {
    display: grid !important;
    flex-wrap: wrap !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  #account-pc-builder #pc-intent-panel .intent-cards > [class*="col-"].col-xs-6 {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

}
