/* ==================================================
   PaddPerks — Stable IG Scroll Layout
================================================== */

:root{
  --yellow:#F3C316;
  --yellow2:#FFD867;
  --bg:#F4F5F7;
  --panel:#fff;
  --text:#111;
  --muted:#666;
  --stroke:rgba(0,0,0,.08);
  --nav-h:74px;
}

*{box-sizing:border-box;}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto;
  background: #f7f7f9;
  color:var(--text);
}

/* ==================================================
   HEADER (FIXED — DO NOT MODIFY ARCHITECTURE)
================================================== */

.top-shell{
  position:fixed;
  top:0; left:0; right:0;
  z-index:1000;
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
  border-bottom:1px solid var(--stroke);
  transition:
    box-shadow .2s ease,
    transform .25s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

.header{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  font-weight:800;
}

.toolbar{
  padding:0 16px 14px;
  transition:
    opacity .18s ease,
    transform .22s cubic-bezier(.4,0,.2,1),
    max-height .22s ease;
  transform-origin: top;
}

.top-shell.is-collapsed .toolbar{
  opacity:0;
  max-height:0;
  overflow:hidden;
  transform:translateY(-8px);
  pointer-events:none;
}

.top-shell.is-collapsed{
  box-shadow:0 10px 28px rgba(0,0,0,.12);
}

/* ==================================================
   HEADER FADE (PURE VISUAL — SAFE)
================================================== */

/* container must be relative for fade positioning */
.top-shell{
  position:fixed;
}

/* fade element */
.top-shell::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-24px;
  height:24px;
  pointer-events:none;
  opacity:0;
  transition:opacity .25s ease;
  background:linear-gradient(
    to bottom,
    rgba(244,245,247,0.85),
    rgba(244,245,247,0)
  );
}

/* fade only when collapsed */
.top-shell.is-collapsed::after{
  opacity:1;
}

.search{
  display:flex;
  background:#fff;
  border-radius:999px;
  padding:10px 14px;
  margin-top:8px;
}

.search input{
  border:none;
  outline:none;
  width:100%;
}

.pills{
  margin-top:10px;
  display:flex;
  gap:8px;
  overflow:auto;
}

.pill{
  padding:8px 12px;
  border-radius:999px;
  background:#fff;
  font-size:13px;
  font-weight:600;
  white-space:nowrap;
}

.pill.active{
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
}
/* ==================================================
   CONTENT
================================================== */

.page{
  padding:16px;
  padding-bottom:calc(var(--nav-h) + 20px);
  transition:padding-top .2s ease;
  will-change:padding-top;
}

.feed{
  display:flex;
  flex-direction:column;
  gap:18px;
}

/* ==================================================
   REFINED CARD SYSTEM
================================================== */

.card{
  background:#fff;
  border-radius:20px;
  padding:16px;
  box-shadow:0 10px 24px rgba(0,0,0,.06);
  display:flex;
  flex-direction:column;
  gap:14px;
  transition:transform .15s ease, box-shadow .15s ease;
}

.card:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 30px rgba(0,0,0,.08);
}

.card-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.merchant{
  display:flex;
  align-items:center;
  gap:12px;
}

.logo{
  height:42px;
  width:42px;
  border-radius:14px;
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size:16px;
}

.merchant-info{
  display:flex;
  flex-direction:column;
}

.merchant-name{
  font-weight:800;
  font-size:15px;
}

.merchant-meta{
  font-size:12px;
  color:var(--muted);
}

.save-btn{
  height:36px;
  width:36px;
  border-radius:12px;
  border:1px solid var(--stroke);
  background:#fff;
  display:flex;
  align-items:center;
  color:#111;              /* 🔥 THIS IS WHAT'S MISSING */
  justify-content:center;
  cursor:pointer;
  transition:transform .12s ease, background .2s ease;
}

.save-btn:active{
  transform:scale(.92);
}

.save-btn.saved{
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
}

.save-btn{
  position:absolute;        /* 🔥 this is what’s missing */
  top:10px;
  right:10px;
  z-index:5;
}

/* Image */
.card-image{
  height:160px;
  border-radius:16px;
  overflow:hidden;
  background:#eee;
  position:relative;
  
}

.card-image img{
  width:100%;
  height:100%;
  object-fit:cover;
  position:relative;
  cursor: pointer;
  z-index:1;
}

.discount-badge{
  position:absolute;
  bottom:10px;
  left:10px;
  background:#fff;
  padding:6px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  box-shadow:0 6px 14px rgba(0,0,0,.12);
}

/* Body */
.card-body{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.card-title{
  font-size:17px;
  font-weight:900;
  line-height:1.25;
}

.card-desc{
  font-size:13px;
  color:var(--muted);
  line-height:1.4;
}

.card-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:0px;
}

.tag{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:#f1f1f1;
  font-weight:600;
}

