.rb-quick-case-finder {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  white-space: nowrap;
  width: 100%;
  overflow: visible;
}


/* ======================================================
   Dimension image + input fields
   ====================================================== */

.rb-dimension-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}


/* ======================================================
   Unit button group
   ====================================================== */

.rb-unit-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  overflow: visible;
}


/* ======================================================
   Dimension image
   ====================================================== */

.rb-guide-wrap {
  position: relative;
  flex: 0 0 auto;
  height: 36px;
  display: flex;
  align-items: center;
  z-index: 50;
}


.rb-dimension-guide {
  display: block;
  height: 36px;
  width: auto;
  max-width: none;
  object-fit: contain;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  cursor: zoom-in;
}


/* Hover preview */

.rb-guide-hover {
  display: none;
  position: absolute;
  bottom: 46px;
  left: 0;
  width: 280px;
  height: auto;
  max-width: 75vw;
  object-fit: contain;
  background: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.28);
  z-index: 999999;
  pointer-events: none;
}


.rb-guide-wrap:hover .rb-guide-hover {
  display: block;
}


/* ======================================================
   Inputs
   ====================================================== */

.rb-quick-case-finder input {
  width: 88px;
  min-width: 70px;
  height: 36px;
  box-sizing: border-box;
  padding: 7px 8px;
  font-size: 14px;
  color: #222 !important;
  background: #fff !important;
  border: 1px solid #aaa;
  border-radius: 5px;
}


.rb-quick-case-finder input::placeholder {
  color: #777;
  opacity: 1;
}


.rb-quick-case-finder input:focus {
  border-color: #1677c8;
  outline: 2px solid #d9ecfb;
  outline-offset: 0;
}


/* Invalid input */

.rb-quick-case-finder input.rb-input-error {
  border-color: #d10000 !important;
  outline: 2px solid rgba(209, 0, 0, 0.12) !important;
  outline-offset: 0 !important;
}


/* ======================================================
   Unit buttons
   ====================================================== */

.rb-quick-case-finder .rb-unit-button {
  position: relative !important;
  flex: 0 0 auto;
  height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  background: #1677c8 !important;
  border: 1px solid #1677c8 !important;
  border-radius: 5px;
  line-height: 1.2;
  overflow: visible !important;
}


.rb-quick-case-finder .rb-unit-button:hover {
  color: #fff !important;
  background: #0f5f9f !important;
  border-color: #0f5f9f !important;
}


/* ======================================================
   Custom button tooltips
   ====================================================== */

.rb-unit-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(3px);
  width: max-content;
  max-width: 230px;
  box-sizing: border-box;
  padding: 6px 9px;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  background: #222 !important;
  border-radius: 4px;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  text-align: center;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 9999999;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s ease;
}


.rb-unit-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #222;
}


.rb-unit-button:hover .rb-unit-tooltip,
.rb-unit-button:focus-visible .rb-unit-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}


/* ======================================================
   Validation error row
   ====================================================== */

.rb-quick-case-finder .rb-case-finder-error {
  flex: 0 0 100% !important;
  width: 100% !important;
  display: none;
  box-sizing: border-box;
  margin-top: 2px !important;
  color: #d10000 !important;
  -webkit-text-fill-color: #d10000 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  text-align: left;
  white-space: normal !important;
}


.rb-quick-case-finder .rb-case-finder-error.is-visible {
  display: block !important;
}


/* ======================================================
   Lightbox
   ====================================================== */

#rb-case-finder-lightbox {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.86) !important;
  z-index: 2147483647 !important;
  padding: 25px;
  box-sizing: border-box;
  cursor: zoom-out;
}


.rb-lightbox-image-wrap {
  position: relative;
  max-width: 95vw;
  max-height: 92vh;
}


#rb-case-finder-lightbox img {
  display: block;
  max-width: 95vw !important;
  max-height: 90vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  background: #fff;
  border: none !important;
  border-radius: 5px;
}


.rb-lightbox-close {
  position: absolute !important;
  top: -18px !important;
  right: -18px !important;
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #222 !important;
  -webkit-text-fill-color: #222 !important;
  font-size: 27px !important;
  line-height: 38px !important;
  text-align: center;
  cursor: pointer;
}


/* ======================================================
   Mobile
   ====================================================== */

@media (max-width: 600px) {

  .rb-quick-case-finder {
    overflow: visible;
  }

  .rb-guide-hover {
    width: 220px;
    max-width: 80vw;
  }

}


/* Very narrow screens */

@media (max-width: 400px) {

  .rb-quick-case-finder input {
    width: 70px;
    min-width: 60px;
  }

}
