/* =========================================================
   Deals Page (Everjoy)
   ========================================================= */

/* Main wrapper settings */
#deals .wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}


/* ======================= PAGE HEADER (CTA) ======================= */
.page-header {
    padding: 48px 0;
    text-align: center;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.page-header h1 {
    font-size: clamp(1.4rem, 5vw, 2rem); /* 32px to 40px */
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    padding-top: 50px;
}
.page-header .subtitle {
    font-size: 1.125rem; /* 18px */
    color: #475569;
    margin: 0 auto 24px auto;
}
.cta-button {
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
}


/* ======================= FILTERS & DEALS GRID ======================= */
.deals-content {
    padding: 48px 0px 100px;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;    
    gap: 12px;
    margin-bottom: 40px;
}
.chip {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.chip:hover { background-color: #e2e8f0; }
.chip.is-active {
    background-color: #0f172a;
    color: #fff;
    border-color: #0f172a;
}


/* ===================== DEAL CARD & GRID ===================== */
.deals-grid {
  display: grid;
  gap: 24px;
  align-items: stretch;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* desktop default */
}

.deal-card {
  position: relative;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.deal-card { min-width: 0; } /* prevents flex/grid child overflow on tight widths */
.card-title { word-wrap: break-word; hyphens: auto; }
.deal-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.discount-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 800;
  background-color: #facc15; /* gold */
  color: #422006;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.20);
}

/* Simple star icon inside the badge */
.discount-tag::before {
  content: "★";
  font-size: 0.85em;
}

.card-body {
    padding: 16px;
    flex-grow: 1;
}
.card-title {
    font-size: 17px;
    line-height: 1.3;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #0f172a;
}
/* We don't show the long description anymore on deals cards */
.card-desc {
    display: none;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
}
.expires-text {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}
.claim-btn,
.view-btn {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    background-color: transparent;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.claim-btn:hover,
.view-btn:hover {
    background-color: #eef2ff;
    border-color: #a5b4fc;
    color: #1d4ed8;
}

/* ===================== RESPONSIVENESS ===================== */

/* Desktop down — tighten spacing a touch */
@media (max-width: 1280px) {
  .deals-content { padding: 40px 0 80px; }
}

/* Tablet (≤1024px): 3 columns */
@media (max-width: 1024px) {
  .deals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* Slightly smaller chips on tablet */
  .chip {
    font-size: 0.9rem;   /* ~14px */
    padding: 8px 16px;
  }
}
/* Tablet-ish widths: let footer wrap so text can sit above button */
@media (max-width: 900px) {
  /* Slightly smaller title on tablet */
  .card-title {
    font-size: 1rem;
  }

  /* Let footer wrap: expiry above full-width button */
  .card-footer {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .card-footer .expires-text {
    flex: 0 0 100%; /* full row above */
  }

  .card-footer .view-btn,
  .card-footer .claim-btn {
    flex: 0 0 100%;
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
}

/* Phone (≤640px): 2 columns, tighter gaps */
@media (max-width: 640px) {
  #deals .wrap { padding: 0 16px; }
  .deals-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .page-header .subtitle { font-size: 0.85rem; }

  /* Smaller discount title on mobile */
  .card-title {
    font-size: 0.9rem;
    line-height: 1.3;
  }

  /* Smaller, tighter chips on mobile */
  .filter-chips { gap: 8px; }
  .chip {
    font-size: 0.8rem;
    padding: 7px 14px;
  }

  /* Stack footer: expiry above full-width button */
  .card-footer {
    align-items: stretch;
    gap: 6px;
  }
  .card-footer .expires-text {
    order: 0;
  }
  .card-footer .view-btn,
  .card-footer .claim-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  /* Badge tweaks on mobile (ties into base .discount-tag) */
  .discount-tag {
    top: 10px;
    right: 10px;
    padding: 4px 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 400px) {
  .deals-grid { gap: 12px; }
  .card-title { font-size: 0.85rem; }
  .expires-text { font-size: 0.8rem; }
  .claim-btn,
  .view-btn { font-size: 0.9rem; padding: 8px 10px; }
  .discount-tag { font-size: 0.75rem; padding: 3px 10px; }
}


@media (max-width: 400px) {
  .card-body { padding: 12px; }
  .card-footer { padding: 10px 12px; }
}

/* Motion sensitivity — tone down hover lift */
@media (prefers-reduced-motion: reduce) {
  .deal-card { transition: none; }
  .deal-card:hover { transform: none; }
}

.card-media {
    aspect-ratio: 16 / 9; /* Sets a consistent widescreen shape */
    background-color: #f1f5f9; /* Fallback color while image loads */
    overflow: hidden; /* Ensures nothing spills out */
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fills the container without stretching */
}

/* Focus visibility for keyboard users */
.chip:focus-visible,
.claim-btn:focus-visible,
.view-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 32px 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: 12px;
  margin-top: 20px;
}

.pager-btn {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.pager-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.pager-btn[disabled] { opacity: .5; cursor: not-allowed; }

.pager-status { font-size: 14px; color: #475569; }

/* Deals page: hide mobile bottom nav on desktop only */
@media (min-width: 768px) {
  body[data-page-kind="deals"] .mobile-bottom-nav,
  body[data-page-kind="deals"] .mobile-nav,
  body[data-page-kind="deals"] .bottom-nav,
  body[data-page-kind="deals"] #mobileNav,
  body[data-page-kind="deals"] [data-mobile-nav],
  body[data-page-kind="deals"] #mbtabbar {
    display: none !important;
  }
}

/* Deals page: hide mobile tab bar on desktop */
@media (min-width: 768px) {
  body[data-page-kind="deals"] #mbTabbar {
    display: none !important;
  }
}

.chip {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 99px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
