*, *::before, *::after {
  box-sizing: border-box;
}

  :root {
    --cli-bg: #c0c0c0;
    --cli-border: #999;
    --cli-text: #000;
    --cli-input-bg: #fff;
    --cli-button-bg: #e0e0e0;
    --cli-button-border: #444;
  }

  .vision-app {
    font-family: 'Courier New', monospace;
    background: var(--cli-bg);
    color: var(--cli-text);
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    border: 2px inset var(--cli-border);
  }

  .vision-screen {
    display: none;
  }

  .vision-screen[data-screen="1"] {
    display: block;
    text-align: center;
    padding: 40px;
  }

  .vision-logo img {
    width: 200px;
    height: auto;
  }

  .vision-logo h1 {
    font-size: 32px;
    font-weight: bold;
    margin-top: 10px;
    text-shadow: 1px 1px #fff;
  }

  .vision-cli {
    background: var(--cli-bg);
    padding: 0px;
    /*border: 2px inset var(--cli-border);*/
    
  }

  .cli-input {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 6px;
    border: 2px inset var(--cli-border);
    background: var(--cli-input-bg);
    color: var(--cli-text);
  }

  

  button {
      font-family: "MS Sans Serif", sans-serif;
      font-size: 13px;
      color: black;
      background-color: #c0c0c0;
      border: 2px solid;
      border-top-color: #fff;
      border-left-color: #fff;
      border-right-color: #404040;
      border-bottom-color: #404040;
      padding: 3px 12px;
      box-shadow: inset -1px -1px 0 #808080, inset 1px 1px 0 #fff;
      outline: none;
      cursor: default;
  }

  button:active {
      border-top-color: #404040;
      border-left-color: #404040;
      border-right-color: #fff;
      border-bottom-color: #fff;
      box-shadow: inset 1px 1px 0 #808080, inset -1px -1px 0 #fff;
  }

  button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .vision-category {
    font-weight: bold;
    margin-bottom: 10px;
  }

  .vision-part {
    display: flex;
    align-items: center;
    background: #fff;
    padding: 10px;
    border: 1px solid #999;
    margin-bottom: 8px;
  }

  .part-thumb img {
    background-color: #3895d3;
    flex: none;
  }

  div.part-thumb {
      background-color: #3895d3;

      border: 2px solid #999;
      box-shadow: inset -1px -1px 0 #666, inset 1px 1px 0 #ccc,
                  4px 4px 8px rgba(0, 0, 0, 0.4); /* bevel + drop */
      padding: 2px;

  }

  .part-thumb:hover {
    outline: 2px solid #FFF;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.5);
  }



  .part-det {
      width: 205px;
  }

  .part-total {
      width: 260px;
  }

  .part-price {
      width: 105px;
  }

  .part-info {
    margin-left: 12px;
    flex: 1;
    flex-grow: 1;
    min-width: 300px;
  }

  .part-info-icon {
    background: #0077cc;
    color: white;
    padding: 2px 5px;
    margin-left: 4px;
    border-radius: 4px;
    font-size: 0.6em;
    vertical-align: 2px;
  }

  #diagram-area, #diagram-sidebar {
    background: #fff;
    border: 2px inset #999;
    padding: 10px;
    margin-top: 10px;
  }

.vision-logo-small {
  text-align: center;
  margin-top: 20px;
}

.vision-logo-small img {
  width: 250px;
  height: auto;
  margin-top: 20px;
}

.cli-dropdown {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 2px inset var(--cli-border);
  background: var(--cli-input-bg);
  max-height: 150px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  z-index: 10;
  position: relative;
}

.cli-dropdown li {
  padding: 6px;
  cursor: pointer;
}

.cli-dropdown li:hover {
  background: #d0d0ff;
}

.model-option-box {
  border: 2px inset var(--cli-border);
  padding: 10px;
  margin-top: 10px;
  background: #fff;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  cursor: pointer;
  transition: background 0.2s ease;
}

