/* Available Coupons v2 — ticket stub design
   See available-coupons-redesign-spec.md Sections 3 & 8.
   Enqueued only on is_product() — do not add to the global bundle. */

.cb-coupons, #coupons_list {
  --cb-page-bg: #f7f8fa;
  --cb-surface: #ffffff;
  --cb-ink: #101820;
  --cb-accent: #FF9E1B;
  --cb-accent-deep: #c47a0a;
  --cb-border: #e8eaee;
  --cb-border-dash: #e3e6ea;
  --cb-muted: #6f7580;
  --cb-stub-muted: #9aa1ab;
  font-family: 'Sora', sans-serif; 
  /*margin: 16px 0;*/
}
.cb-coupons{
  background: var(--cb-page-bg);
  border-radius: 12px;
  padding: 18px;
}
.cb-coupons__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cb-coupons__title { font-size: 14px; font-weight: 600; color: var(--cb-ink); margin: 0; }
.cb-coupons__count { font-size: 12px; color: var(--cb-muted); }

.cb-coupons__grid {
  display: grid;
  /*grid-template-columns: repeat(3, minmax(0, 1fr));*/
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cb-coupon {
  position: relative;
  display: flex;
  /*height: 66px;*/
  background: var(--cb-surface);
  border: 2px solid var(--cb-border) !important;
  border-radius: 8px;
  overflow: hidden;
}
/*.cb-coupon--promoted { border: 2px solid var(--cb-accent); }*/
.cb-coupon:hover,
.cb-coupon:focus{ border: 2px solid var(--cb-accent) !important; transition: all ease-in-out .3s;}

.cb-coupon__body {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cb-coupon__topline .cb-coupon__code-label{ font-size: 11px; color: var(--cb-muted); margin: 3px 0 0; text-transform:uppercase; }
.cb-coupon__topline .cb-coupon__code-label:before{ content:"."; margin-right:3px; }
.cb-coupon__expiry{ font-size: 11px; color: var(--cb-muted); margin: 3px 0 0;  }
.cb-coupon__headline {
  font-size: 14px; font-weight: 600; color: var(--cb-accent-deep);
  line-height: 1.2; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cb-coupon__meta { font-size: 11px; color: var(--cb-muted); margin: 3px 0 0; line-height: 1.4;}
.cb-coupon--promoted .cb-coupon__meta { color: var(--cb-muted); font-weight: 500; }

.cb-coupon__stub {
  flex: none;
  width: 128px;
  background: var(--cb-ink);
  border-left: 2px dashed var(--cb-border-dash) !important;
  padding: 10px 12px !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.cb-coupon__code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: #fff; letter-spacing: .04em; text-align: center; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.51;
}
.cb-coupon__applied {
  font-size: 10.5px; color: var(--cb-stub-muted); text-align: center; line-height: 1.35;
}
.cb-coupon__copy {
  background: var(--cb-accent) !important; color: var(--cb-ink) !important;
  font-family: inherit; font-size: 10.5px; font-weight: 600 !important;
  border: 0; border-radius: 4px !important; padding: 4px 0 !important; width: 100%;
  cursor: pointer; text-transform: uppercase !important; line-height: 2 !important;
}
.cb-coupon__copy:focus-visible { outline: 2px solid var(--cb-ink); outline-offset: 2px; }
.cb-coupon__copy.is-copied { background: #fff; }

/* perforation notches — must match --cb-page-bg exactly */
.cb-coupon::before,
.cb-coupon::after {
  content: '';
  position: absolute;
  right: 122px; /* stub width (128px) minus 6px, per spec 8.x note */
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cb-page-bg);
}
.cb-coupon::before { top: -6px; }
.cb-coupon::after  { bottom: -6px; }

.cb-coupon.is-hidden { display: none !important; }
.cb-coupons.is-expanded .cb-coupon.is-hidden { display: flex !important; }

.cb-coupons__more {
  width: 100%;
  margin-top: 10px;
  background: var(--cb-surface);
  border: 1px solid #dfe2e7;
  border-radius: 6px;
  padding: 9px 0;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--cb-ink);
  cursor: pointer;
}

/* Desktop shows a 4th card (index 3) that mobile keeps collapsed.
   NOTE: when total coupons === 4 this makes the "Show N more" button
   inert on desktop (nothing left to reveal there) while still needed
   on mobile — see cb-coupons.js for the per-breakpoint label, and the
   PHP header comment for why this diverges from the single static
   label shown in the spec's markup-contract example. */
@media (min-width: 768px) {
  .cb-coupon.is-hidden:nth-child(4) { display: flex; }
}

/* Skeleton (Section 5 — reserve height before the REST fetch resolves) */
.cb-coupons--skeleton .cb-coupons__title-skel {
  display: inline-block;
  width: 140px; height: 14px;
  background: var(--cb-border);
  border-radius: 4px;
}
.cb-coupon--skel {
  background: linear-gradient(90deg, var(--cb-surface) 25%, var(--cb-border) 37%, var(--cb-surface) 63%);
  background-size: 400% 100%;
  animation: cb-coupons-shimmer 1.4s ease infinite;
  border: 1px solid var(--cb-border);
}
@keyframes cb-coupons-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

#coupons_list #sc-cc{ padding:0; }

@media (max-width: 767px) {
  .cb-coupons { padding: 14px 12px; }
  .cb-coupons__grid { grid-template-columns: 1fr; gap: 8px; }
  /*.cb-coupon { height: 60px; }*/
  .cb-coupon__stub { width: 112px; padding: 0 10px; }
  .cb-coupon__headline { font-size: 13.5px; }
  .cb-coupon__meta { font-size: 10.5px; }
  .cb-coupon__code { font-size: 10px; }
  .cb-coupon::before, .cb-coupon::after { right: 106px; } /* 112px - 6px */
}
