/* ===========================================================
   CODESPHERE PAYBILL — OFFERS / ADS PAGE
   -----------------------------------------------------------
   Reuses the global design tokens and shell classes from
   dashboard.css. This file replaces three overlapping drafts
   that had accumulated (duplicate .cs-ads-* rules, two
   different unused .cs-print-sticker* systems) — everything
   below is the single, current version of each class.

   Brand palette:
     --cs-brand-600  ≈ #0066FF
     --cs-brand-700  ≈ #0639C7
     --cs-ink-950    ≈ #0B1F3B
   =========================================================== */


/* ===========================================================
   PAGE CONTENT
   =========================================================== */

.cs-ads-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 6px 4px 20px;
  min-width: 0;
}

@media (min-width: 640px) {
  .cs-ads-content {
    gap: 22px;
    padding: 10px 8px 24px;
  }
}

@media (min-width: 1024px) {
  .cs-ads-content {
    gap: 24px;
    padding: 4px 12px 28px;
  }
}


/* ===========================================================
   HEADER
   =========================================================== */

.cs-ads-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cs-ads-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--cs-ink-950);
}

.cs-ads-subtitle {
  max-width: 650px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--cs-slate-600);
}

@media (min-width: 640px) {
  .cs-ads-title {
    font-size: 27px;
  }
  .cs-ads-subtitle {
    font-size: 13.5px;
  }
}


/* ===========================================================
   FEATURED LIPA NA CODESPHERE HERO
   =========================================================== */

.cs-ads-featured {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  border-radius: var(--cs-radius-lg);
  background-color: var(--cs-ink-950);
  background-size: cover;
  background-position: center;
  color: var(--cs-white);
  box-shadow: 0 12px 30px rgba(11, 31, 59, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cs-ads-featured::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 280px;
  height: 280px;
  right: -90px;
  bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 182, 255, 0.55) 0%, rgba(10, 132, 255, 0.2) 40%, transparent 72%);
  pointer-events: none;
}

.cs-ads-featured::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(135deg, rgba(11, 31, 59, 0.2) 0%, rgba(6, 57, 199, 0.18) 45%, rgba(10, 132, 255, 0.12) 100%);
  pointer-events: none;
}

.cs-ads-featured-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(56, 182, 255, 0.95), rgba(0, 102, 255, 0.95));
  color: var(--cs-white);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.3);
}

.cs-ads-featured-eyebrow {
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.cs-ads-featured-title {
  max-width: 650px;
  margin: 0;
  font-family: var(--cs-font-display);
  font-weight: 800;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--cs-white);
}

.cs-ads-featured-desc {
  max-width: 620px;
  margin: 10px 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.84);
}

.cs-ads-featured-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--cs-radius-pill);
  background: linear-gradient(135deg, #38b6ff 0%, #0a84ff 48%, #0066ff 100%);
  color: var(--cs-white);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.32);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.cs-ads-featured-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 25px rgba(0, 102, 255, 0.38);
  filter: brightness(1.04);
}

.cs-ads-featured-cta:active {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .cs-ads-featured {
    min-height: 300px;
    padding: 30px;
  }
}

@media (min-width: 1024px) {
  .cs-ads-featured {
    min-height: 320px;
    padding: 34px;
  }
  .cs-ads-featured-title {
    max-width: 720px;
  }
}


/* ===========================================================
   PRINTABLE STICKER — canvas-generated image
   =========================================================== */

.cs-sticker-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--cs-cloud-200);
  border-radius: var(--cs-radius-lg);
  background: var(--cs-white);
  box-shadow: 0 8px 24px rgba(11, 31, 59, 0.06);
}

.cs-sticker-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cs-sticker-eyebrow {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-brand-600);
}

.cs-sticker-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--cs-ink-950);
}

.cs-sticker-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--cs-slate-600);
}

.cs-sticker-download-btn {
  flex: none;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--cs-brand-600);
  border-radius: var(--cs-radius-pill);
  background: var(--cs-brand-600);
  color: var(--cs-white);
  font-family: var(--cs-font-display);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.cs-sticker-download-btn:hover {
  background: var(--cs-brand-700);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 102, 255, 0.2);
}

.cs-sticker-download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.cs-sticker-download-btn:focus-visible {
  outline: 2px solid var(--cs-brand-600);
  outline-offset: 2px;
}

/*
 * The artwork host: shows a loading/error message while the canvas
 * generates, then holds the final <img> once ready. min-height keeps
 * the layout stable (avoids a big jump) while the real image's
 * intrinsic dimensions aren't known yet.
 */

.cs-sticker-artwork-host {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--cs-cloud-100), var(--cs-white));
}

.cs-sticker-artwork-host--loading,
.cs-sticker-artwork-host--error {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.cs-sticker-loading-text {
  font-size: 12.5px;
  color: var(--cs-slate-600);
  max-width: 320px;
  line-height: 1.5;
}

.cs-sticker-artwork-host--error .cs-sticker-loading-text {
  color: var(--cs-coral-500);
}

.cs-sticker-generated-image {
  display: block;
  width: 100%;
  height: auto;
}

.cs-sticker-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--cs-radius-md);
  background: var(--cs-cloud-100);
  color: var(--cs-slate-600);
  font-size: 11.5px;
  font-weight: 600;
}

.cs-sticker-note .cs-icon {
  flex: none;
  color: var(--cs-brand-600);
}


/* ===========================================================
   BENEFITS
   =========================================================== */

.cs-ads-benefits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
  background: var(--cs-white);
  border: 1px solid var(--cs-cloud-200);
  border-radius: var(--cs-radius-lg);
  box-shadow: 0 4px 14px rgba(11, 31, 59, 0.04);
}