.model-option-box:hover {
  background-color: #eef6ff;
}

.model-option-box input[type="radio"] {
  margin-right: 10px;
}

.model-option-box input[type="radio"]:checked + label,
.model-option-box input[type="radio"]:checked ~ label {
  font-weight: bold;
}

.model-option-box small {
  display: block;
  color: #555;
  margin-top: 4px;
}

.model-thumb {
  width: 90px;
  height: auto;
  object-fit: contain;
  border: 1px solid #ccc;
  background: white;
  padding: 2px;
}

.model-option-box label {
  font-size: 0.85rem;
  line-height: 1.2;
}

.vision-header-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  background: #eee;
  padding: 10px;
  margin-bottom: 10px;
  border: 2px inset var(--cli-border);
  font-family: 'Courier New', monospace;
}
.vision-header-bar > div {
  min-width: 120px;
}
#category-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size:17px;
}

#category-list li {
  padding: 6px;
  cursor: pointer;
}

#category-list li.active {
  background: #3895d3;
  font-weight: bold;
  color:white;
}

#vision-sidebar .cli-input {
  width: 90%;
  max-width: 160px;
}
#vision-sidebar .vision-diagram {
  width: 100%;
  box-sizing: border-box;
  display: block;
  margin-top: 10px;
  padding: 6px;
}
.vision-part {
  display: flex;
  align-items: flex-start;
  background: #fff;
  padding: 10px;
  border: 1px solid #999;
  margin-bottom: 8px;
  gap: 10px;
}

.part-info {
  flex: 1;
}

.part-desc {
  font-weight: bold;
}

.part-number {
  margin-top: 4px;
  font-family: monospace;
}

.part-info-icon {
  background: #0077cc;
  color: white;
  padding: 1px 5px;
  border-radius: 50%;
  font-weight: bold;
  margin-left: 4px;
  cursor: help;
}

.part-price {
  color: green;
  font-weight: bold;
  margin-top: 4px;
}

.part-name {
  font-weight: bold;
}

.part-number {
  color: #666;
  font-size: 0.9em;
}

.vision-screen[data-screen="5"] {
  display: flex;
  flex-grow: 1;
  width: 100%;
  gap: 2rem;
}

.vision-screen5-layout {
  display: flex;
  max-width: 1400px;
  align-items: stretch;
  height: 78vh; /* or whatever container height you need */
}

.diagram-column {
  flex: 0 0 auto;
  overflow:hidden;
  display: flex;
  align-items: stretch;
  position: relative;
  height: 100%;
  width: auto;
}

.parts-column {
  flex: 1;
  display: flex;
  gap: 1rem;
}

.category-sidebar {
  flex: 0 0 180px;
  background: #f0f0f0;
  padding: 1rem;
}

.screen5-results {
  flex: 1;
}
#interactive-diagram-container svg {
  height: 100%;
  width: auto;
  display: block;
  max-height: 100%;
}

#interactive-diagram-container {
  height: 100%;
  position: relative;
  overflow: hidden;
  display:flex;
  justify-content: flex-end;
  background-color: #3895d3;
}

.highlighted-part {
  outline: 2px solid yellow;
  background-color: #ffffcc;
  transition: background-color 0.3s ease;
}

input[type="text"].cli-input ,
input[type="number"].cli-input, 
select.cli-input {
  width: 250px; /* or whatever "normal" width looks best for your layout */
  max-width: 100%;
}

.vision-screen.centered-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vision-screen.centered-screen form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.vision-screen.centered-screen input,
.vision-screen.centered-screen select {
  width: 250px;
  max-width: 100%;
}

#vision-container {
    font-weight: initial;
}

#screen-5-right {
  display: flex;
  flex-direction: row;
  width: 100%;
  background: #c0c0c0;
  padding: 4px;
  border: 2px solid #808080;
  box-shadow:
    inset -2px -2px 0 #ffffff,   /* top-left highlight */
    inset 2px 2px 0 #404040;     /* bottom-right shadow */

}

