/* ==========================================================================
   COUPON BASE STRUCTURE CSS
   Shared file used on ALL sites.
   This file contains ONLY structure: flex, spacing, sizing.
   No colors, backgrounds, borders, shadows, or specific fonts —
   all of that belongs in each site's own customization file.

   Exception: the pager (.cmng-pagination*) carries its bundled default
   appearance (colors, borders) because a fresh install has no per-site CSS.
   ========================================================================== */

/* Wrapper for the coupon block — the shortcode outputs 1..N coupons here */
.coupons-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;                 /* can be overridden in a site theme */
  width: 100%;
  box-sizing: border-box;
}

/*
  A single coupon = an <a> link, the entire card is clickable.

  Responsive logic (no media queries, no JS):
  - flex-basis: 33.333% minus a share of the gap → in a wide container
    this results in exactly 3 coupons per row
  - min-width: 200px → if 3 coupons at 200px+ each don't fit, flexbox
    wraps the third one to a new line → results in 2 per row
  - if even 2 don't fit — results in 1 per row, stretched to full width
  - flex-grow: 1 → when there are fewer coupons in a row than the max,
    they stretch to fill the available space (maximum size)
*/
.coupon {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;

  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: calc(33.333% - 16px * 2 / 3);
  min-width: 250px;

  text-decoration: none;     /* reset link underline */
  color: inherit;            /* reset link color, theme decides it */
  cursor: pointer;
}

.coupon * {
  box-sizing: border-box;
}

/* Each info block of the coupon — just a row/cell inside the column */
.coupon-bonus-type,
.coupon-brand,
.coupon-label,
.coupon-offer,
.coupon-subtitle,
.coupon-details,
.coupon-date,
.coupon-game-name,
.coupon-players-types,
.coupon-code,
.coupon-cta {
  display: block;
  width: 100%;
}

/* Coupon code row — label + the code itself side by side */
.coupon-code {
  display: flex;
  align-items: center;
  gap: 4px;
}

.coupon-code-value {
  display: inline-block;
}

/* Call-to-action button — by default just a full-width block */
.coupon-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ==========================================================================
   FILTER BAR + PAGINATION STRUCTURE
   Inserted by coupons-filter.js inside .coupons-wrapper.
   These rules keep the bar and pager on their own rows and centered.
   ========================================================================== */

/* Filter bar sits above the coupon grid */
.coupons-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* Each dropdown field — width grows with the selected option */
.coupons-filter-field {
  min-width: 180px;
  width: max-content;
}

.coupons-filter-field select,
.coupons-filter-field .ss-main {
  width: 100%;
  white-space: nowrap;
}

/* Pager sits below the coupon grid, centered.
   Its default appearance lives here (this is the file's one exception to the
   structure-only rule). :where() keeps specificity at plain-class level so a
   saved .cmng-pagination-button rule printed later wins on cascade order. */
:where(.coupons-wrapper) .cmng-pagination {
  display: flex;
  justify-content: center;
  width: 100%;
}

:where(.coupons-wrapper) .cmng-pagination-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

:where(.coupons-wrapper) .cmng-pagination-item {
  display: inline-block;
}

:where(.coupons-wrapper) .cmng-pagination-button {
  padding: 0;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid #e5e5e5;
  background-color: #fff;
  color: #7f8c8d;
  user-select: none;
}

:where(.coupons-wrapper) .cmng-pagination-button:focus:not(:focus-visible) {
  outline: none;
}

:where(.coupons-wrapper) .cmng-pagination-button:focus-visible {
  outline: 2px solid #2c3e50;
  outline-offset: 2px;
}

:where(.coupons-wrapper) .cmng-pagination-button:disabled {
  cursor: default;
}

:where(.coupons-wrapper) .cmng-pagination-button.is-active {
  border: none;
  background-color: #2c3e50;
  color: #fff;
}

:where(.coupons-wrapper) .cmng-pagination-arrow {
  line-height: 1;
}

:where(.coupons-wrapper) .cmng-pagination-ellipsis {
  letter-spacing: 1px;
}

:where(.coupons-wrapper) .cmng-pagination-status {
  margin: 0;
}

:where(.coupons-wrapper) .cmng-pagination-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}