
/* ===== Search results page (isolated styling) ===== */
.searchpage-wrapper {

  top: 0;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  z-index: 1000;
}




.searchpage-wrapper  .product-img{
  width: 300px;
  height: 300px;
  overflow: hidden;

  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.searchpage-wrapper  .product-img img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* every product is a card of its own: the same grey border as the Questions / Filters blocks */
.searchpage-wrapper  .result-item{
  display: flex;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid #9a9ca3;
  border-radius: 10px;
  background: #fff;
}
/* the text/score column always takes the whole width left beside the image: its width must not
   follow its content (opening a score description used to widen it, closing narrowed it) */
.searchpage-wrapper .result-item > .product-img { flex: 0 0 300px; }
.searchpage-wrapper .result-item > .product-info { flex: 1 1 0; min-width: 0; }




.results-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

.load-more-wrapper {
  display: flex;
  justify-content: center;
  padding: 8px 0 16px;
}

.load-more-btn {
  margin-left: 0;
  padding: 10px 28px;
  border: 1px solid #dadce0;
}

.load-more-btn[hidden] {
  display: none;
}

.load-more-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.load-more-btn.is-error {
  color: #b3261e;
  border-color: #b3261e;
}

.searchpage-wrapper  .results-section {

  margin: 16px auto;
}
.results-section.has-pending-question-changes {
  filter: blur(6px);
}

.results-header{
   background-color:#f7f7f7;
   text-align: center;
   padding: 12px 0;
}

/* zero results: which filter to drop and how many products that would give */
.no-results {
  max-width: 800px;
  margin: 16px auto 0;
  padding: 0 16px;
}
.no-results-title {
  margin: 0 0 4px;
  font-weight: 600;
}
.no-results-hint {
  margin: 0 0 8px;
  color: #5f6368;
}
.no-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.searchpage-wrapper .no-results-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  color: #202124;
}
.searchpage-wrapper .no-results-link:hover {
  background-color: #f7f7f7;
}
.no-results-item-all .no-results-link {
  border-style: dashed;
}
.no-results-count {
  flex-shrink: 0;
  color: #5f6368;
  font-size: 0.9em;
}

.searchpage-wrapper a {
  text-decoration: none;
  color: inherit;

}

/* .search-bar-bottom-divider {
  height: 1px;
  width:80%;
  background: #e0e0e0;
  margin: 16px auto;
} */


.offers-for-product {
   
    padding: 5px 38px 5px 12px; /* extra right space for arrow */
    border-radius: 9999px;
    cursor: pointer;
    margin-top: 8px;
    color: #202124;
    display: inline-block;
    position: relative;
    border:1px solid black;
}

.offers-for-product::after {
    content: "▾";              /* down arrow */
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    opacity: 0.8;
    pointer-events: none;      /* click goes through */
}

.offers-for-product.open::after {
    content: "▴";
}
.offer-container{
  margin-top: 10px;;
  display: table;
}
.offer-row{
    display: table-row;
}
.offer-row div{
    display: table-cell;
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}
/* price cell ("1 234,50 €") never breaks: the column takes the room it needs from the shipping text */
.offer-row div:nth-child(2) {
    white-space: nowrap;
}

/* The parent container */
.tooltip-container {
  position: relative;
  cursor: pointer;
  border-bottom: 1px dashed #555; /* Visual cue for the user */
}

/* Common styles for both pseudo-elements */
.tooltip-container::before,
.tooltip-container::after {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none; /* Prevents flickering */
  bottom: 125%; /* Positions it above the text */
}

