/* =========================================================
   Deals Page (Unified "App-Like" Look)
   ========================================================= */

/* Remove generic section padding on the Deals page */
body[data-page-kind="deals"] .section-deals {
  padding-top: 0;
  margin-top: 0;
}

/* Shell width / alignment */
.deals-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Simple header pattern (if needed elsewhere) */
.page-header-simple {
  margin-bottom: 24px;
}
.page-header-simple h1 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}
.page-header-simple .subtitle {
  font-size: 15px;
  color: #64748b;
  margin: 0;
}

/* A11y helper */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   FILTER CHIPS / TOOLBAR
========================================================= */

.deals-toolbar {
  margin-bottom: 12px;
}

.toolbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar-main-compact {
  align-items: center;
  padding-bottom: 12px;
}

/* Left area for the title */
.toolbar-left {
  flex: 1 1 auto;
  min-width: 0;
}

/* Right area: results text + sort dropdown */
.toolbar-controls-sort-only {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* "Showing X results" text */
.results-count {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.toolbar-copy {
  min-width: 220px;
}

.toolbar-title {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 600;
}

.toolbar-subtitle {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* Filter chips (also reused in hero) */
.filter-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.chip:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
  transform: translateY(-1px);
}

.chip.is-active {
  background-color: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

/* Sort dropdown */
.sort-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sort-label {
  font-size: 12px;
  color: #64748b;
}

#dealSort {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 13px;
  font-family: inherit;
}

/* =========================================================
   COUPON-STYLE DEAL CARDS
========================================================= */

.deals-results {
  margin-top: 8px;
}

.deals-grid {
  display: grid;
  gap: 18px;
  justify-content: center;
}

/* 2-column layout for tablet/desktop */
@media (min-width: 768px) {
  .deals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 auto;
  }
}

/* Single column on small screens */
@media (max-width: 767px) {
  .deals-wrap {
    padding: 24px 16px;
  }

  .deals-grid {
    grid-template-columns: 1fr;
  }
}

/* Coupon tile container */
.deal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #fee2e2;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  padding: 14px 16px 10px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.deal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}

/* We don't want a big photo: hide media block */
.card-media {
  display: none;
}

/* Discount “pill” badge */
.discount-tag {
  position: absolute;
  top: 10px;
  right: 14px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Main content row */
.card-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
}

.card-loc {
  font-size: 12px;
  color: #64748b;
}

/* Bottom row – expiry + CTA */
.card-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.expires-text {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.deal-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.price-old {
  font-size: 13px;
  color: #94a3b8;
  text-decoration: line-through;
}

.price-new {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

/* CTA button – “View discount / Get deal” */
.view-btn,
.claim-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, #f97373, #fb7185);
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(248, 113, 113, 0.45);
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.view-btn:hover,
.claim-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 26px rgba(248, 113, 113, 0.6);
  opacity: 0.96;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 0;
  color: #64748b;
}
.empty h3 {
  margin: 0 0 8px 0;
  color: #0f172a;
  font-weight: 700;
}
.empty .muted {
  margin: 0;
}

/* Pager */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
}
.pager-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: #475569;
  transition: background 0.15s, border-color 0.15s;
}
.pager-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.pager-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.pager-status {
  font-size: 14px;
  color: #475569;
}

/* =========================================================
   HERO – Everjoy gradient + pills under search
========================================================= */

body[data-page-kind="deals"] .deals-hero {
  background: #025fbc; /* solid brand blue instead of gradient */
  color: #ffffff;
}

body[data-page-kind="deals"] .deals-hero-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 50px 32px 50px;
  display: flex;
  align-items: flex-start;
}

body[data-page-kind="deals"] .hero-copy {
  position: relative; /* needed for mobile fade overlay */
}

body[data-page-kind="deals"] .deals-hero .eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 4px;
}

body[data-page-kind="deals"] .deals-hero h1 {
  margin: 0 0 4px;
  font-size: 1.9rem;
  line-height: 1.25;
}

body[data-page-kind="deals"] .deals-hero .subtitle {
  margin: 10px 0 12px;
  font-size: 0.9rem;
  opacity: 0.92;
}

/* Search bar */
body[data-page-kind="deals"] .hero-search {
  margin-top: 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(8px);
  padding: 8px 0px 10px;
}

body[data-page-kind="deals"] .hero-search-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Ensure deal UI uses Poppins even if buttons have a different global font */
body[data-page-kind="deals"] .chip,
body[data-page-kind="deals"] .view-btn,
body[data-page-kind="deals"] .claim-btn,
body[data-page-kind="deals"] .discount-tag,
body[data-page-kind="deals"] .deal-card {
  font-family: 'Poppins', sans-serif;
}

body[data-page-kind="deals"] #dealHeroQuery {
  border-radius: 999px;
  border: none;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  min-width: 260px;
}

body[data-page-kind="deals"] .hero-search-text {
  flex: 1 1 auto;
}

