/* =========================
   ScanWin — retail.css
   -------------------------
   Shared Retail Customer component library. Loaded by every
   retail-customer page (after style.css/responsive.css, before the
   page-specific sheet). Holds the app-shell chrome (store-icon avatar,
   streak pill, mobile search, app footer) plus cross-page components
   reused across Dashboard, Available Campaigns, Analytics, My Uploads,
   My Ratings, etc. (overview cards, filter tabs, status pills,
   list/grid toggle, campaign badge). Retail-specific gamification
   components are appended at the bottom of this file.
========================= */

/* =========================
   Shell chrome
========================= */

/* "Last upload: N days ago" status chip (topbar + mobile header) */
.sw-last-upload {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  background: #f3f4f6;
  border: 1px solid #f3f4f6;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sw-text-muted);
  white-space: nowrap;
  text-decoration: none;
}

/* Store / hierarchy icon — topbar store selector, avatar dropdown,
   mobile drawer chip. Violet rounded square with a store glyph. */
.sw-store-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sw-violet);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sw-store-ico svg {
  width: 16px;
  height: 16px;
}
.sw-store-ico--lg {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.sw-store-ico--lg svg {
  width: 22px;
  height: 22px;
}
/* Circular variant (location table / lists) */
.sw-store-ico--circle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}
.sw-store-ico--circle svg {
  width: 18px;
  height: 18px;
}

/* Mobile-only search bar (figma puts a search above the content on the
   390 frames). Hidden on lg+ where the topbar search takes over. */
.sw-mobile-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  margin-bottom: 16px;
  background: #f3f4f6;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  color: var(--sw-text-faint);
}
.sw-mobile-search svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.sw-mobile-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--sw-text);
}
.sw-mobile-search input::placeholder {
  color: var(--sw-text-faint);
}

@media (max-width: 991.98px) {
  /* Mobile nav makes room for the 12-day streak pill (FR 2.1.3): the
     secondary "Last upload" chip is hidden here (still in desktop topbar). */
  .sw-mobile-nav .sw-last-upload {
    display: none;
  }
  .sw-mobile-nav .sw-streak {
    height: 32px;
    padding: 0 12px;
  }
}

/* =========================
   Page title row (title + sub + action, e.g. Export CSV)
========================= */
.sw-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.sw-page-head__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.44px;
  color: #0f1020;
  margin: 0 0 4px;
}
.sw-page-head__sub {
  font-size: 13px;
  color: var(--sw-text-muted);
  margin: 0;
}
.sw-btn-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: #fff;
  border: 1px solid var(--sw-border-strong);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sw-text);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.sw-btn-export:hover {
  background: #f5f5f7;
  color: var(--sw-text);
}
.sw-btn-export svg {
  width: 16px;
  height: 16px;
}

