:root{
  --blue:#1987e6;
  --blue-dark:#1678c9;
  --row-alt:#eef6ff;
  --border:#e6e8ee;
  --text:#111827;
  --muted:#6b7280;
  --modal-dim: rgba(0,0,0,0.55);
}

*{ box-sizing:border-box; }
html,body{ height:100%; width:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:#fff;
}

/* Layout */
.site-header{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:112px;
  padding:12px 72px;
  background:#000;
}
.site-logo-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:0;
}
.site-logo{
  display:block;
  width:88px;
  height:88px;
  object-fit:contain;
}

main{ max-width:1200px; margin:0 auto; padding:24px 16px 56px; }
section{ margin:18px 0 26px; }
section > header{ text-align:center; margin:10px 0 14px; }
section > header h2{ margin:0; font-size:34px; font-weight:800; letter-spacing:-0.02em; }
section > header p{ margin:6px 0 0; color:var(--muted); }

a{ color:var(--blue); }
a:hover{ color:var(--blue-dark); }

/* Search form */
form{ margin:0 auto; }
form .card, .search-card{
  width:min(520px, 92vw);
  margin:0 auto;
  padding:22px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  box-shadow:0 6px 18px rgba(17,24,39,0.06);
}
form label{ display:block; font-weight:700; margin:14px 0 8px; }
form input[type="text"], form input[type="url"], form input[type="search"], form select{
  width:100%;
  border:1px solid var(--border);
  border-radius:8px;
  padding:12px 14px;
  font-size:16px;
  outline:none;
  background:#fff;
}
form input:focus, form select:focus{
  border-color: rgba(25,135,230,0.55);
  box-shadow: 0 0 0 3px rgba(25,135,230,0.15);
}
/* Checkbox row for: <label><input type="checkbox"> Show Available Only</label> */
form label:has(> input[type="checkbox"]){
  display:flex; align-items:center; gap:10px; font-weight:700; margin-top:12px;
}
form label:has(> input[type="checkbox"]) > input[type="checkbox"]{
  width:18px; height:18px; margin:0; flex:0 0 auto;
}
form button, form input[type="submit"], .btn{
  display:block;
  margin:18px auto 0;
  padding:16px 36px;
  font-size:20px;
  font-weight:800;
  color:#fff;
  background:var(--blue);
  border:0;
  border-radius:8px;
  cursor:pointer;
  box-shadow:0 10px 18px rgba(25,135,230,0.18);
}
form button:hover, form input[type="submit"]:hover{ background:var(--blue-dark); }

