/* ==========================================================================
   Hira Shop — shop.css
   Full shop page: filter sidebar + product grid. Hira navy/blue theme.
   ========================================================================== */

.hsp-wrap {
  --hsp-navy:   #14304f;
  --hsp-blue:   #2f6fed;
  --hsp-teal:   #159bc4;
  --hsp-muted:  #8a97a6;
  --hsp-border: #e6ebf1;
  --hsp-img-bg: #eef3f6;
  --hsp-card-bg:#ffffff;

  --hsp-cols: 3;
  --hsp-cols-tablet: 2;
  --hsp-cols-mobile: 2;
  --hsp-gap: 24px;
  --hsp-sidebar-w: 240px;
  --hsp-img-h: 230px;
  --hsp-card-radius: 14px;
  --hsp-img-radius: 10px;
  --hsp-btn-radius: 8px;

  display: grid;
  grid-template-columns: var(--hsp-sidebar-w) 1fr;
  gap: 32px;
  align-items: start;
  font-family: inherit;
  color: var(--hsp-navy);
  box-sizing: border-box;
}
.hsp-wrap.hsp-no-sidebar { grid-template-columns: 1fr; }
.hsp-wrap *, .hsp-wrap *::before, .hsp-wrap *::after { box-sizing: border-box; }

/* Filter toggle + backdrop are mobile-only; hidden on desktop so they
   never occupy a grid cell. */