#screen5-part-results .part-row {
  font-size: 0.85em;
}

.screen5-category-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.screen5-category-item:hover {
  background-color: #d0d0d0;
}

.screen5-category-item.active {
  background-color: #3895d3;
  font-weight: bold;
  color:white;
}


.vision-screen[data-screen="2"] input,
.vision-screen[data-screen="2"] select {
  width: 210px;
  max-width: 100%;
  margin: 8px auto;
}

.button-row {
  text-align: center;
}

.vision-logo-side img {
    width: 200px;
    height: auto;
    margin-top: 20px;
}

.vision-logo-side {
  text-align: center;
  margin-bottom: 20px;
}

.vision-logo-top img {
    width: 150px;
    height: auto;
}

.vision-logo-top {
  text-align: center;
  margin-bottom: 20px;
}

#screen5-category-list {
    display: flex;
    flex: 0 0 150px;
    flex-direction: column;
    font-size: 17px;

    min-width: 180px;

    border-left: 2px solid #000;
    border-right: 2px solid #888;
    height: 100%;
    background: #FFF; 
}

.screen5-category-listitems {
    
    border-radius: 4px;
    flex: 1;

    overflow-y: hidden;
    
    
}

.fixed-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #c0c0c0;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  font-family: 'Tahoma', sans-serif;
  border: solid 1px white;
  z-index:20;
}

.fixed-bottom-bar-inner {
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    margin: 0 auto;
    width:100%;
}



.part-row {
    border: 2px solid transparent;
    transition: border-color 0.2s;
    padding: 5px;
}

.part-row:hover, .hover-highlight {
    border-color: #3399ff;
    background: rgba(51,153,255,0.1);
}




#results-list {
    overflow-y: hidden;
    scrollbar-width: auto; /* Firefox */
    scrollbar-color: #aaa #ddd;
    padding-right: 16px; /* make room for scrollbar so it doesn't overlap */
    border-right: 2px solid #444;
    border-left: 2px solid #444;
    margin: 0 auto;
    max-width: 100%; /* or match your interface width */
    box-sizing: border-box;
}

.vision-results-column {
  flex: 1;
  display: flex;
  background: #FFF; 
  flex-direction: column;
  height: 100%;
  border-left: 1px solid #ccc;
  overflow:hidden;
}

#screen5-part-results {
  overflow-y: hidden;
  
  height: 100%;
}

.screen5-category-title {
  padding: 10px;
  background: #ddd;
  font-weight: bold;
  flex-shrink: 0;
  text-transform: uppercase;
  text-align: center;
  margin: 0;
  border-bottom: 1px solid #9a9a9a;
  flex: 0 0 auto;
}

#results-list::-webkit-scrollbar, #screen5-part-results::-webkit-scrollbar, #screen5-category-list::-webkit-scrollbar {
  width: 16px;
  background: #c0c0c0; /* scrollbar track */
}

#results-list::-webkit-scrollbar-thumb, #screen5-part-results::-webkit-scrollbar-thumb, #screen5-category-list::-webkit-scrollbar-thumb {
  background: #808080;
  border: 2px solid #c0c0c0; /* to give that boxy inset feel */
  box-shadow: inset -1px -1px 0 #fff, inset 1px 1px 0 #000; /* beveled look */
}

#results-list::-webkit-scrollbar-track, #screen5-part-results::-webkit-scrollbar-track, #screen5-category-list::-webkit-scrollbar-track {
  background: #c0c0c0;
  border-left: 1px solid #fff;
  border-top: 1px solid #fff;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}


#serial-match-count {
    text-align: center;
}

.win95-scroll-wrapper {
  display: flex;
  flex: 1 1 auto;
  height: 100%;
  position: relative; /* Needed for absolute scrollbar */
    min-height: 0; /* prevents flex overflow in some browsers */
}