.btn-primary{
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
  border:none;
  padding:8px 14px;
  border-radius:14px;
  font-weight:800;
  cursor:pointer;
}

/* ==================================================
   REFINED BOTTOM NAV
================================================== */

.bottom-nav{
  position:fixed;
  bottom:0; left:0; right:0;
  height:var(--nav-h);
  backdrop-filter:blur(16px);
  background:rgba(255,255,255,.85);
  border-top:1px solid var(--stroke);
  display:flex;
  justify-content:space-around;
  align-items:center;
  z-index:900;
}

.bottom-nav a{
  flex:1;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  font-size:12px;
  font-weight:600;
  color:var(--muted);
  text-decoration:none;
  position:relative;
  transition:color .2s ease;
}

/* Icon container */
.bottom-nav a .ico{
  height:32px;
  width:32px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:
    background .2s ease,
    transform .15s ease;
}

/* Active state */
.bottom-nav a.active{
  color:var(--text);
}

.bottom-nav a.active .ico{
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
  transform:translateY(-1px);
}

/* Press feedback */
.bottom-nav a:active .ico{
  transform:scale(.92);
}

/* Subtle active indicator */
.bottom-nav a::after{
  content:"";
  position:absolute;
  bottom:6px;
  height:3px;
  width:18px;
  border-radius:999px;
  background:linear-gradient(135deg,var(--yellow2),var(--yellow));
  opacity:0;
  transition:opacity .2s ease;
}

.bottom-nav a.active::after{
  opacity:1;
}

.card-actions {
  display: flex;
  justify-content: flex-end; /* push to right */
  margin-top: 8px;
}

.category-pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f1f1;
  font-weight: 600;
}

.card-actions {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:10px;
}

.expire-date {
  font-size:12px;
  font-weight:600;
  color:#888;
}

.card-location {
  font-size:12px;
  font-weight:600;
  color:#888;
}

.ad-card {
  margin: 16px 0;
}

.ad-slot {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}

.sponsored-label {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  background: rgba(255,255,255,.95);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 2;
}

/* =========================
   AD CARD (ALIGNED WITH CARDS)
========================= */

.ad-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  padding: 16px;
  margin: 0; /* let .feed gap control spacing */
}

.ad-slot {
  position: relative;
  width: 100%;
  height: 160px; /* match .card-image */
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f6f8;
}

/* Sponsored label */
.ad-card .sponsored-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #6b7280;
  background: rgba(255,255,255,0.9);
  padding: 4px 8px;
  border-radius: 999px;
  z-index: 3;
}

/* Force radius on iframe */
.ad-slot,
.ad-slot iframe,
.ad-slot img,
.ad-slot object,
.ad-slot embed,
.ad-slot > div {
  border-radius: 16px;
  overflow: hidden;
}

/* =========================
   FORCE ADBUTLER RADIUS
========================= */
.ad-slot,
.ad-slot iframe,
.ad-slot img,
.ad-slot object,
.ad-slot embed {
  border-radius: 14px;
  overflow: hidden;
}

/* Defensive: some ad servers wrap again */
.ad-slot > div {
  border-radius: 14px;
  overflow: hidden;
}

/* Detail page uses same card rhythm */
.card .section h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.card .section p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.card-location {
  font-size: 12px;
  color: #8a8a8a;
  margin-top: -2px;
}

.expire-date {
  font-size: 12px;
  font-weight: 600;
  color: #888;
}

/* Redeem bar modernized */
.redeem-bar {
  position: fixed;
  bottom: 74px;
  left: 0;
  right: 0;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  padding: 14px 16px;
  border-top: 1px solid var(--stroke);
  z-index: 950;
}

.redeem-btn {
  width: 100%;
  background: linear-gradient(135deg,var(--yellow2),var(--yellow));
  border: none;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  border-radius: 16px;
  cursor: pointer;
}

.redeem-btn.redeemed {
  background: #6c757d;
}

/* =========================
   SETTINGS POLISH
========================= */

.pp-settings {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 100px;
}

.pp-card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  transition: transform 0.2s ease;
}

.pp-card h2 {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.pp-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  font-size: 15px;
}

.pp-toggle input {
  width: 42px;
  height: 22px;
  accent-color: #EFB428;
  cursor: pointer;
}

.pp-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.pp-range input[type="range"] {
  width: 100%;
  accent-color: #EFB428;
  cursor: pointer;
}

.pp-btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 12px;
  background: #EFB428;
  color: #000;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pp-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.pp-btn-ghost {
  background: transparent;
  border: 1px solid #ddd;
}

.pp-btn-ghost:hover {
  background: #f5f5f5;
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 38px;
}

.header-user {
  position: relative;
}

.avatar-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 38px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  min-width: 140px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.user-dropdown a,
.user-dropdown button {
  padding: 10px 14px;
  font-size: 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: #000;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: #f5f5f5;
}

.user-dropdown.show {
  display: flex;
}