/* ============================================================================
   WgestAdev storefront CSS — loaded AFTER main.css by core/index.html and
   auth_manager/login.html only. main.css is shared with web_admin: untouched.

   The :root block mirrors the Blue A tailwind.config in core/index.html — the
   only place outside that config where colour values appear. Keep in sync.
   ============================================================================ */
:root {
  --sf-brand-50:  #f2f7fc;
  --sf-brand-100: #e2ecf9;
  --sf-brand-200: #c4daf2;
  --sf-brand-300: #9bbfe9;
  --sf-brand-600: #296ebc;
  --sf-brand-700: #225a9b;
  --sf-surface:   #ffffff;
  --sf-ink:       #111827;
  --sf-muted-100: #f4f6f9;
  --sf-muted-200: #e6eaf0;
  --sf-muted-300: #d1d7e0;
  --sf-muted-600: #5d6878;
  --sf-success-bg:   #e3f5e9;
  --sf-success-text: #146c34;
  --sf-shadow: 0 1px 2px rgba(17,24,39,.06), 0 4px 14px rgba(17,24,39,.07);
  --sf-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Quantity stepper ------------------------------------------------------
   Used by components/qty_stepper.html (catalogue/detail, JS-driven) and by the
   cart (plain links). The catalogue <a> tags carry ONLY class="plusone_to_prod"
   / "minusone_to_prod" (custom.js exact-match rule), so they are styled via
   the wrapper. */
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  height: 40px;
  background: var(--sf-surface);
  border: 1.5px solid var(--sf-muted-300);
  border-radius: 0.5rem;
  overflow: hidden;
  vertical-align: middle;
}
.qty-stepper > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  background: var(--sf-muted-100);
  color: var(--sf-brand-700);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .12s;
}
.qty-stepper > a:hover { background: var(--sf-brand-100); }
.qty-stepper > a:focus-visible { outline: 2px solid var(--sf-brand-300); outline-offset: -2px; }
.qty-stepper > input,
.qty-stepper > span {
  width: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-inline: 1px solid var(--sf-muted-200);
  border-radius: 0;
  background: transparent;
  color: var(--sf-ink);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  direction: ltr;
}
.qty-stepper > input { -moz-appearance: textfield; appearance: textfield; display: block; line-height: 37px; }
.qty-stepper > input::-webkit-outer-spin-button,
.qty-stepper > input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper > input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--sf-brand-300); }

/* ---- "N in cart" badge (#prodBadge{id}) -------------------------------------
   custom.js replaces the span's text with the bare number; the caption comes
   from data-label so it survives. */
.sf-incart::after { content: " " attr(data-label); font-weight: 600; }

/* ---- jQuery UI autocomplete (#search-dropdown) ---------------------------- */
.ui-autocomplete {
  z-index: 300 !important;              /* above the sticky nav (z-100) */
  min-width: min(520px, 92vw);
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  background: var(--sf-surface);
  border: 1px solid var(--sf-muted-300);
  border-radius: 0.5rem;
  box-shadow: var(--sf-shadow);
  font-family: inherit;
  font-size: 14px;
}
.ui-autocomplete .ui-menu-item { margin: 0; }
.ui-autocomplete .ui-menu-item-wrapper {
  padding: 8px 12px;
  margin: 0;
  border: 0;
  border-radius: 0.375rem;
  color: var(--sf-ink);
  font-family: var(--sf-mono);
  font-size: 13px;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  cursor: pointer;
}
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
  margin: 0;
  border: 0;
  background: var(--sf-brand-50);
  color: var(--sf-brand-700);
  font-weight: 700;
}
.ui-helper-hidden-accessible { display: none; }

/* ---- jquery-confirm "added to cart" popup → toast --------------------------
   custom.js calls $.alert({ boxWidth:'30%', type:'green', useBootstrap:false }).
   JS can't change, so the inline width and the green type are overridden. */
.jconfirm .jconfirm-cell { vertical-align: top; }
.jconfirm .jconfirm-box-container {
  width: auto !important;
  min-width: 300px;
  max-width: 92vw;
  margin: 84px auto 0;
}
.jconfirm .jconfirm-box,
.jconfirm .jconfirm-box.jconfirm-type-green {
  width: auto !important;
  min-width: 300px;
  max-width: 92vw;
  padding: 14px 16px 12px;
  border-radius: 0.75rem;
  border: 1px solid var(--sf-muted-200);
  border-top: 1px solid var(--sf-muted-200);
  border-inline-start: 4px solid var(--sf-success-text);
  box-shadow: var(--sf-shadow);
  background: var(--sf-surface);
  font-family: inherit;
}
.jconfirm .jconfirm-box div.jconfirm-title-c {
  padding-bottom: 2px;
  font-size: 15px;
  font-weight: 800;
  color: var(--sf-ink);
}
.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title { font-weight: 800; }
.jconfirm .jconfirm-box div.jconfirm-content-pane { margin-bottom: 8px; }
.jconfirm .jconfirm-box div.jconfirm-content { color: var(--sf-muted-600); font-size: 13px; }
.jconfirm .jconfirm-box .jconfirm-buttons { float: none; text-align: end; padding: 0; }
.jconfirm .jconfirm-box .jconfirm-buttons button {
  margin: 0;
  padding: 6px 14px;
  border-radius: 0.5rem;
  background: var(--sf-success-bg);
  color: var(--sf-success-text);
  font-weight: 700;
  font-size: 12px;
  text-transform: none;
}
.jconfirm .jconfirm-box .jconfirm-buttons button:hover { background: var(--sf-brand-100); color: var(--sf-brand-700); }
.jconfirm.jconfirm-white .jconfirm-bg,
.jconfirm.jconfirm-light .jconfirm-bg { background-color: rgba(17,24,39,.25); }