.win95-scroll-content {
  flex: 1;
  overflow-y: hidden;
  overflow-x: hidden;
  height: 100%;
  box-sizing: border-box;
}

/* The actual scrollbar */
.win95-scrollbar-track {
  width: 24px;
  background: #c0c0c0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-left: 2px solid #000;
  border-top: 2px solid #000;
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  user-select: none;
  position: relative;
}

.win95-arrow {
  width: 100%;        /* make it exactly as wide as the track */
  height: 20px;        /* adjust as needed */
  font-size: 10px;
  font-family: 'Courier New', monospace;
  color: black;
  background: #e0e0e0;
  border: 2px outset #fff;
  padding: 0;
  cursor: pointer;
  box-sizing: border-box;
}

.win95-arrow:hover {
  background: #d0d0d0;
}

.win95-thumb-track {
  flex: 1;
  position: relative;
}


.win95-scroll-thumb {
  position: absolute;
  width: 100%;
  height: 30px;
  top: 0;
  background: #e0e0e0;
  border: 2px outset #fff;
  
  cursor: pointer;
  z-index: 1;
}

.win95-scrollbar-track-alt {
      background: #fff;
      border-left: none;
}

.win95-scroll-thumb-alt {
  background: #e0e0e0;
  border: 2px inset #f0f0f0;
  box-shadow: inset -1px -1px 0 #fefefe, inset 1px 1px 0 #888;
}

.vision-next {
    cursor: pointer;
}

.vision-clickable {
    cursor: pointer;
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 10px;
  right: 10px;
  gap: 6px;
  z-index: 10;
}

.zoom-controls button {
  width: 32px;
  height: 32px;
  background: #c0c0c0;
  border: 2px outset #fff;
  box-shadow: -1px -1px 0 #fff, 1px 1px 0 #000;
  font-size: 20px;
  font-weight: bold;
  line-height: 26px;
  text-align: center;
  padding: 0 0 28px 0;
  cursor: pointer;
  user-select: none;
  
}

#interactive-diagram-container text {
  user-select: none;
  pointer-events: none;
}

svg path {
  vector-effect: non-scaling-stroke;
}


#subcategory-list {
  font-size: 14px;       /* small readable size */
  line-height: 1.4;      /* tighten spacing */
  list-style: none;      /* clean bullet removal */
  margin: 6px 0;
  padding: 0;
}

#subcategory-list li {
  cursor: pointer;
  padding: 4px 8px;
}


/* Page 4 subcategory highlight */
#subcategory-list li.active {
  background: #0066cc;   /* blue highlight */
  color: #fff;           /* white text */
  font-weight: bold;
}

/* Page 5 type highlight */
#screen5-type-listitems .win95-row.active {
  background: #0066cc;
  color: #fff;
  font-weight: bold;
}

#subcategory-list li:hover,
#screen5-type-listitems .win95-row:hover {
  background: #cce5ff;
}

/* ==== Screen 5: Type column fixes ==== */

/* ==== Screen 5: TYPE column fixes v2 ==== */

/* Make the TYPE panel behave exactly like CATEGORY: fixed width, full height, no bleed */
#screen5-type-list {
  /* alignment + sizing */
  margin-top: 0 !important;         /* remove the inline 8px */
  height: 100%;
  flex-direction: column;
  /* visuals */
  background: #fff;
  color: #000;
  border-left: 2px solid #000;
  border-right: 2px solid #888;
  /* optional bottom bevel to mirror category look */
  /* border-bottom: 1px solid #ccc; */
  font-size: 14px;
  line-height: 1.35;
}


.part-note {
  color: #b00000;          /* red */
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.part-note-5 {
  color: #b00000;       /* red */
  font-size: 11px;      /* tiny */
  line-height: 1.25;
  margin-top: 2px;
  white-space: pre-line; /* keep line breaks in notes */
}

.subcat-badges {
    font-size:12px;
    color:#b00000;
}

#interactive-diagram-container svg path:hover {
  stroke: #FFF;          /* subtle dark gray outline */
  stroke-width: 1px;     /* thin line */
  cursor: pointer;       /* makes it feel interactive */
}