.cs-ads-benefit {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border-radius: var(--cs-radius-md);
  background: var(--cs-cloud-100);
  color: var(--cs-slate-600);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
}

.cs-ads-benefit-icon {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.1);
  color: var(--cs-mint-500, #16a34a);
}

@media (min-width: 640px) {
  .cs-ads-benefits {
    grid-template-columns: repeat(3, 1fr);
  }
  .cs-ads-benefit {
    min-height: 54px;
  }
}


/* ===========================================================
   DIVIDER
   =========================================================== */

.cs-ads-content .cs-divider {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--cs-cloud-200);
}


/* ===========================================================
   CATEGORY FILTER
   =========================================================== */

.cs-category-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 2px 1px 5px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cs-category-scroll::-webkit-scrollbar {
  display: none;
}

.cs-category-pill {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 0 14px;
  border: 1px solid var(--cs-cloud-200);
  border-radius: var(--cs-radius-pill);
  background: var(--cs-white);
  color: var(--cs-slate-600);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cs-category-pill:hover {
  border-color: rgba(0, 102, 255, 0.28);
  color: var(--cs-brand-700);
  background: rgba(10, 132, 255, 0.04);
}

.cs-category-pill.is-active {
  border-color: var(--cs-brand-600);
  background: linear-gradient(135deg, #0a84ff, #0066ff);
  color: var(--cs-white);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}


/* ===========================================================
   OFFER GRID
   =========================================================== */

.cs-ads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .cs-ads-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

.cs-ads-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 250px;
  padding: 18px;
  background: var(--cs-white);
  border: 1px solid var(--cs-cloud-200);
  border-radius: var(--cs-radius-lg);
  box-shadow: 0 3px 12px rgba(11, 31, 59, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.cs-ads-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 102, 255, 0.18);
  box-shadow: 0 10px 24px rgba(11, 31, 59, 0.075);
}

.cs-ads-card[hidden] {
  display: none;
}

.cs-ads-card-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 182, 255, 0.12), rgba(10, 132, 255, 0.1));
  color: var(--cs-brand-700);
  border: 1px solid rgba(10, 132, 255, 0.08);
}

.cs-ads-card-eyebrow {
  margin-bottom: 5px;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 750;
  color: var(--cs-brand-700);
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.cs-ads-card-title {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.015em;
  color: var(--cs-ink-950);
}

.cs-ads-card-desc {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--cs-slate-600);
}

.cs-ads-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 11px 0 0;
  border: 0;
  background: transparent;
  color: var(--cs-brand-600);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: color 0.15s ease, gap 0.15s ease;
}

.cs-ads-card-cta:hover {
  color: var(--cs-brand-700);
  gap: 9px;
}

.cs-ads-card-terms {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--cs-cloud-200);
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--cs-slate-400);
}


/* ===========================================================
   ERROR STATE
   =========================================================== */

.cs-error-state {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  background: var(--cs-white);
  border: 1px solid var(--cs-cloud-200);
  border-radius: var(--cs-radius-lg);
}

.cs-error-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--cs-brand-700);
}

.cs-error-state h2 {
  margin: 0;
  font-family: var(--cs-font-display);
  font-size: 18px;
  font-weight: 750;
  color: var(--cs-ink-950);
}

.cs-error-state p {
  max-width: 430px;
  margin: 7px 0 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--cs-slate-600);
}

.cs-error-retry {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: var(--cs-radius-pill);
  background: linear-gradient(135deg, #38b6ff, #0066ff);
  color: var(--cs-white);
  font-family: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 102, 255, 0.2);
}

.cs-error-retry:hover {
  filter: brightness(1.04);
}


/* ===========================================================
   KEYBOARD ACCESSIBILITY
   =========================================================== */

.cs-ads-featured-cta:focus-visible,
.cs-category-pill:focus-visible,
.cs-ads-card-cta:focus-visible,
.cs-error-retry:focus-visible {
  outline: 2px solid var(--cs-brand-600);
  outline-offset: 3px;
}


/* ===========================================================
   PRINT
   -----------------------------------------------------------
   Optional fallback for people who still want to physically
   print rather than download the PNG. Since the sticker is now
   a single generated <img>, "one page only" falls out for free
   — there's nothing else on the page to overflow or misalign.
   =========================================================== */

@media print {
  body * {
    visibility: hidden !important;
  }

  .cs-sticker-artwork-host,
  .cs-sticker-artwork-host * {
    visibility: visible !important;
  }

  .cs-sticker-artwork-host {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
  }

  .cs-sticker-generated-image {
    width: 100% !important;
    height: auto !important;
  }

  @page {
    size: A4 landscape;
    margin: 10mm;
  }
}


/* ===========================================================
   REDUCED MOTION
   =========================================================== */

@media (prefers-reduced-motion: reduce) {
  .cs-ads-featured,
  .cs-ads-featured-cta,
  .cs-category-pill,
  .cs-ads-card,
  .cs-ads-card-cta,
  .cs-sticker-download-btn {
    transition: none;
  }

  .cs-ads-card:hover,
  .cs-ads-featured-cta:hover,
  .cs-sticker-download-btn:hover {
    transform: none;
  }

  .cs-category-scroll {
    scroll-behavior: auto;
  }
}


/* ===========================================================
   VERY SMALL SCREENS
   =========================================================== */

@media (max-width: 380px) {
  .cs-ads-content {
    gap: 16px;
  }

  .cs-ads-title {
    font-size: 21px;
  }

  .cs-ads-featured {
    min-height: 260px;
    padding: 20px;
  }

  .cs-ads-featured-desc {
    font-size: 12px;
  }

  .cs-ads-card {
    min-height: 235px;
    padding: 16px;
  }

  .cs-sticker-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cs-sticker-download-btn {
    width: 100%;
    justify-content: center;
  }
}