/* =========================================================================
   Smart Search (okt 2026) – v1.2.6 met AI-advies
   Hoort bij smartsearch.js (OCMOD "JBN Smart Search").
   Huisstijl: navy #12294a, rood #e2231a.
   ========================================================================= */

/* "AI zoeken" als label ín de zoekbalk, links van het vergrootglas */
#search .header-search.jss-has-trigger { position: relative; }
#search .header-search.jss-has-trigger .search-input {
  padding-right: 118px !important;            /* ruimte voor het label */
  text-overflow: ellipsis;
}
.jss-trigger,
#search .header-search .jss-trigger {
  position: absolute !important;
  top: 50% !important;
  right: 46px;                                /* wordt door het script exact gezet */
  left: auto !important;
  z-index: 3;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  width: auto !important;
  height: 28px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 11px !important;
  border: 1px solid #f3c7c4 !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #e2231a !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(18, 41, 74, .08) !important;
  transform: translateY(-50%) !important;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s;
}
.jss-trigger:focus-visible { outline: 2px solid #12294a; outline-offset: 2px; }
.jss-trigger::before,
.jss-trigger::after { content: none !important; display: none !important; } /* geen vergrootglas van Journal */
.jss-trigger:hover { background: #fff5f4 !important; border-color: #e2231a !important; }
.jss-trigger-spark { font-size: 12px; }

.jss-trigger-short { display: none; }

/* mobiel / smal: kort label "✦ AI" */
@media (max-width: 1023px) {
  #search .header-search.jss-has-trigger .search-input { padding-right: 68px !important; }
  .jss-trigger,
  #search .header-search .jss-trigger { height: 28px !important; padding: 0 9px !important; gap: 4px; }
  .jss-trigger-txt { display: none; }
  .jss-trigger-short { display: inline; }
}

/* Venster */
html.jss-open, html.jss-open body { overflow: hidden; }
.jss[hidden] { display: none; }
.jss {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 7vh 16px 16px;
}
.jss-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 35, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .18s ease;
}
.jss-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  max-height: 86vh;
  padding: 28px 28px 18px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(18, 41, 74, .35);
  opacity: 0;
  transform: translateY(-10px) scale(.985);
  transition: opacity .18s ease, transform .18s ease;
}
.jss.is-open .jss-backdrop { opacity: 1; }
.jss.is-open .jss-dialog { opacity: 1; transform: none; }