.please-call {
  font-size: 0.71em;
  border-bottom: 1px dotted;
  cursor: pointer;
  position: relative;
  display: inline-block;
}

.please-call .tooltip {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  background: #333;
  color: #fff;
  text-align: center;
  padding: 4px 8px;
  border-radius: 4px;
  position: absolute;
  z-index: 1;
  bottom: 125%; /* above the text */
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none; /* dont block clicks when hidden */
}

.please-call:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.please-call .tooltip.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/**************************************************************************
 * RESPONSIVE FIXES  MOBILE & TABLET FRIENDLY LAYOUT
 **************************************************************************/

@media (max-width: 1024px) {

  /*******************************
   * GENERAL INPUT + FORM FIXES
   *******************************/
  input.cli-input,
  select.cli-input,
  .vision-screen.centered-screen input,
  .vision-screen.centered-screen select {
      width: 100% !important;
      max-width: 100%;
  }

  /* Model option boxes (screen 3) */
  .model-option-box {
      flex-direction: row;
      flex-wrap: nowrap;
      width: 100% !important;
      max-width: 100%;
      box-sizing: border-box;
  }

  .model-option-box label {
      width: 100%;
      max-width: 100%;
      display: block;
      word-break: break-word;
  }

  .model-thumb {
      width: 70px;
      height: auto;
  }

  /*******************************
   * PAGE 4 (Results List) FIXES
   *******************************/

  /* Sidebar becomes full width on top */
  #vision-sidebar {
      max-width: 100% !important;
      width: 100% !important;
      margin-bottom: 20px;
  }

  /* Stack Category + Subcategory lists */
  #category-list,
  #subcategory-list {
      font-size: 16px;
  }

  /* Results list uses native scroll, fills width */
  #results-list {
      overflow-y: auto !important;
      padding-right: 4px;
      border-right: none;
      border-left: none;
  }

  /* Hide custom Win95 scrollbars on mobile/tablet */
  .win95-scrollbar-track,
  .win95-scrollbar-track-alt {
      display: none !important;
  }

  .win95-scroll-content {
      overflow-y: auto !important;
  }

  .win95-scroll-wrapper {
      display: block;
      height: auto;
  }

  /*******************************
   * PAGE 4 LAYOUT STACKING
   *******************************/
  .vision-screen[data-screen="4"] > div {
      flex-direction: column !important;
  }


  /*******************************
   * PAGE 5 (Diagram) FIXES
   *******************************/

  .vision-screen[data-screen="5"] {
      flex-direction: column !important;
      height: auto !important;
  }

  .vision-screen5-layout {
      flex-direction: column !important;
      height: auto !important;
      width: 100% !important;
  }

  /* Diagram goes full width */
  .diagram-column {
      width: 100% !important;
      max-width: 100%;
      order: 1;
  }

  /* Right side (category/type/parts) goes full width too */
  #screen-5-right {
      flex-direction: column !important;
      width: 100%;
      max-width: 100%;
      order: 2;
  }

  #screen5-category-list,
  #screen5-type-list,
  .vision-results-column {
      width: 100% !important;
      max-width: 100% !important;
      min-width: 100% !important;
      flex: none !important;
      height: auto !important;
  }

  #screen5-part-results {
      overflow-y: auto !important;
      max-height: 400px; /* prevents infinite scrolling issues */
  }

  /* Remove Win95 scrollbars screen 5 */
  #screen5-category-scrollbar-track,
  #screen5-type-scrollbar-track,
  #scrollbar-track {
      display: none !important;
  }

  /* Restore native scrolling for lists */
  #screen5-category-listitems,
  #screen5-type-listitems,
  #screen5-part-results {
      overflow-y: auto !important;
      padding-right: 4px;
  }
}