body[data-page-kind="deals"] .hero-search-btn {
  border-radius: 999px;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  background: #ffffff;
  color: #025fbc;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

body[data-page-kind="deals"] .hero-search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.32);
}

/* Hero chips (category pills under search) */
body[data-page-kind="deals"] .filter-chips-hero {
  margin-top: 12px;
}

body[data-page-kind="deals"] .filter-chips-hero .chip {
  background: rgba(15, 23, 42, 0.2);
  border-color: rgba(15, 23, 42, 0.4);
  color: #e0f2fe;
  box-shadow: none;
}

body[data-page-kind="deals"] .filter-chips-hero .chip.is-active {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
}

/* Deals shell under hero */
body[data-page-kind="deals"] .deals-shell {
  padding-top: 0;
}

body[data-page-kind="deals"] .deals-shell .deals-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 32px 32px;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid #e5e7eb;
}

/* ===========================================
   Deals page: header override
=========================================== */

body[data-page-kind="deals"] #siteHeader {
  background: #025fbc;
  background-image: none;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

/* =========================================================
   RESPONSIVE TWEAKS
========================================================= */

/* Tablet and down */
@media (max-width: 960px) {
  .toolbar-main {
    align-items: flex-start;
  }
  .toolbar-controls {
    width: 100%;
    justify-content: flex-end;
  }

  body[data-page-kind="deals"] .deals-hero-inner {
    padding: 32px 16px 32px;
  }

  body[data-page-kind="deals"] .deals-shell .deals-wrap {
    padding: 24px 16px 24px;
  }

  .toolbar-main.toolbar-main-compact {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 8px;
  }

  .toolbar-left {
    flex: 1 1 100%;
  }

  .toolbar-controls-sort-only {
    width: 100%;
    justify-content: flex-end;
  }

  .results-count {
    font-size: 12px;
  }
}

/* Mobile (<=768px) */
@media (max-width: 768px) {
  /* Kill sideways scrolling on the deals page */
  body[data-page-kind="deals"] {
    overflow-x: hidden;
  }

  /* Hero: taller + more breathing room */
  body[data-page-kind="deals"] .deals-hero,
  body[data-page-kind="deals"] .deals-hero-inner,
  body[data-page-kind="deals"] .hero-copy,
  body[data-page-kind="deals"] .hero-search {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box; /* prevents padding from pushing past viewport */
  }

  body[data-page-kind="deals"] .deals-hero-inner {
    padding: 80px 16px 60px;
  }

  body[data-page-kind="deals"] .deals-hero .eyebrow {
    margin-bottom: 6px;
  }

  body[data-page-kind="deals"] .deals-hero h1 {
    margin: 0 0 6px;
  }

  body[data-page-kind="deals"] .deals-hero .subtitle {
    margin: 6px 0 16px;
  }

  /* Search: keep input + button on one row, but fully fluid */
  body[data-page-kind="deals"] .hero-search {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 10px;
    margin-top: 10px;
  }

  body[data-page-kind="deals"] .hero-search-group {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  body[data-page-kind="deals"] #dealHeroQuery {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body[data-page-kind="deals"] .hero-search-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
    text-align: center;
    justify-content: center;
  }

  /* Chips row: horizontal scroll */
  body[data-page-kind="deals"] .filter-chips-hero {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding: 4px 8px 8px 4px;
    gap: 10px;
  }

  .chip {
    white-space: nowrap;
  }

  /* Hide scrollbar on WebKit so it looks clean */
  body[data-page-kind="deals"] .filter-chips-hero::-webkit-scrollbar {
    display: none;
  }

  /* Fade + caret overlay pinned to the right (sits above chips) */
  body[data-page-kind="deals"] .hero-copy::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 10px;
    width: 72px;
    height: 44px;
    pointer-events: none;
    background-image:
      linear-gradient(to right,
        rgba(2, 95, 188, 0) 0%,
        rgba(2, 95, 188, 0.2) 40%,
        rgba(2, 95, 188, 1) 100%
      ),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 12'%3E%3Cpath d='M1 1l4 5-4 5' stroke='%23e0f2fe' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: right center, calc(100% - 10px) center;
    background-size: 72px 100%, 12px 12px;
  }

  /* Toolbar on mobile: stack vertically */
  .deals-toolbar {
    margin-bottom: 8px;
  }

  .toolbar-main.toolbar-main-compact {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-left {
    margin-bottom: 4px;
  }

  .toolbar-controls-sort-only {
    width: 100%;
    justify-content: space-between;
  }

  .sort-wrap {
    margin-left: auto;
  }

  .deals-wrap {
    padding: 20px 16px;
  }
}

/* Extra small phones (<=480px) */
@media (max-width: 480px) {
  body[data-page-kind="deals"] .deals-hero h1 {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  body[data-page-kind="deals"] .deals-hero .subtitle {
    font-size: 0.85rem;
  }

  .toolbar-title {
    font-size: 15px;
  }

  .results-count,
  .sort-label,
  #dealSort {
    font-size: 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .deal-card,
  .view-btn,
  .claim-btn {
    transition: none;
  }
}