/* The Tooltip Box (::before) */
.tooltip-container::before {
  content: attr(data-tooltip); /* Pulls text from the HTML attribute */
  background-color: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 14px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* The Arrow (::after) */
.tooltip-container::after {
  content: "";
  border-width: 6px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
  bottom: 105%; /* Sits right under the box */
}

/* Hover State */
.tooltip-container:hover::before,
.tooltip-container:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

.green-box{
  background-color: #C5ff88;

}
.yellow-green-box{
  background-color: #d4ff88;

}
.yellow-box{
  background-color: #fff788;

}
.orange-box{
  background-color: #ffb788;

}
.red-box{
  background-color: #ff8888;

}

.feature-score{
 border:2px #EBEBEB;
  padding: 4px 8px;
  border-radius: 4px;
  color: #202124;
}

.has-feature-no{
  
  color:#919191;
}

/* ===== Score lines (shared by total, use cases and features) ===== */
.score-line {
  height: 2px;
  background: #f1f3f4;
  border-radius: 999px;
  overflow: hidden;
}
.score-line-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
/* all score lines are dark grey regardless of the score colour class (pills keep their colour) */
.score-line-fill.green-box,
.score-line-fill.yellow-green-box,
.score-line-fill.yellow-box,
.score-line-fill.orange-box,
.score-line-fill.red-box {
  background: #6d6d6d;
}
.score-line-group {
  margin: 0 4px 6px;
}
.score-line-feature {
  margin: 0 4px 6px;
}

/* ===== Weighted total score bar ===== */
.total-score {
  margin: 0 0 4px;
  border-bottom: 1px solid #eee;
}
/* Mirrors .score-group-header: label left, score pill right, but larger and bold */
.total-score-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 4px;
  font-size: 1.15em;
  font-weight: 700;
}
.total-score-label {
  flex: 1 1 auto;
}
.total-score-value {
  flex: 0 0 auto;
  font-size: 1.05em;
  font-weight: 700;
}
/* Thicker colour line than the per-use-case lines */
.score-line-total {
  height: 6px;
  margin: 0 4px 10px;
}

/* ===== Collapsible score groups ===== */
.score-group {
  border-bottom: 1px solid #eee;
}
.score-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 4px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.score-group-header:hover {
  background: #fafafa;
}
.score-group-label {
  flex: 1 1 auto;
}
/* use case the user did not give an importance above 0 */
.score-group-unchosen .score-group-label {
  color: #9aa0a6;
}
.score-group-unchosen .score-group-header .usage-score,
.score-group-unchosen .score-line-group {
  opacity: 0.5;
}
.usage-score {
  background: #f1f3f4;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.score-max {
  font-size: 0.75em;
  font-weight: 300;
  opacity: 0.7;
}
.chevron {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid #5f6368;
  border-bottom: 2px solid #5f6368;
  transform: rotate(45deg);          /* down */
  transform-origin: center;
  margin: -3px 6px 0 0;
  transition: transform 0.25s ease;
}
.score-group.open .chevron {
  transform: rotate(-135deg);        /* up */
  margin-top: 4px;
}
.score-group-body {
  display: none;
  padding: 0 4px 8px 12px;
}
/* Feature rows mirror .score-group-header: label left, score pill right */
.feature-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 0.9em;
}
.feature-label {
  flex: 1 1 auto;
}
.feature-explanation {
  margin: -2px 0 8px 4px;
  padding-left: 10px;
  border-left: 2px solid #e0e0e0;
  font-size: 0.85em;
  color: #5f6368;
}
.score-group-body p {
  margin: 6px 0;
}

.offer-container{
  max-width: 100%;
  overflow-x: auto;
}

/* ===== Product card links ===== */
.searchpage-wrapper .product-img {
  display: flex;
  flex-shrink: 0;
}
.searchpage-wrapper .product-title-link:hover {
  text-decoration: underline;
}
.searchpage-wrapper .product-info h3 {
  font-weight: 400;
}
/* a block of its own: stays on its own line under the offers button also when the closed
   offers list between them is hidden (display: none after slideUp) */