/* ---- Misc ----------------------------------------------------------------- */
/* Codes / references rendered inside RTL text stay readable (used with dir="ltr"). */
[dir="ltr"] { unicode-bidi: isolate; }
/* Hide the native clear button so the search field keeps one visual style. */
#search-dropdown::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---- Product list: List / Blocks switch -------------------------------------
   product/base.html renders ONE set of cards (custom.js needs unique qty{id} /
   addProduct hooks); "Blocks" only changes the layout. html.sf-view-grid is set
   from localStorage('sf_view') by core/index.html (early) and product/base.html.
   Blocks show: image, name (2 lines), code, stock, price/discount, qty + add.
   Hidden in blocks: equivalents, brand/category chips (.sf-hide-in-grid). */
.sf-view-btn { color: var(--sf-ink); }
.sf-view-btn:hover { background: var(--sf-brand-50); color: var(--sf-brand-700); }
.sf-view-btn[aria-pressed="true"],
.sf-view-btn[aria-pressed="true"]:hover { background: var(--sf-brand-600); color: #fff; }

.sf-view-grid #sf-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
@media (min-width: 768px)  { .sf-view-grid #sf-results { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .sf-view-grid #sf-results { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .sf-view-grid #sf-results { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.sf-view-grid #sf-results > * { margin-top: 0 !important; }            /* cancel space-y-3 */
.sf-view-grid #sf-results > :not(.sf-card) { grid-column: 1 / -1; }     /* empty state spans the row */

.sf-view-grid .sf-card { padding: .6rem !important; display: flex; flex-direction: column; }
.sf-view-grid .sf-card-grid { display: flex !important; flex-direction: column; gap: .5rem !important; flex: 1 1 auto; }
.sf-view-grid .sf-card-img { width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; }
.sf-view-grid .sf-hide-in-grid { display: none !important; }
.sf-view-grid .sf-card-name {
  font-size: 14px !important;
  line-height: 1.25 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.sf-view-grid .sf-card-actions {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: .5rem !important;
  margin-top: auto;
  border-top: 1px solid var(--sf-muted-200) !important;
  padding-top: .5rem !important;
}
.sf-view-grid .sf-card .sf-price > span:last-child { font-size: 19px !important; }
.sf-view-grid .sf-card-buy { flex-wrap: wrap; }
.sf-view-grid .sf-card-buy .qty-stepper { display: flex; flex: 1 1 100%; }
.sf-view-grid .sf-card-buy .qty-stepper > input { flex: 1 1 auto; width: auto; min-width: 0; }
.sf-view-grid .sf-card-buy button[name="addProduct"] { flex: 1 1 100%; justify-content: center; }

/* ---- Picture zoom (components/zoom_dialog.html) ------------------------------
   .sf-zoom-btn: round magnifier on product thumbnails / product page picture.
   #sf-zoom: native <dialog> showing the picture; any click or Esc closes it. */
.sf-zoom-btn {
  position: absolute;
  bottom: 4px;
  inset-inline-end: 4px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .94);
  color: var(--sf-brand-700);
  border: 1px solid var(--sf-muted-300);
  box-shadow: var(--sf-shadow);
  font-size: 12px;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.sf-zoom-btn:hover,
.sf-zoom-btn:focus-visible { background: var(--sf-brand-600); color: #fff; border-color: var(--sf-brand-600); outline: none; }
.sf-zoom-btn-lg { width: 40px; height: 40px; bottom: 10px; inset-inline-end: 10px; font-size: 16px; }
.sf-view-grid .sf-card-imgwrap { width: 100%; }

.sf-zoom {
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  max-width: min(92vw, 900px);
  max-height: 92vh;
  cursor: zoom-out;
}
.sf-zoom::backdrop { background: rgba(17, 24, 39, .78); }
.sf-zoom img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 900px);
  max-height: 80vh;
  object-fit: contain;
  background: #fff;
  border-radius: .5rem;
}
.sf-zoom-title { margin: .6rem 0 0; color: #fff; font-weight: 700; font-size: 14px; text-align: center; }
.sf-zoom-close {
  position: absolute;
  top: -12px;
  inset-inline-end: -12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: var(--sf-ink);
  box-shadow: var(--sf-shadow);
  cursor: pointer;
}

/* ---- Card actions on phones / in blocks (2026-11-14) -------------------------
   The "N in cart" badge sits next to the price (.sf-card-pricewrap); the buy
   group (.sf-card-buy) wraps to its own line on narrow rows. In blocks the
   buy group spans the card and the "Add" label is shown again. */
.sf-view-grid .sf-card-buy { margin-inline-start: 0 !important; width: 100%; }
.sf-view-grid .sf-card .sf-add-label { display: inline !important; }
