/**
 * NOTICE OF LICENSE
 *
 * This file is proprietary software and is not open source.
 * Your subscription grants you a limited, non-transferable right to use this code
 * solely as part of the Retail Media Manager platform, and only for the duration
 * of your valid subscription.
 *
 * @author     Corebuilt Labs <info@corebuilt.com>
 * @copyright  2026 Corebuilt Labs
 * @license    Limited to use within an active subscription to Retail Media Manager
 */

/*
 * RDEV-335 (stsitebuilder 0.8.8): what Element Flow's widgets need once the theme is off.
 *
 * Loaded only on a page a signed-out visitor opens (StSiteBuilder::isThemeOff()), where none of the active
 * theme's stylesheets and scripts are loaded (StSiteBuilder::applyThemeOff()). The page is drawn by Element Flow;
 * this file gives it the few defaults the theme used to give and Element Flow has no setting for.
 *
 * Every rule sits inside :where(), so it has zero specificity: Site Settings (Theme Style, Background, the global
 * colours and fonts), the page's own Style tab and every widget's settings still win. Values come from Element
 * Flow's globals (--e-global-*), with a neutral fallback where a shop has not set them. Signed-in pages never load
 * this file, so nothing here changes the Advertiser Portal.
 *
 * Sections: 1 base, 2 the theme frame's hidden helpers, 3 notifications, 4 dropdowns, 5 form fields, 6 CMS page text,
 * 7 the theme's refusal page.
 */

/* 1. Base: the page's defaults come from Element Flow's globals, not from the browser. */
:where(*, *::before, *::after) {
  box-sizing: border-box;
}

:where(body) {
  margin: 0;
  font-family: var(--e-global-typography-text-font-family, system-ui), sans-serif;
  font-size: var(--e-global-typography-text-font-size, 1rem);
  font-weight: var(--e-global-typography-text-font-weight, 400);
  line-height: var(--e-global-typography-text-line-height, 1.5);
  color: var(--e-global-color-tertiary, var(--e-global-color-text, #212529));
  background-color: #fff;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Markup that carries the hidden attribute stays hidden even where its own class sets a display (as Bootstrap's
 * reboot did; the sign-in card's account picker relies on it). */
:where([hidden]) {
  display: none !important;
}

:where(p) {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Headings: the spacing and the size scale Element Flow's widgets were laid out against, relative to the global
 * Text size. Site Settings › Theme Style › Typography and every widget's own Typography override them. */
:where(h1, h2, h3, h4, h5, h6) {
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

:where(h1) { font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 2); }
:where(h2) { font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 1.5); }
:where(h3) { font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 1.25); }
:where(h4) { font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 1.125); }
:where(h5) { font-size: var(--e-global-typography-text-font-size, 1rem); }
:where(h6) { font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 0.875); }

/* Lists carry no bullets and no indent: Element Flow's menus, breadcrumbs and icon lists are lists. */
:where(ul, ol) {
  margin-top: 0;
  margin-bottom: 1rem;
  padding-left: 0;
  list-style: none;
}

:where(ul ul, ul ol, ol ul, ol ol) {
  margin-bottom: 0;
}

:where(img, svg) {
  vertical-align: middle;
}

:where(img, video) {
  max-width: 100%;
}

:where(label) {
  display: inline-block;
}