/**************************************************************************
 * EXTRA-SMALL (Phones Under 480px)
 **************************************************************************/
@media (max-width: 480px) {

  button {
      padding: 6px 10px;
      font-size: 12px;
  }

  .vision-header-bar {
      gap: 10px;
      font-size: 14px;
  }

  .model-thumb {
      width: 60px;
  }

  .model-option-box label {
      font-size: 0.8rem;
  }
}


@media (max-width: 1024px) {

  /* Force model option boxes to respect container width */
  #model-options {
      width: 100% !important;
      max-width: 100% !important;
  }

  .model-option-box {
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box;
      overflow: hidden;
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      gap: 10px;
  }

  /* Prevent the label section from forcing overflow */
  .model-option-box label {
      flex: 1;
      min-width: 0;        /* CRITICAL: allows text wrapping */
      word-break: break-word;
  }
}

@media (max-width: 1024px) {

  #vision-sidebar .vision-cli {
      width: 100% !important;
      max-width: 100% !important;
      box-sizing: border-box;
      padding: 10px; /* improves mobile feel */
  }

  #vision-sidebar input.cli-input {
      width: 100% !important;
      max-width: 100% !important;
  }

  #vision-sidebar ul.cli-dropdown {
      max-width: 100% !important;
      width: 100% !important;
  }
}

@media (max-width: 1024px) {

  #screen5-part-results,
  #screen5-category-listitems,
  #screen5-type-listitems {
      
      box-sizing: border-box;
  }

}

@media (max-width: 1024px) {

  input[type="checkbox"] {
      height: 24px;
      width: 24px;
      transform: scale(1.3);
      margin-right: 8px;
  }

  /* Keep alignment consistent */
  .part-row,
  .win95-row {
      align-items: center !important;
  }
}

/* Desktop default */
.refine-model-container {
    flex: 1.5;
    min-width: 350px;
}

/* Tablet & mobile */
@media (max-width: 1024px) {
    .refine-model-container {
        flex: 1 1 100%;
        min-width: 0 !important;
        width: 100%;
    }
}

/***************************************************************
 * SCREEN 4  CLEAN LAYOUT (REMOVES INLINE STYLE DEPENDENCE)
 ***************************************************************/
.screen4-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.screen4-sidebar {
    flex: 0 0 200px;       /* Desktop width */
    max-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cli-block {
    background: #e0e0e0;
    padding: 5px;
}

.screen4-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 660px;
}

.screen4-scroll-wrapper {
    flex: 1;
}

/*******************************
 * Mobile / Tablet Layout
 *******************************/
@media (max-width: 1024px) {

    .screen4-layout {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .screen4-sidebar {
        flex: none !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .screen4-results {
        flex: none !important;
        width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
    }

}


/* Shared layout for each row generated in parts.js */
.part-row-flex {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}


@media (max-width: 1024px) {

  .part-row-flex {
      flex-direction: row;
      align-items: flex-start;
      gap: 12px;
      width: 100% !important;
      min-width: 0 !important;
  }

  /* Thumbnail */
  .part-thumb img,
  .part-thumb {
      max-width: 100px !important;
      height: auto;
  }

  /* Info block wraps nicely */
  .part-info {
      flex: 1 1 auto;
      min-width: 0;
      word-break: break-word;
  }

  /* The quantity + add area shrinks */
  .part-total,
  .part-price {
      max-width: 80px;
      min-width: 0;
      flex-shrink: 1;
  }
}

/* Desktop thumbnail size */
.svg-thumb {
    width: 200px;
    height: 200px;
}

/* Mobile/tablet friendly thumbnails */
@media (max-width: 1024px) {
    .svg-thumb {
        width: 120px !important;  /* good mobile size */
        height: auto !important;
    }

    .part-thumb {
        max-width: 120px !important;
    }
}

@media (max-width: 1024px) {

  /* Prevent Add Section from collapsing */
  .part-total,
  .part-price {
      flex: 0 0 auto !important;
      white-space: nowrap;
  }

  #results-list .part-row-flex {
      align-items: flex-start !important;
  }

  .part-row-flex input[type="number"] {
      width: 55px; /* stable size */
      min-width: 55px;
  }

  .part-row-flex button {
      min-width: 55px !important;
      padding: 6px !important;
  }
}


@media (max-width: 1024px) {

  .part-row-flex {
      margin-bottom: 0.5rem !important;
      padding: 8px !important;
      gap: 8px !important;
  }

  .part-info {
      margin-left: 4px !important;
  }

  .part-desc, .part-name {
      margin-bottom: 4px;
  }
}

.part-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  width: 100%;
}