.product-details-link {
  display: block;
  width: fit-content;
  margin: 8px 8px 0 0;
  padding: 5px 14px;
  border: 1px solid #202124;
  border-radius: 9999px;
  font-size: 14px;
  color: #202124;
}
.product-details-link:hover {
  background: #f2f2f2;
}
/* "view offer" link of an opened offers list: the same pill as .product-details-link, with an arrow */
.offer-row a.offer-link {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid #202124;
  border-radius: 9999px;
  font-size: 14px;
  color: #202124;
  text-decoration: none;
  white-space: nowrap;
}
.offer-row a.offer-link::after {
  content: "→";
  margin-left: 6px;
}
.offer-row a.offer-link:hover {
  background: #f2f2f2;
}

/* ===== Product detail page ===== */
.productpage-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}
.product-breadcrumb {
  margin-bottom: 16px;
  font-size: 14px;
}
.product-breadcrumb a {
  color: #555;
  text-decoration: none;
}
.product-breadcrumb a:hover {
  text-decoration: underline;
}
.product-detail {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.product-detail-img {
  flex: 0 0 320px;
  max-width: 320px;
}
.product-detail-img img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* gallery */
.gallery-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
}
.gallery-main img {
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.gallery-thumb {
  width: 56px;
  height: 56px;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-thumb:hover { border-color: #ccc; }
.gallery-thumb.active { border-color: #202124; }

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}
.lightbox button {
  position: absolute;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  padding: 12px;
  cursor: pointer;
  opacity: 0.8;
}
.lightbox button:hover { opacity: 1; }
.lightbox-close { top: 8px; right: 12px; font-size: 40px; }
.lightbox-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 8px; top: 50%; transform: translateY(-50%); }
.lightbox-counter {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
}
body.lightbox-open { overflow: hidden; }
.product-detail-info {
  flex: 1;
  min-width: 0;
}
.product-detail-info h1 {
  font-size: 1.5em;
  margin: 0 0 12px;
}
.product-detail-price {
  font-size: 1.25em;
  font-weight: 600;
  margin-bottom: 20px;
}
.product-detail-offers {
  font-size: 0.8em;
  font-weight: 400;
  color: #555;
  margin-left: 8px;
}
.product-detail-specs-header {
  font-size: 1.1em;
  margin: 16px 0 4px;
}
/* rows are display: contents (specs.php), so the stripe goes on the cells */
.product-detail .specs-table tr:nth-child(odd) td {
  background: #f7f7f7;
}

@media (max-width: 600px) {
  /* the search bar is hidden here, so the questions toggle would start at the very top, under the
     absolutely positioned language select (.lang-switch, general.css); leave it a row of its own */
  .searchpage-wrapper {
    padding-top: 46px;
  }

  .results-wrapper {
    padding: 8px;
  }

  .product-detail {
    flex-direction: column;
    gap: 16px;
  }
  .product-detail-img {
    flex-basis: auto;
    max-width: 100%;
    margin: 0 auto;
  }

  .searchpage-wrapper .result-item {
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px;
  }

  .searchpage-wrapper .product-img {
    width: 100%;
    max-width: 340px;
    height: 220px;
    margin: 0 auto 6px;
  }

  .searchpage-wrapper .result-item > .product-img { flex: 0 0 auto; }
  .searchpage-wrapper .result-item > .product-info { flex: 0 0 auto; width: 100%; box-sizing: border-box; }
  .product-info {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .product-info h3 {
    font-size: 1.05em;
    margin: 4px 0 8px;
  }

  .tooltip-container::before {
    white-space: normal;
    width: max-content;
    max-width: min(80vw, 280px);
    font-size: 13px;
  }

  .offers-for-product {
    display: block;
    text-align: center;
  }

  .offer-row div {
    padding: 6px 8px;
    font-size: 14px;
  }
}

/* ============================================================
   HIERARCHY V2 — START
   Visual separation of use cases (cards) vs features (indented, no pill).
   ROLLBACK: delete this whole block and remove the
   `getColorClassForScore(...)` class from the .usage-score span in
   the use-case header in product_list.php.
   ============================================================ */

/* 1) Use case = card */
.score-group {
  border: 0;
  border-bottom: 1px solid #e3e5e8;
  border-radius: 0;
  background: transparent;
  margin: 0;
  overflow: hidden;
}
.score-group-header {
  padding: 3px 4px;
  gap: 8px;
  font-size: 0.85em;
  font-weight: 500;
  background: transparent;
}
.score-group-header .usage-score {
  padding: 1px 7px;
  font-size: 0.9em;
}
.score-group-header .chevron {
  width: 7px;
  height: 7px;
  margin: -2px 4px 0 0;
}
.score-group-header:hover {
  background: #fafafa;
}
.score-group.open .score-group-header {
  border-bottom: 0;
}
.score-line-group {
  margin: 0;                     /* full card width, flush under the header */
  border-radius: 0;
}
.score-group-body {
  margin: 0 4px 6px 12px;
  padding: 4px 0 0;
}

/* 3) Use-case pill carries the score colour; feature score is a plain number */
.score-group-header .usage-score {
  color: #202124;
}
.feature-row {
  font-size: 0.78em;
  color: #3c4043;
  padding: 2px 0;
  gap: 8px;
}
.feature-row .usage-score {
  background: transparent;
  padding: 0;
  font-weight: 500;
  color: #5f6368;
}
.score-line-feature {
  margin: 0 0 4px;
  max-width: 140px;
  opacity: 0.85;
}
.feature-explanation {
  border-left: none;
  margin: 0 0 6px;
  padding-left: 0;
  font-size: 0.74em;
  font-style: italic;
  color: #80868b;
}
.score-group-body p {
  margin: 3px 0;
}

@media (max-width: 600px) {
  .score-group-body {
    margin-left: 10px;
  }
}
/* HIERARCHY V2 — END */
/* ===== Score lines, final look: the line always runs the full width - the score's share (88 of
   100 = 88 %) is thick, the rest up to 100 % is a thin line. Same for the total, the use cases and
   the single features (the thin part alone = score 0). ===== */
.score-line,
.score-line-feature {
  max-width: none;
  height: 3px;
  border-radius: 0;
  overflow: visible;
  opacity: 1;
  /* the thin line runs along the bottom edge of the thick part */
  background: linear-gradient(#b4b7bd, #b4b7bd) bottom / 100% 1px no-repeat;
}
.score-line-fill { height: 100%; border-radius: 0; }
/* the line itself closes a row: no extra rule right under it */
.total-score,
.score-group { border-bottom: 0; }
.score-line-feature { margin: 0 0 6px; }
/* a score ("100/100") never breaks over two lines */
.usage-score { flex: 0 0 auto; white-space: nowrap; }
/* the product total ("Sobivus") alone is a little thicker than the other score lines */
.score-line.score-line-total { height: 5px; }

/* ===== Desktop card: title and total score beside the image, everything else full width below ===== */
@media (min-width: 601px) {
  .searchpage-wrapper .result-item {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    /* the two 1fr rows share the spare image height: title + total score sit vertically centred beside
       the photo (product photos have a lot of white around them, a top-aligned title looked too high) */
    grid-template-rows: 1fr auto auto 1fr;
    column-gap: 16px;
  }
  /* the children of .product-info become grid items of the card */
  .searchpage-wrapper .result-item > .product-info { display: contents; }
  .searchpage-wrapper .result-item > .product-img { grid-column: 1; grid-row: 1 / span 4; }
  .searchpage-wrapper .product-info > h3 { grid-column: 2; grid-row: 2; margin-top: 0; }
  .searchpage-wrapper .product-info > .total-score { grid-column: 2; grid-row: 3; }
  .searchpage-wrapper .product-info > *:not(h3):not(.total-score) { grid-column: 1 / -1; min-width: 0; }
}

/* chosen filters on the product card, each with a tick, above the offers button */
.matched-filters {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 0.85em;
}
.matched-filters li::before {
  content: "\2713";
  margin-right: 5px;
  color: #1e8e3e;
  font-weight: 700;
}