/* Tables */
.wide-table{ margin:0 auto; }
.table-scroll{ overflow-x:auto; }
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border:1px solid var(--border);
  border-radius:8px;
  overflow:hidden;
  background:#fff;
}
thead th{
  background:var(--blue);
  color:#fff;
  font-weight:800;
  padding:12px 14px;
  font-size:16px;
  white-space:nowrap;
  vertical-align:middle;
}
thead th a{ color:#fff !important; text-decoration:none; }
thead th a:hover{ text-decoration:underline; }
tbody td{
  padding:12px 14px;
  vertical-align:middle;
  border-top:1px solid rgba(230,232,238,0.75);
  font-size:16px;
  word-break:normal;
  overflow-wrap:normal;
}
tbody tr:nth-child(even) td{ background:var(--row-alt); }
.product-link{ font-weight:700; text-decoration:underline; }
.sku-cell{ font-weight:700; word-break:normal; overflow-wrap:normal; }
td.store-cell, td.region-cell{ white-space:normal; word-break:keep-all; overflow-wrap:normal; }
td.wrap-soon{ white-space:normal; }

/* Search results alignment: center all except Product */
.wide-table table thead th{ text-align:center; }
.wide-table table thead th:first-child{ text-align:left; }
.wide-table table tbody td{ text-align:center; }
.wide-table table tbody td:first-child{ text-align:left; }
.wide-table table thead th:nth-child(4),
.wide-table table tbody td:nth-child(4){ text-align:center; white-space:nowrap; }
.wide-table table tbody td:nth-child(3){ white-space:nowrap; }
.wide-table table tbody td:nth-child(5),
.wide-table table tbody td:nth-child(6){
  white-space:normal; word-break:keep-all; overflow-wrap:normal;
}
.pic-cell{ text-align:center; width:44px; }

/* Trending: center everything */
section article table thead th,
section article table tbody td{ text-align:center; vertical-align:middle; }

/* Pagination: Prev left, status center, Next right */
.pager{
  width:100%;
  max-width:1200px;
  margin:14px auto;
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:10px;
}
.pager > :first-child{ justify-self:start; text-align:left; }
.pager .status{ justify-self:center; text-align:center; color:var(--muted); font-weight:700; }
.pager > :last-child{ justify-self:end; text-align:right; }
.pager a{ font-weight:800; text-decoration:none; white-space:nowrap; }
.pager a:hover{ text-decoration:underline; }

details{ max-width:1200px; margin:18px auto 0; }
summary{ cursor:pointer; font-weight:800; }

/* Image modal */
.ui-preview{ position:relative; }
.img-toggle{
  position:absolute;
  opacity:0;
  pointer-events:none;
}

body:has(.img-toggle:checked){ overflow:hidden; }

.img-modal{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index:999999 !important;
  background: var(--modal-dim) !important;
}
.img-toggle:checked ~ .img-modal{ display:flex; }

.img-modal .backdrop{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  background: transparent !important;
  cursor: zoom-out;
  z-index:0;
}

.img-modal .box{
  position:relative;
  z-index:1;
  background:#fff;
  border-radius:14px;
  box-shadow:0 18px 60px rgba(0,0,0,0.35);
  max-width:min(92vw, 1100px);
  max-height:92vh;
  overflow:hidden;
  padding-bottom: 84px;
}

.img-modal .box img.gallery-img{
  display:block;
  max-width: 92vw;
  max-height: calc(92vh - 84px);
  width:auto;
  height:auto;
  margin:0 auto;
  cursor: zoom-out;
}

.img-modal .close{
  position:absolute;
  top:10px;
  right:10px;
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background: rgba(255,255,255,0.92);
  box-shadow:0 6px 18px rgba(0,0,0,0.18);
  z-index:3;
  cursor:pointer;
  color: #111827;
}

.gallery-bar{
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  bottom:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  z-index:2;
}

.gallery-prev,
.gallery-next{
  width: 52px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(17,24,39,0.12);
  background: rgba(255,255,255,0.95);
  color: transparent;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  position: relative;
}
.gallery-prev:hover,
.gallery-next:hover{ background:#fff; }

.gallery-prev.is-hidden,
.gallery-next.is-hidden{
  visibility: hidden;
  pointer-events: none;
}

.gallery-prev:disabled,
.gallery-next:disabled{
  opacity:0.45;
  cursor:default;
}

.gallery-count{
  font-weight:700;
  color:var(--muted);
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(17,24,39,0.10);
  border-radius:999px;
  padding: 8px 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.ui-preview-trigger{ cursor:pointer; }
small{ color:var(--muted); }
.center{ text-align:center; }

.gallery-prev::before,
.gallery-next::before{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #111827;
  font-size: 28px;
  line-height: 1;
  transform: translateY(-1px);
}

.gallery-prev::before{ content: "‹"; }
.gallery-next::before{ content: "›"; }

/* Dark mode */
body.dark{
  background:#0b1220;
  color:#e5e7eb;
}
body.dark main{ color:#e5e7eb; }

body.dark a{ color:#60a5fa; }
body.dark a:hover{ color:#93c5fd; }

body.dark form .card,
body.dark .search-card{
  background:#0f172a;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
body.dark form input[type="text"],
body.dark form input[type="url"],
body.dark form input[type="search"],
body.dark form select{
  background:#0b1220;
  color:#e5e7eb;
  border-color: rgba(255,255,255,0.12);
}
body.dark form input:focus,
body.dark form select:focus{
  border-color: rgba(96,165,250,0.65);
  box-shadow: 0 0 0 3px rgba(96,165,250,0.18);
}

body.dark table{
  background:#0f172a;
  border-color: rgba(255,255,255,0.10);
}
body.dark thead th{ background:#1678c9; }
body.dark tbody td{ border-top-color: rgba(255,255,255,0.08); }
body.dark tbody tr:nth-child(even) td{ background: rgba(255,255,255,0.03); }

body.dark .pager .status{ color: rgba(229,231,235,0.75); }
body.dark summary{ color:#e5e7eb; }
body.dark .img-modal{ background: rgba(0,0,0,0.65) !important; }
body.dark .img-modal .box{ background:#fff; }
body.dark .img-modal .close{ background: rgba(255,255,255,0.92); }

.site-header #themeToggle{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000000;
}

.theme-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:5px 10px 5px 6px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  line-height:1;
  cursor:pointer;
  user-select:none;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(17,24,39,0.75);
  color:#e5e7eb;
  box-shadow:0 8px 20px rgba(0,0,0,0.20);
}
.theme-toggle:hover{ background: rgba(17,24,39,0.90); }
.site-header .theme-toggle:active{ transform: translateY(calc(-50% + 1px)); }

.theme-toggle-icon{
  display:inline-grid;
  place-items:center;
  width:24px;
  height:24px;
  border-radius:999px;
  background:rgba(255,255,255,0.14);
  color:#fde68a;
  font-size:15px;
  font-weight:900;
  line-height:1;
}

.theme-toggle-label{
  min-width:34px;
  text-align:left;
}

body:not(.dark) .theme-toggle{
  background: rgba(255,255,255,0.92);
  color:#111827;
  border-color: rgba(17,24,39,0.18);
  box-shadow:0 8px 20px rgba(0,0,0,0.10);
}
body:not(.dark) .theme-toggle:hover{ background:#fff; }

body:not(.dark) .theme-toggle-icon{
  background:#111827;
  color:#e0f2fe;
}

.suggest-store-form {
  width: 100%;
}

.suggest-store-label {
  display: block;
  width: 100%;
  text-align: center;
}

.suggest-store-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
}

.search-form label {
  display: block;
  width: 100%;
}

.search-form .search-field {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.search-form input.search-field {
  -webkit-appearance: none;
  appearance: none;
}

.copyright-notice {
  display: block;
  padding: 16px;
  box-sizing: border-box;
}