.part-info-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 200px;
}

.part-info-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.part-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  width: 100%;
  flex-wrap: wrap; /* NEW: allows proper wrapping on mobile */
}


@media (max-width: 800px) {
  .part-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}


.part-info-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.part-info-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}




@media (max-width: 800px) {

  /* tighten text spacing on small screens */
  .part-info-main {
    gap: 2px;
  }

  /* actions move to full-width row */
  .part-info-actions {
    width: 100%;
    justify-content: flex-start;
    margin-top: 10px;
  }

  .quantity-input {
    width: 70px !important;
    height: 30px;
  }

  .add-cart-button {
    min-width: 70px;
  }
}

@media (max-width: 800px) {
  .part-total {
    display: block;
    white-space: normal;
    margin-top: 4px;
  }
}

.part-info-icon {
  margin-left: 4px;
}


/* ===========================
   DESKTOP ( 900px wide)
   Restore horizontal layout
   =========================== */
@media (min-width: 900px) {

  .part-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .part-info {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }

  .part-info-main {
    flex-direction: column;
    align-items: flex-start;
    min-width: 200px;
  }

  .part-info-actions {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    margin-top: 0;
  }

  .quantity-input {
    width: 50px;
  }
}

/* Desktop layout */
@media (min-width: 900px) {

  .part-info {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
  }

  .part-info-main {
    display: flex;
    flex-direction: row;  
    align-items: center;
    gap: 2rem;
    flex: 1;
  }

  .part-meta {
    display: flex;
    flex-direction: row;
    justify-content: center;
    min-width: 150px;
  }

  .part-info-actions {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    white-space: nowrap;
  }

  .part-price {
    margin-left: 5px;
  }

  /* THIS stacks name + part number vertically */
  .part-name-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 200px;
  }

}

/* Mobile: stack label + count */
@media (max-width: 900px) {
  .part-total {
    display: block;
    line-height: 1.2;
  }
}