:where(button, input, optgroup, select, textarea) {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

:where(button:not(:disabled), [type="button"]:not(:disabled), [type="submit"]:not(:disabled), [role="button"]) {
  cursor: pointer;
}

/* 2. The theme frame's helpers: its layout still prints a skip link, a back-to-top link and a page loader. */
:where(.d-none) {
  display: none !important;
}

:where(.visually-hidden, .visually-hidden-focusable:not(:focus):not(:focus-within)) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:where(.skip-link:focus, .back-to-top-link:focus) {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2000;
  padding: 0.5rem 1rem;
  background-color: #fff;
}

/* 3. Notifications the theme's layout prints (#notifications), e.g. after a contact form is sent. */
:where(#notifications .container) {
  max-width: var(--content-width, 1140px);
  margin: 0 auto;
  padding: 0 1rem;
}

:where(.alert) {
  position: relative;
  margin: 1rem 0;
  padding: 1rem 3rem 1rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

:where(.alert-success) { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; }
:where(.alert-danger) { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
:where(.alert-warning) { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; }
:where(.alert-info) { color: #055160; background-color: #cff4fc; border-color: #b6effb; }

:where(.alert ul) {
  margin-bottom: 0;
}

:where(.alert .btn-close) {
  position: absolute;
  top: 0;
  right: 0;
  padding: 1rem;
  color: inherit;
  background: none;
  border: 0;
  line-height: 1;
}

:where(.alert .btn-close)::before {
  content: "\00d7";
  font-size: 1.25rem;
}

/* 4. Dropdowns (language and currency, account, listing sort): Bootstrap's dropdown, reduced to what Element
 * Flow's widgets use. The widgets' Dropdown menu / Dropdown item settings style it; these are the defaults and
 * the mechanics (hidden until no-theme.js adds .show). */
:where(.dropdown, .dropup, .dropstart, .dropend) {
  position: relative;
}

:where(.dropdown-menu) {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  min-width: 10rem;
  margin: 0.125rem 0 0;
  padding: 0;
  font-size: 1rem;
  color: inherit;
  text-align: left;
  list-style: none;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  border-radius: 0.375rem;
}

:where(.dropdown-menu.show) {
  display: block;
}

:where(.dropdown-menu-right, .dropdown-menu-end) {
  right: 0;
  left: auto;
}

:where(.dropdown-menu-center) {
  left: 50%;
  transform: translateX(-50%);
}

:where(.dropdown-item) {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  clear: both;
  font-weight: 400;
  color: inherit;
  text-align: inherit;
  text-decoration: none;
  white-space: nowrap;
  background-color: transparent;
  border: 0;
}

:where(.dropdown-item:hover, .dropdown-item:focus) {
  background-color: rgba(0, 0, 0, 0.05);
  background-color: color-mix(in srgb, currentColor 8%, transparent);
}

:where(.dropdown-header) {
  display: block;
  margin-bottom: 0;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0.7;
}

:where(.dropdown-divider) {
  height: 0;
  margin: 0.5rem 0;
  overflow: hidden;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
  border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

/* 5. Form fields Element Flow's widgets print with Bootstrap classes (the product variant select). The widget's
 * Dropdowns style settings (width, height, font, colours, border) override these defaults. */
:where(.form-control, .form-select) {
  display: block;
  width: 100%;
  padding: 0.375rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: inherit;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 0.25rem;
  -webkit-appearance: none;
  appearance: none;
}

:where(select.form-control, .form-select) {
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px 10px;
}

:where(.form-control:disabled, .form-select:disabled) {
  opacity: 0.6;
}

/* 6. CMS page text (the CMS content widget, `.stsb_cms_content`). A shop's CMS pages are written for the theme's
 * Bootstrap grid (PrestaShop's own About us: `row`, `col-xs-12 col-sm-4`), which is not loaded here; without it the
 * columns stack. Bootstrap 5's row and columns with the theme's breakpoints (xs 360, sm 576, md 768, lg 992, xl 1200,
 * xxl 1400 px), only inside CMS text. The list bullets are the widget's own setting (Style › List position). */

:where(.stsb_cms_content) :where(.row) {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-0.5 * var(--bs-gutter-x));
  margin-left: calc(-0.5 * var(--bs-gutter-x));
}

:where(.stsb_cms_content) :where(.row > *) {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--bs-gutter-x) * 0.5);
  padding-left: calc(var(--bs-gutter-x) * 0.5);
  margin-top: var(--bs-gutter-y);
}

:where(.stsb_cms_content) :where(.col) { flex: 1 0 0%; }
:where(.stsb_cms_content) :where(.col-auto) { flex: 0 0 auto; width: auto; }
:where(.stsb_cms_content) :where(.col-1) { flex: 0 0 auto; width: 8.33333333%; }
:where(.stsb_cms_content) :where(.col-2) { flex: 0 0 auto; width: 16.66666667%; }
:where(.stsb_cms_content) :where(.col-3) { flex: 0 0 auto; width: 25%; }
:where(.stsb_cms_content) :where(.col-4) { flex: 0 0 auto; width: 33.33333333%; }
:where(.stsb_cms_content) :where(.col-5) { flex: 0 0 auto; width: 41.66666667%; }
:where(.stsb_cms_content) :where(.col-6) { flex: 0 0 auto; width: 50%; }
:where(.stsb_cms_content) :where(.col-7) { flex: 0 0 auto; width: 58.33333333%; }
:where(.stsb_cms_content) :where(.col-8) { flex: 0 0 auto; width: 66.66666667%; }
:where(.stsb_cms_content) :where(.col-9) { flex: 0 0 auto; width: 75%; }
:where(.stsb_cms_content) :where(.col-10) { flex: 0 0 auto; width: 83.33333333%; }
:where(.stsb_cms_content) :where(.col-11) { flex: 0 0 auto; width: 91.66666667%; }
:where(.stsb_cms_content) :where(.col-12) { flex: 0 0 auto; width: 100%; }

@media (min-width: 360px) {
  :where(.stsb_cms_content) :where(.col-xs) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-xs-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-xs-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-xs-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-xs-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-xs-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-xs-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-xs-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-xs-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-xs-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-xs-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-xs-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-xs-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-xs-12) { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 576px) {
  :where(.stsb_cms_content) :where(.col-sm) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-sm-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-sm-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-sm-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-sm-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-sm-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-sm-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-sm-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-sm-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-sm-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-sm-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-sm-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-sm-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-sm-12) { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 768px) {
  :where(.stsb_cms_content) :where(.col-md) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-md-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-md-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-md-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-md-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-md-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-md-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-md-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-md-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-md-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-md-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-md-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-md-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-md-12) { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 992px) {
  :where(.stsb_cms_content) :where(.col-lg) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-lg-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-lg-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-lg-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-lg-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-lg-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-lg-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-lg-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-lg-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-lg-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-lg-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-lg-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-lg-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-lg-12) { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 1200px) {
  :where(.stsb_cms_content) :where(.col-xl) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-xl-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-xl-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-xl-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-xl-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-xl-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-xl-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-xl-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-xl-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-xl-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-xl-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-xl-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-xl-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-xl-12) { flex: 0 0 auto; width: 100%; }
}

@media (min-width: 1400px) {
  :where(.stsb_cms_content) :where(.col-xxl) { flex: 1 0 0%; }
  :where(.stsb_cms_content) :where(.col-xxl-auto) { flex: 0 0 auto; width: auto; }
  :where(.stsb_cms_content) :where(.col-xxl-1) { flex: 0 0 auto; width: 8.33333333%; }
  :where(.stsb_cms_content) :where(.col-xxl-2) { flex: 0 0 auto; width: 16.66666667%; }
  :where(.stsb_cms_content) :where(.col-xxl-3) { flex: 0 0 auto; width: 25%; }
  :where(.stsb_cms_content) :where(.col-xxl-4) { flex: 0 0 auto; width: 33.33333333%; }
  :where(.stsb_cms_content) :where(.col-xxl-5) { flex: 0 0 auto; width: 41.66666667%; }
  :where(.stsb_cms_content) :where(.col-xxl-6) { flex: 0 0 auto; width: 50%; }
  :where(.stsb_cms_content) :where(.col-xxl-7) { flex: 0 0 auto; width: 58.33333333%; }
  :where(.stsb_cms_content) :where(.col-xxl-8) { flex: 0 0 auto; width: 66.66666667%; }
  :where(.stsb_cms_content) :where(.col-xxl-9) { flex: 0 0 auto; width: 75%; }
  :where(.stsb_cms_content) :where(.col-xxl-10) { flex: 0 0 auto; width: 83.33333333%; }
  :where(.stsb_cms_content) :where(.col-xxl-11) { flex: 0 0 auto; width: 91.66666667%; }
  :where(.stsb_cms_content) :where(.col-xxl-12) { flex: 0 0 auto; width: 100%; }
}

/* 7. The theme's refusal page (rmmtheme's errors/forbidden.tpl, RDEV-352): a page PrestaShop refuses (403, or a 404/410
 * with an error) is drawn by the theme's template, not by Element Flow, and it relied on the theme for its column and
 * its two buttons. A centred column as wide as the notice above it, the heading's size, and the buttons in Element
 * Flow's global primary, filled (Sign in, Contact us) and outlined (Back to Home page). */
:where(.page-content--forbidden) {
  max-width: 1140px;
  margin: 0 auto;
  padding: 2rem 16px 4rem;
}

:where(.page-content--forbidden .h2) {
  font-size: calc(var(--e-global-typography-text-font-size, 1rem) * 1.75);
}

:where(.page-content--forbidden .btn) {
  display: inline-block;
  margin: 0.5rem 0.5rem 0 0;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--e-global-color-primary, #1f4788);
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: none;
  text-align: center;
}

/* Not in :where(): Site Settings' link colour (a bare `a` rule) would win over a zero-specificity rule and draw the
 * filled button's text in its own background colour. This is the theme's page, so nothing in Element Flow styles it. */
.page-content--forbidden .btn-primary {
  background-color: var(--e-global-color-primary, #1f4788);
  color: #fff;
}

.page-content--forbidden .btn-outline-primary {
  background-color: transparent;
  color: var(--e-global-color-primary, #1f4788);
}

.page-content--forbidden .btn:hover,
.page-content--forbidden .btn:focus-visible {
  filter: brightness(0.92);
}