.jss-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #12294a;
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
}
.jss-close:hover { background: #e5e7eb; }

.jss-title {
  margin: 0 48px 6px 0 !important;
  color: #12294a !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
}
.jss-spark { color: #e2231a; }
.jss-sub { margin: 0 0 18px; color: #4b5563; font-size: 15px; line-height: 1.5; }

.jss-form { display: flex; gap: 10px; }
.jss-input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1.5px solid #cfd5de;
  border-radius: 10px;
  background: #fff;
  color: #111;
  font-size: 16px;               /* 16px: geen automatische zoom op iPhone */
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.jss-input:focus { border-color: #12294a; box-shadow: 0 0 0 4px rgba(18, 41, 74, .1); }
.jss-go {
  flex: none;
  height: 52px;
  padding: 0 26px;
  border: 0;
  border-radius: 10px;
  background: #e2231a;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.jss-go:hover { background: #c41d15; }

.jss-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 14px; }
.jss-chip {
  padding: 7px 14px;
  border: 1px solid #d6dbe3;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.jss-chip:hover { border-color: #12294a; background: #f5f7fa; }

.jss-status {
  padding: 13px 16px;
  border-radius: 10px;
  background: #f3f5f8;
  color: #374151;
  font-size: 14px;
}
.jss-status[hidden] { display: none; }
.jss.is-busy .jss-status::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -1px;
  border: 2px solid #cfd5de;
  border-top-color: #12294a;
  border-radius: 50%;
  animation: jss-spin .7s linear infinite;
}
@keyframes jss-spin { to { transform: rotate(360deg); } }

/* Resultaten */
/* scrollgebied: AI-advies + zoekresultaten */
.jss-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -8px;
  padding: 0 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.jss-list {
  margin: 0 -8px !important;
  padding: 0 !important;
  list-style: none !important;
}
.jss-list:empty { display: none; }
.jss-list li { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.jss-list li::before { display: none !important; }
.jss-list a {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  border-radius: 10px;
  color: #1f2937 !important;
  text-decoration: none !important;
}
.jss-list li + li a { border-top: 1px solid #f0f2f5; border-radius: 0; }
.jss-list a:hover,
.jss-list li.is-active a { background: #f5f7fa; border-radius: 10px; }
.jss-list img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: #fff;
}
.jss-name { font-size: 14px; font-weight: 600; line-height: 1.4; color: #1f2937; }
.jss-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.jss-price { font-size: 15px; color: #111; }
.jss-price s { margin-right: 4px; color: #9ca3af; font-size: 13px; }
.jss-stock { color: #1e8e3e; font-size: 12px; font-weight: 700; }

.jss-all {
  display: block;
  margin: 14px 0 4px;
  padding: 11px;
  border-radius: 10px;
  background: #12294a;
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none !important;
}
.jss-all:hover { background: #0c1d36; }
.jss-all[hidden] { display: none; }

.jss-foot { margin: 14px 0 0; color: #6b7280; font-size: 12px; line-height: 1.5; }

/* ---------- AI-advies (v1.2.6) ---------- */
.jss-go span { margin-right: 2px; font-size: 14px; }
.jss-ai[hidden] { display: none; }
.jss-ai {
  margin: 0 0 6px;
  padding: 16px 18px 12px;
  border: 1px solid #e3e8f0;
  border-left: 4px solid #e2231a;
  border-radius: 12px;
  background: #f4f6f9;
}
.jss-ai-head { margin-bottom: 8px; }
.jss-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #12294a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.jss-ai-badge span { color: #ff6b63; }
.jss-ai-text { margin: 0 0 10px; color: #1f2937; font-size: 15px; line-height: 1.55; }
.jss-ai.is-error .jss-ai-text { margin-bottom: 4px; color: #6b7280; font-size: 14px; }
.jss-ai-load { display: none; }
.jss-ai.is-loading .jss-ai-text { color: #4b5563; font-size: 14px; }
.jss-ai.is-loading .jss-ai-load { display: block; }
.jss-ai-load i {
  display: block;
  height: 12px;
  margin: 0 0 8px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e6eaf0 0%, #f7f8fa 50%, #e6eaf0 100%);
  background-size: 200% 100%;
  animation: jss-shimmer 1.2s linear infinite;
}
.jss-ai-load i:nth-child(2) { width: 82%; }
.jss-ai-load i:nth-child(3) { width: 58%; }
@keyframes jss-shimmer { to { background-position: -200% 0; } }

.jss-h {
  margin: 6px 0 4px !important;
  color: #12294a !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.jss-h[hidden] { display: none; }
.jss-res-h { margin-top: 14px !important; }

.jss-rec { margin: 0 -10px !important; }
.jss-rec li + li a { border-top-color: #e6eaf0; }
.jss-rec a:hover, .jss-rec li.is-active a { background: #fff; }
.jss-rec img { border-color: #e3e8f0; }
.jss-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jss-why { color: #4b5563; font-size: 13px; line-height: 1.4; }
.jss-why::before { content: '✓ '; color: #1e8e3e; font-weight: 700; }

.jss-follow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.jss-follow:empty { display: none; }
.jss-fu {
  padding: 6px 13px;
  border: 1px solid #f3c7c4;
  border-radius: 999px;
  background: #fff;
  color: #c41d15;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.jss-fu::before { content: '+ '; }
.jss-fu:hover { border-color: #e2231a; background: #fff5f4; }

/* Mobiel: venster over bijna het hele scherm */
@media (max-width: 767px) {
  .jss { padding: 10px 10px 0; }
  .jss-dialog { max-height: calc(100vh - 10px); max-height: calc(100dvh - 10px); padding: 20px 16px 14px; border-radius: 16px 16px 0 0; }
  .jss-close { top: 12px; right: 12px; }
  .jss-title { font-size: 20px !important; }
  .jss-sub { margin-bottom: 14px; font-size: 14px; }
  .jss-go { padding: 0 16px; }
  .jss-chips { flex-wrap: nowrap; overflow-x: auto; margin: 12px -16px; padding: 0 16px 2px; scrollbar-width: none; }
  .jss-chips::-webkit-scrollbar { display: none; }
  .jss-chip { flex: none; }
  .jss-list a { grid-template-columns: 56px 1fr; gap: 12px; }
  .jss-list img { width: 56px; height: 56px; }
  .jss-meta { grid-column: 2; flex-direction: row; align-items: center; gap: 10px; }
  .jss-foot { display: none; }
  .jss-ai { padding: 14px 14px 10px; }
  .jss-ai-text { font-size: 14px; }
  .jss-rec { margin: 0 -6px !important; }
  .jss-follow { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .jss-fu { flex: none; }
}
