/* RFQ storefront styles. Inherit theme fonts/colours; only layout + a few neutrals. */
:root {
  --rfq-accent: currentColor;
  --rfq-border: rgba(0, 0, 0, .12);
  --rfq-muted: rgba(0, 0, 0, .55);
  --rfq-danger: #c62828;
  --rfq-ok: #2e7d32;
  --rfq-bg: #fff;
  --rfq-radius: 6px;
}

/* ---- quote-only mode: hide regular cart / checkout entry points (server blocks them too) */
.rfq-mode-all #cart,
.rfq-mode-all .desktop-cart-wrapper,
.rfq-mode-all .mobile-cart-wrapper,
.rfq-mode-all #header-cart,
.rfq-mode-all .header-cart,
.rfq-mode-all a[href*="route=checkout/checkout"],
.rfq-mode-all a[href*="route=checkout/cart"],
.rfq-mode-all #top-links a[href*="checkout"],
.rfq-mode-all .cart-wrapper:not(.rfq-entry),
.rfq-mode-all [data-quick-buy],
.rfq-mode-all .btn-extra[onclick*="cart.add("] { display: none !important; }

/* ---- per-product mode: quote-only products */
.rfq-quote-only [data-quick-buy],
.rfq-quote-only .btn-extra[onclick*="cart.add("] { display: none !important; }
.rfq-hide-quote-price .rfq-quote-only .price,
.rfq-hide-quote-price .rfq-quote-only .product-price,
.rfq-hide-quote-price .rfq-quote-only .product-price-group { display: none !important; }

/* ---- mixed mode: extra quote button next to the cart button */
.rfq-quote-btn { display: inline-flex !important; align-items: center; justify-content: center; gap: 8px; margin-left: 6px; white-space: nowrap; vertical-align: middle; }
.rfq-quote-btn .rfq-icon { width: 18px; height: 18px; flex: none; }
/* shown instead of hidden purchase controls: full width, same height as the theme's other action buttons */
.rfq-quote-btn.rfq-quote-btn-block { display: flex !important; width: 100%; margin: 0 0 10px; min-height: 44px; }
.product-thumb .rfq-quote-btn.rfq-quote-btn-block { min-height: 38px; margin: 6px 0; }
/* sized like the neighbouring cart button (values set by rfq.js); outline in the cart button's colour */
.rfq-quote-btn.rfq-quote-btn-matched { height: var(--rfq-btn-h); min-height: 0; padding: 0 12px; gap: 5px; line-height: 1; border-radius: var(--rfq-btn-r, 0); background: transparent !important; color: var(--rfq-btn-c, currentColor) !important; border: 1px solid var(--rfq-btn-c, currentColor) !important; box-shadow: none; }
.rfq-quote-btn.rfq-quote-btn-matched:hover, .rfq-quote-btn.rfq-quote-btn-matched:focus-visible { background: var(--rfq-btn-c, #333) !important; color: #fff !important; }
.rfq-quote-btn.rfq-quote-btn-matched .rfq-icon { width: 15px; height: 15px; }
.cart-group .rfq-quote-btn, .button-group .rfq-quote-btn { margin-left: 6px !important; }
/* Journal disables the whole purchase block of out-of-stock products (pointer-events: none on .cart-group);
   quoting must stay possible, including the quantity stepper the quote uses */
.rfq-quote-btn, .btn[data-rfq="1"] { pointer-events: auto !important; }
.cart-group:has(.rfq-quote-btn) .stepper, .cart-group:has([data-rfq="1"]) .stepper { pointer-events: auto !important; }

/* ---- hidden prices (data is already removed server-side; this covers theme leftovers) */
.rfq-hide-price .price,
.rfq-hide-price .product-price,
.rfq-hide-price .price-new,
.rfq-hide-price .price-old,
.rfq-hide-price .price-tax,
.rfq-hide-price .product-price-group { display: none !important; }
.rfq-price-text { margin: 4px 0; font-weight: 600; }
.rfq-ref-notice { font-size: .875em; color: var(--rfq-muted); margin: 6px 0; }

/* ---- header entry */
.rfq-entry { position: relative; display: inline-flex; align-items: center; vertical-align: middle; margin: 0 6px; }
/* Journal classic header: entry sits left of the cart pill in the same row */
.classic-cart-wrapper > .rfq-entry, .mobile-bar > .rfq-entry { flex: none; margin: 0 12px 0 0; }
.rfq-entry-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; padding: 6px 8px; line-height: 1; }
.rfq-entry-link:hover, .rfq-entry-link:focus-visible { text-decoration: none; opacity: .85; }
.rfq-icon { width: 20px; height: 20px; flex: none; }
.rfq-count { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rfq-danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.rfq-count-empty { opacity: .45; background: #777; }
.rfq-entry-mobile .rfq-entry-label { display: none; }
.rfq-entry-floating { position: fixed; right: 16px; bottom: 16px; z-index: 9990; margin: 0; background: var(--rfq-bg); border-radius: 24px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.rfq-entry-floating .rfq-entry-link { padding: 12px 14px; }
.rfq-entry-floating .rfq-panel { bottom: calc(100% + 8px); top: auto; }

.rfq-panel { background-color: #fff !important; position: absolute; right: 0; top: calc(100% + 6px); z-index: 9991; width: 320px; max-width: calc(100vw - 24px); background: var(--rfq-bg); color: #222; border: 1px solid var(--rfq-border); border-radius: var(--rfq-radius); box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 12px; text-align: left; }
.rfq-panel[hidden] { display: none; }
.rfq-panel-list { list-style: none; margin: 0 0 10px; padding: 0; max-height: 50vh; overflow: auto; }
.rfq-panel-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rfq-border); }
.rfq-panel-item img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.rfq-panel-item-error { color: var(--rfq-danger); }
.rfq-panel-text { flex: 1; min-width: 0; font-size: 13px; }
.rfq-panel-text strong, .rfq-panel-text small { display: block; overflow: hidden; text-overflow: ellipsis; }
.rfq-panel-text small { color: var(--rfq-muted); white-space: nowrap; }
.rfq-panel-qty { font-size: 13px; white-space: nowrap; }
.rfq-panel-empty, .rfq-panel-more, .rfq-panel-loading { margin: 4px 0 10px; font-size: 13px; color: var(--rfq-muted); }
.rfq-panel-actions .rfq-btn { display: block; width: 100%; text-align: center; }

/* ---- toast */
.rfq-toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); width: 360px; }
.rfq-toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--rfq-radius); background: #fff !important; opacity: 1; color: #222 !important; box-shadow: 0 8px 28px rgba(0,0,0,.28); border: 1px solid rgba(0,0,0,.12); border-left: 4px solid var(--rfq-ok); font-size: 14px; transition: opacity .35s, transform .35s; }
.rfq-toast-error { border-left-color: var(--rfq-danger); }
.rfq-toast.rfq-out { opacity: 0; transform: translateY(-8px); }
.rfq-toast-msg { flex: 1; }
.rfq-toast-link { white-space: nowrap; font-weight: 600; }
.rfq-toast-close { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; padding: 0 2px; }