/* =========================
   Overview stat card (Locations + Uploads)
========================= */
.sw-ov {
  background: #fff;
  border: 1px solid var(--sw-border);
  border-radius: 16px;
  padding: 20px 24px;
  height: 100%;
  box-shadow: 0 1px 2px rgba(15, 16, 32, 0.04);
}
.sw-ov__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.sw-ov__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sw-ov__icon svg {
  width: 18px;
  height: 18px;
}
.sw-ov__icon--violet { background: #eeedfe; color: var(--sw-violet); }
.sw-ov__icon--green  { background: #d1fae5; color: #047857; }
.sw-ov__icon--amber  { background: #fef3c7; color: #b45309; }
.sw-ov__icon--blue   { background: #e0edff; color: #2673f2; }
.sw-ov__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--sw-text-muted);
}
.sw-ov__value {
  font-size: 32px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.64px;
  color: #0f1020;
  margin: 0 0 4px;
}
.sw-ov__cap {
  font-size: 12px;
  color: var(--sw-text-faint);
  margin: 0;
}

/* =========================
   Filter tabs (with counts)
========================= */
.sw-ftabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sw-ftab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--sw-border);
  font-size: 13px;
  font-weight: 500;
  color: var(--sw-text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sw-ftab:hover {
  border-color: var(--sw-border-strong);
}
.sw-ftab.is-active {
  background: var(--sw-violet);
  border-color: var(--sw-violet);
  color: #fff;
}
.sw-ftab__count {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.65;
}
.sw-ftab.is-active .sw-ftab__count {
  opacity: 0.9;
}

/* =========================
   Status pill (Active · Onboarding · Paused · Office)
========================= */
.sw-spill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sw-spill__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sw-spill--active     { background: #d1fae5; color: #047857; }
.sw-spill--active .sw-spill__dot { background: #10b981; }
.sw-spill--onboarding { background: #fef3c7; color: #b45309; }
.sw-spill--onboarding .sw-spill__dot { background: #f59e0b; }
.sw-spill--paused     { background: #eeedfe; color: var(--sw-violet); }
.sw-spill--paused .sw-spill__dot { background: var(--sw-violet); }
.sw-spill--office     { background: #f3f4f6; color: var(--sw-text-muted); }
.sw-spill--office .sw-spill__dot { background: #9ca3af; }

/* =========================
   List / Grid segmented toggle
========================= */
.sw-seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 10px;
}
.sw-seg__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  background: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sw-text-muted);
  cursor: pointer;
  text-decoration: none;
}
.sw-seg__btn.is-active {
  background: #fff;
  color: var(--sw-text);
  box-shadow: 0 1px 2px rgba(15, 16, 32, 0.08);
}
.sw-seg__btn svg {
  width: 16px;
  height: 16px;
}

/* =========================
   Campaign status badge (Hot · NEW · TRENDING · PREMIUM)
   (mirrors campaigns.css .sw-status so merchant pages get the badge
   without loading campaigns.css)
========================= */
.sw-status {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.sw-status--hot {
  background: linear-gradient(90deg, #f59e0a 0%, #ed4545 100%);
  color: #fff;
  letter-spacing: 0.2px;
}
.sw-status--new {
  background: #a3f238;
  color: #0f0f21;
  letter-spacing: 0.8px;
}
.sw-status--trending {
  background: #eeedfe;
  color: var(--sw-violet);
  letter-spacing: 0.8px;
}
.sw-status--premium {
  background: #ddd9fc;
  color: var(--sw-violet);
  letter-spacing: 0.8px;
}

/* "X average" pill (reviews header, etc.) */
.sw-avg-pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  background: var(--sw-violet-50);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sw-violet);
  white-space: nowrap;
}

/* =========================
   Phone overrides (≤575.98px) — figma 390 frames
========================= */
@media (max-width: 575.98px) {
  /* Page head: title/sub stacked, Export becomes a full-width button below */
  .sw-page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .sw-btn-export {
    width: 100%;
    height: 44px;
    justify-content: center;
  }

  /* Overview cards: icon on its own line above the label, value below */
  .sw-ov {
    padding: 16px;
  }
  .sw-ov__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
  }
  .sw-ov__value {
    font-size: 22px;
    white-space: nowrap;
  }
}

/* =========================
   App footer (shared on every merchant page) — figma 1861:969 (desktop) /
   1861:1029 (mobile). Sits at the bottom of the page content.
========================= */
.sw-app-footer {
  gap: 12px;
  font-size: 12px;
  white-space: nowrap;
}
.sw-app-footer__copy {
  margin: 0;
  color: #9ca3af;
}

.sw-app-footer__links a {
  color: #6b6f7b;
  font-weight: 500;
  text-decoration: none;
}
.sw-app-footer__links a:hover {
  color: var(--sw-violet);
}
/* Mobile (figma 1861:1029): centred, links row above the copyright */
@media (max-width: 575.98px) {
  .sw-app-footer {
    gap: 8px;
  }
  .sw-app-footer__links {
    gap: 20px !important; /* mobile 20px is off the utility scale (gap-4) */
  }
}

/* Overview card label with an account-type caption ("for your Location") —
   used on the chain/distributor Our Locations views (figma 2658:936). */
.sw-ov__labeltext { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sw-ov__scope { font-size: 11px; line-height: 1.2; color: var(--sw-text-faint); }

/* =========================
   Retail Customer — shared gamification chrome
   (appended; layered over the merchant-derived shell above)
========================= */

/* Initials avatar — replaces the merchant store-icon in the chrome */
.sw-rc-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c6cf8, #6d28d9);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sw-rc-avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.sw-rc-avatar--sm { width: 32px; height: 32px; font-size: 11px; }

/* Cart button (topbar + mobile nav) — shopping-cart model */
.sw-rc-cart {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--sw-border);
  background: #fff;
  color: var(--sw-text);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-decoration: none;
}
.sw-rc-cart:hover { background: #f5f5f7; color: var(--sw-text); }
.sw-rc-cart svg { width: 19px; height: 19px; }
.sw-rc-cart__count {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--sw-violet); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
@media (max-width: 991.98px) {
  .sw-mobile-nav .sw-rc-cart { width: 34px; height: 34px; }
}

/* ===== Mobile sticky header (figma 2576:2981) ===== */
/* row 1: page title + cart + avatar  ·  row 2: location selector */
.sw-mobile-nav__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.sw-mobile-nav__title { display: flex; flex-direction: column; min-width: 0; }
.sw-mobile-nav__kicker { font-size: 11.5px; color: var(--sw-text-muted); }
.sw-mobile-nav__h { font-size: 20px; font-weight: 700; color: #0f1020; letter-spacing: -0.3px; }
.sw-mobile-nav__right { display: flex; align-items: center; gap: 12px; }
.sw-mobile-nav__avatar { border: 0; background: none; padding: 0; cursor: pointer; line-height: 0; }

/* Location selector — lives in the sticky header; dropdown to change store (figma 2576:2993) */
.sw-rc-storesel { display: none; position: relative; width: 100%; }
.sw-rc-storesel__btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; background: #f3f1fe; border: 1px solid #e6e2fb;
  border-radius: 10px; text-align: left; cursor: pointer;
}
.sw-rc-storesel__pin {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: #fff; color: var(--sw-violet);
  display: inline-flex; align-items: center; justify-content: center;
}
.sw-rc-storesel__pin svg { width: 15px; height: 15px; }
.sw-rc-storesel__text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sw-rc-storesel__kicker { font-size: 9px; font-weight: 700; letter-spacing: 0.5px; color: var(--sw-violet); }
.sw-rc-storesel__name { font-size: 13px; font-weight: 700; color: #0f1020; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-rc-storesel__chev { width: 18px; height: 18px; color: var(--sw-text-muted); flex-shrink: 0; transition: transform .18s; }
.sw-rc-storesel.is-open .sw-rc-storesel__chev { transform: rotate(180deg); }
.sw-rc-storesel__menu {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--sw-border); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 16, 32, 0.16); padding: 6px; display: none;
}
.sw-rc-storesel.is-open .sw-rc-storesel__menu { display: block; }

@media (max-width: 991.98px) {
  /* stack the header into two rows + show the location selector */
  .sw-mobile-nav { flex-direction: column; align-items: stretch; gap: 12px; padding: 12px 16px 14px; }
  .sw-rc-storesel { display: block; }
}

/* Prevent the closed Bootstrap offcanvas drawer (offcanvas-end) from adding a
   few px of horizontal scroll on mobile. `overflow-x: clip` clips the x-axis
   WITHOUT creating a scroll container, so the sticky topbar keeps working and
   the position:fixed drawer still slides in when opened. */
html { overflow-x: clip; }