.hsp-filter-toggle { display: none; }
.hsp-backdrop { display: none; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.hsp-sidebar {
  background: #ffffff;
  border: 1px solid var(--hsp-border);
  border-radius: 14px;
  padding: 22px 20px;
}
/* Sticky sidebar (desktop only; gated by the .hsp-sticky-sidebar class).
   align-self:start is required for sticky to work inside the CSS grid. */
@media (min-width: 901px) {
  .hsp-wrap.hsp-sticky-sidebar .hsp-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: var(--hsp-sticky-top, 20px);
    align-self: start;
    max-height: calc(100vh - var(--hsp-sticky-top, 20px) - 20px);
    overflow-y: auto;
  }
}
.hsp-sidebar-head {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hsp-navy);
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--hsp-border);
}
.hsp-fgroup { padding: 16px 0; border-bottom: 1px solid var(--hsp-border); }
.hsp-fgroup:last-of-type { border-bottom: none; }
.hsp-fgroup-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hsp-muted);
  margin-bottom: 12px;
}
.hsp-flist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hsp-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: #3a4a5c;
  cursor: pointer;
  line-height: 1.3;
}
.hsp-check input {
  width: 17px; height: 17px;
  accent-color: var(--hsp-blue);
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
.hsp-check:hover { color: var(--hsp-navy); }

.hsp-fgroup-price .hsp-price-val { color: var(--hsp-navy); font-weight: 700; }
.hsp-f-price {
  width: 100%;
  accent-color: var(--hsp-blue);
  margin-top: 4px;
  cursor: pointer;
}
.hsp-clear-filters {
  margin-top: 18px;
  width: 100%;
  padding: 9px;
  background: none;
  border: 1px solid var(--hsp-border);
  border-radius: 8px;
  color: var(--hsp-muted);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.hsp-clear-filters:hover { color: var(--hsp-blue); border-color: var(--hsp-blue); }

/* ── Search bar ──────────────────────────────────────────────── */
.hsp-searchbar { position: relative; margin-bottom: 16px; }
.hsp-searchbar svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--hsp-muted);
  pointer-events: none;
}
.hsp-search {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border: 1.5px solid var(--hsp-border);
  border-radius: 10px;
  font-size: .95rem;
  color: var(--hsp-navy);
  background: #fff;
  outline: none;
  box-sizing: border-box;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.hsp-search::placeholder { color: var(--hsp-muted); }
.hsp-search:focus { border-color: var(--hsp-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.hsp-search::-webkit-search-cancel-button { cursor: pointer; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.hsp-main { min-width: 0; }
.hsp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.hsp-count { font-size: .95rem; color: var(--hsp-muted); min-width: 0; }
.hsp-count b { color: var(--hsp-navy); font-weight: 700; }
.hsp-sortwrap { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--hsp-muted); flex-shrink: 0; white-space: nowrap; }
.hsp-sortwrap span { white-space: nowrap; }
.hsp-sort {
  height: 40px;
  padding: 0 34px 0 14px;
  border: 1.5px solid var(--hsp-border);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--hsp-navy);
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2314304f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  outline: none;
  transition: border-color .2s;
}
.hsp-sort:focus { border-color: var(--hsp-blue); }

/* ── Grid ────────────────────────────────────────────────────── */
.hsp-grid {
  display: grid;
  grid-template-columns: repeat(var(--hsp-cols), minmax(0, 1fr));
  gap: var(--hsp-gap);
}

/* ── Card ────────────────────────────────────────────────────── */
.hsp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--hsp-card-bg);
  border: 1px solid var(--hsp-border);
  border-radius: var(--hsp-card-radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  animation: hsp-fade .4s ease both;
}
.hsp-card:hover {
  border-color: var(--hsp-blue);
  box-shadow: 0 10px 28px rgba(20,48,79,.10);
  transform: translateY(-2px);
}
.hsp-card-link { position: absolute; inset: 0; z-index: 1; }

.hsp-card-media { position: relative; }
.hsp-card-img {
  margin: 0;
  height: var(--hsp-img-h);
  background: var(--hsp-img-bg);
  border-radius: var(--hsp-img-radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.hsp-card-img img { width: 100%; height: 100%; object-fit: contain; display: block; mix-blend-mode: multiply; }

/* Badges */
.hsp-badges { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; gap: 6px; }
.hsp-badges-right { left: auto; right: 10px; }
.hsp-badge {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1;
  color: #fff;
}
.hsp-badge-coa { background: var(--hsp-teal); }
.hsp-badge-low { background: #fdf0d8; color: #b6791f; }
.hsp-badge-out { background: #e6ebf1; color: #8a97a6; }

/* Body */
.hsp-card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 2;
  pointer-events: none;
}
.hsp-card-body a { pointer-events: auto; }
.hsp-card-cat {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--hsp-muted);
  margin-bottom: 6px;
}
.hsp-card-title {
  margin: 0 0 4px;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--hsp-navy);
}
.hsp-card-title a { color: inherit; text-decoration: none; }
.hsp-card-dosage { font-size: .82rem; color: var(--hsp-muted); margin-bottom: 12px; }

.hsp-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 14px;
}
.hsp-card-price { font-size: 1.25rem; font-weight: 800; color: var(--hsp-navy); }
.hsp-card-price del { color: var(--hsp-muted); font-weight: 400; font-size: .85em; margin-right: 4px; }
.hsp-card-price ins { text-decoration: none; }
.hsp-card-stock { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.hsp-card-stock.is-in  { color: #1a9d6b; }
.hsp-card-stock.is-low { color: #c8871d; }
.hsp-card-stock.is-out { color: #d64545; }

.hsp-card-btn {
  display: block;
  text-align: center;
  padding: 12px 16px;
  background: var(--hsp-navy);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--hsp-btn-radius);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.hsp-card-btn:hover { background: var(--hsp-blue); color: #fff; }

/* ── Load more ───────────────────────────────────────────────── */
.hsp-load-wrap { text-align: center; margin-top: 32px; }
.hsp-load-btn {
  padding: 12px 34px;
  background: #fff;
  color: var(--hsp-navy);
  border: 1.5px solid var(--hsp-border);
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.hsp-load-btn:hover { border-color: var(--hsp-blue); color: var(--hsp-blue); }
.hsp-load-btn.is-loading { opacity: .6; pointer-events: none; }
.hsp-no-more { color: var(--hsp-muted); font-size: .85rem; }

.hsp-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--hsp-muted);
  font-size: .95rem;
}
.hsp-grid.is-loading { opacity: .5; transition: opacity .2s; }

@keyframes hsp-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Mobile filter toggle ────────────────────────────────────── */
.hsp-filter-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--hsp-navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 16px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hsp-grid { grid-template-columns: repeat(var(--hsp-cols-tablet), minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hsp-wrap { grid-template-columns: 1fr; gap: 0; }
  .hsp-filter-toggle { display: inline-flex; }
  .hsp-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px; max-width: 88vw;
    border-radius: 0;
    z-index: 99999;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .3s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.2);
  }
  .hsp-wrap.hsp-filters-open .hsp-sidebar { transform: translateX(0); }
  .hsp-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99998;
  }
  .hsp-wrap.hsp-filters-open .hsp-backdrop { display: block; }
}
@media (max-width: 640px) {
  .hsp-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .hsp-sortwrap { justify-content: space-between; }
  .hsp-sort { flex: 1; }
}
@media (max-width: 560px) {
  .hsp-grid { grid-template-columns: repeat(var(--hsp-cols-mobile), minmax(0, 1fr)); gap: 14px; }
  .hsp-card-img { height: calc(var(--hsp-img-h) * .72); }
  .hsp-card-body { padding: 12px 12px 14px; }
  .hsp-card-title { font-size: .98rem; }
  .hsp-card-price { font-size: 1.05rem; }
  .hsp-card-meta { flex-wrap: wrap; row-gap: 2px; }
  .hsp-card-btn { padding: 10px 12px; font-size: .82rem; }
}

/* ==========================================================================
   Theme-override guards
   Raise specificity so host themes can't shrink the search input or recolor
   the filter labels / titles. All scoped under .hsp-wrap.
   ========================================================================== */
.hsp-wrap .hsp-searchbar {
  display: block;
  width: var(--hsp-search-w, 100%);
  max-width: 100%;
  box-sizing: border-box;
}
.hsp-wrap input.hsp-search {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  display: block;
  float: none;
  margin: 0;
  box-sizing: border-box;
}
/* Sidebar text — beat generic theme label/link colours.
   Colour the label (the inner <span> inherits) so the widget's own
   "Option Text Color" control can still override at the same specificity. */
.hsp-wrap .hsp-sidebar-head { color: var(--hsp-navy); }
.hsp-wrap .hsp-fgroup-title { color: var(--hsp-muted); }
.hsp-wrap .hsp-check { color: #3a4a5c; }
.hsp-wrap .hsp-check a { text-decoration: none; color: inherit; }
.hsp-wrap .hsp-check:hover { color: var(--hsp-navy); }
/* Card text — beat theme heading/link colours */
.hsp-wrap .hsp-card-cat { color: var(--hsp-muted); }
.hsp-wrap .hsp-card-title,
.hsp-wrap .hsp-card-title a { color: var(--hsp-navy); text-decoration: none; }
.hsp-wrap .hsp-card-price { color: var(--hsp-navy); }
.hsp-wrap .hsp-card-btn { color: #fff; text-decoration: none; }
.hsp-wrap .hsp-card-btn:hover { color: #fff; }
/* Sort select — keep it from inheriting theme input width */
.hsp-wrap select.hsp-sort { max-width: 100%; box-sizing: border-box; }

/* ── Category links (link mode) ───────────────────────────────── */
.hsp-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
  font-size: .9rem;
  color: #3a4a5c;
  text-decoration: none;
  line-height: 1.35;
  transition: color .15s;
}
.hsp-cat-link:hover { color: var(--hsp-blue); }
.hsp-cat-link.is-active { color: var(--hsp-blue); font-weight: 700; }
.hsp-cat-count { color: var(--hsp-muted); font-size: .82rem; flex-shrink: 0; }
.hsp-cat-link:hover .hsp-cat-count { color: var(--hsp-blue); }