/* ---- buttons */
.rfq-busy { opacity: .6; pointer-events: none; cursor: progress; }
.rfq-invalid { border-color: var(--rfq-danger) !important; }
.rfq-error { color: var(--rfq-danger); font-size: .875em; margin-top: 4px; }

/* ---- quote cart page */
.rfq-page h1 { margin-bottom: 12px; }
.rfq-intro { margin-bottom: 20px; }
.rfq-empty { padding: 32px 0; text-align: center; }
.rfq-lines { border-top: 1px solid var(--rfq-border); margin-bottom: 28px; }
.rfq-line { display: grid; grid-template-columns: 80px 1fr 150px 40px; gap: 16px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--rfq-border); transition: background .3s; }
.rfq-line.rfq-saved { background: rgba(46,125,50,.06); }
.rfq-line-error { background: rgba(198,40,40,.05); }
.rfq-line img { width: 80px; height: 80px; object-fit: contain; }
.rfq-line-name { font-weight: 600; }
.rfq-line-meta, .rfq-line-options { font-size: .875em; color: var(--rfq-muted); margin: 2px 0 0; padding: 0; list-style: none; }
.rfq-line-price { font-size: .875em; margin-top: 4px; }
.rfq-line-note { margin-top: 8px; }
.rfq-line-note textarea { width: 100%; min-height: 44px; resize: vertical; font-size: .9em; }
.rfq-line .rfq-error { grid-column: 1 / -1; }
.rfq-qty { display: flex; align-items: stretch; max-width: 150px; }
.rfq-qty input { width: 100%; min-width: 0; text-align: center; -moz-appearance: textfield; }
.rfq-qty input::-webkit-outer-spin-button, .rfq-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rfq-qty button { width: 40px; flex: none; border: 1px solid var(--rfq-border); background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.rfq-remove { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; padding: 6px; color: var(--rfq-muted); }
.rfq-remove:hover { color: var(--rfq-danger); }

.rfq-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.rfq-field { margin-bottom: 16px; }
.rfq-field-wide { grid-column: 1 / -1; }
.rfq-field label { display: block; font-weight: 600; margin-bottom: 4px; }
.rfq-field .rfq-required::after { content: " *"; color: var(--rfq-danger); }
.rfq-field input, .rfq-field select, .rfq-field textarea { width: 100%; }
.rfq-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.rfq-privacy { display: flex; gap: 8px; align-items: flex-start; }
.rfq-privacy input { width: auto; margin-top: 4px; }
.rfq-form-alert[hidden] { display: none; }
.rfq-form-alert { font-weight: 600; }
.rfq-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.rfq-actions .btn { min-width: 180px; min-height: 44px; }

.rfq-summary { width: 100%; border-collapse: collapse; margin: 16px 0; }
.rfq-summary th, .rfq-summary td { padding: 8px; border-bottom: 1px solid var(--rfq-border); text-align: left; vertical-align: top; }
.rfq-summary td.rfq-num, .rfq-summary th.rfq-num { text-align: right; }
.rfq-messages .rfq-message { border-left: 3px solid var(--rfq-border); padding: 8px 14px; margin-bottom: 12px; }
.rfq-messages .rfq-message small { color: var(--rfq-muted); display: block; margin-bottom: 4px; }
.rfq-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .8em; background: rgba(0,0,0,.07); }

@media (max-width: 767px) {
  /* anchor the mini summary to the viewport so it never overflows, wherever the theme puts the entry */
  .rfq-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-width: none; }
  .rfq-entry-floating .rfq-panel { top: auto; bottom: 80px; }
  .rfq-line { grid-template-columns: 64px 1fr 36px; gap: 10px; }
  .rfq-line img { width: 64px; height: 64px; }
  .rfq-line .rfq-qty { grid-column: 2 / 3; grid-row: 2; max-width: none; }
  .rfq-line .rfq-remove { grid-column: 3; grid-row: 1; }
  .rfq-form-grid { grid-template-columns: 1fr; }
  .rfq-actions .btn { width: 100%; }
  .rfq-summary .rfq-hide-sm { display: none; }
}