/* Desktop: keep in one line */
@media (min-width: 901px) {
  .part-total {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
}

.zoom-controls {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 10px;
  right: 10px;
  gap: 6px;
  z-index: 10;
}

/* MOBILE FIX  move controls to bottom center */
/*  MOBILE ONLY  */
@media (max-width: 768px) {
  /* Move zoom controls BELOW diagram */
  .zoom-controls {
    position: static !important;   /* remove absolute */
    flex-direction: row !important;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  /* Optional: make buttons a bit larger for touch */
  .zoom-controls button {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  /* Make diagram container match the width of category box */
  #interactive-diagram-container {
    width: 100% !important;
    max-width: 100% !important;
    border: 2px inset #999;
    box-sizing: border-box;
  }
}


@media (max-width: 768px) {
  .zoom-controls {
    position: relative !important;   /* detach from absolute */
    top: auto !important;
    right: auto !important;

    flex-direction: row !important;
    justify-content: center;
    gap: 12px;

    width: 100%;
    margin-top: 10px;
  }

  /* The magic: force buttons to drop BELOW the diagram */
  .diagram-column {
    flex-direction: column !important;
    align-items: center !important;
  }
}


@media (max-width: 1024px) {

  /* Add spacing so hover highlight fills full visible width */
  .win95-scroll-content {
      padding-right: 0px !important;
      box-sizing: border-box;
  }

  /* Pull scrollbar in so it aligns with padding */
  .win95-scrollbar-track {
      right: 0 !important;     /* ensure it sits flush on the edge */
      margin-right: 0 !important;
  }
}

.part-row {
    flex-shrink: 0 !important;
    flex-grow: 1 !important;
    min-width: 100% !important;
}

.win95-scroll-wrapper,
.win95-scroll-content,
.results-column {
    min-width: 100% !important;
    flex-shrink: 0 !important;
}

/* Tablet layout: prevent total + price overlap */
@media (max-width: 1024px) and (min-width: 900px) {
    .part-meta {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.25rem !important;
    }

    /* OPTIONAL: ensure quantity row stays clean */
    .part-actions {
        margin-top: 0.5rem;
    }
}


@media (max-width: 768px) {
    #interactive-diagram-container {
        min-height: 260px !important; /* Ensures visible space for SVG */
        height: auto !important;
        overflow: visible !important;  /* Safari-safe */
        position: relative !important;
    }

    .diagram-column {
        overflow: visible !important;
        flex-shrink: 0 !important; /* prevents safari collapse */
    }

    #interactive-diagram-container svg {
        width: 100% !important;
        height: auto !important;
        display: block;
    }
}


@media (min-width: 1025px) {
  .win95-scroll-wrapper {
    overflow: hidden;
  }
  .win95-scroll-content {
    overflow-y: auto;
  }
}


/* Disable win95 scrolling on screen 4 */
#screen4 .win95-scroll-content {
    overflow-y: visible !important;
}

#results-list .win95-scroll-content {
    overflow-y: visible !important;
}

/* Base layering for all Win95 scroll areas */
.win95-scroll-wrapper {
  position: relative;
}

.win95-scroll-content {
  position: relative;
  z-index: 1;
}

/* The custom scrollbar track should sit on top of the content */
.win95-scrollbar-track {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;           /* whatever you were using before */
  z-index: 3;            /* key: higher than the content */
  display: flex;
  flex-direction: column;
}

/* Screen 5: keep space for the Win95 track */
#screen-5 .win95-scroll-content {
  padding-right: 26px;   /* or whatever matches your scrollbar width + a pixel or two */
  box-sizing: border-box;
}

/* Screen 4: keep your "no gap" behavior */
@media (max-width: 1024px) {
  #screen-4 .win95-scroll-content {
    padding-right: 0;
  }
}

/* Screen 5 main 3-column layout (Diagram | Category | Parts) */
.screen5-layout,
.vision-screen-5-layout {
    display: flex;
    align-items: stretch;     /* IMPORTANT */
    height: 100%;             /* Forces children to match diagram height */
}

/* Each column fills the height */
.diagram-column,
.screen5-category-list,
.screen5-results-column {
    display: flex;
    flex-direction: column;
    height: 100%;             /* Match the wrapper */
}

/* The scrollable regions must fill remaining height inside their column */
#screen5-category-scroll-wrapper,
#screen5-results-scroll-wrapper,
.win95-scroll-wrapper {
    flex: 1;                  /* absorb height */
    height: 100%;             /* prevent collapse */
    min-height: 0;            /* FIX for overflow in flexbox! */
}

/* Scroll content also needs min-height reset */
.win95-scroll-content {
    flex: 1;
    min-height: 0;            /* key to prevent overflow past the border */
}

/* Parent of diagram + category + parts columns */
.vision-screen-5-layout,
.screen5-layout,
#screen-5 {
    display: flex;
    min-width: 0;    /* allows shrink */
    overflow: hidden; /* keeps content inside grey */
}


#screen-5-right
{
    min-width: 0;        /* KEY FIX */
    flex-shrink: 1;      /* allow shrinking */
}