/* SearchApp — pink & white, cute/girly. Light + dark themes via CSS variables.
   Theme resolution: explicit [data-theme] wins; otherwise system prefers-color-scheme. */

/* ---------- Light (default) ---------- */
:root {
  --pink: #ff2d78;
  --pink-soft: #ff6fae;
  --pink-200: #ffd4e6;
  --pink-050: #fff2f8;
  --accent: #e6186c;

  --bg: #fff5fa;
  --bg-grad-a: #fff0f7;
  --bg-grad-b: #ffe6f1;
  --surface: #ffffff;
  --surface-2: #fff0f6;
  --header: #ffffff;
  --header-ink: #3d1f2e;
  --ink: #37212c;
  --muted: #9b7f8c;
  --line: #ffdcec;
  --line-2: #ffe8f2;

  --chip-bg: #ffffff;
  --card-bg: #ffffff;
  --img-a: #ffeaf3;
  --img-b: #ffd9ea;
  --green: #e6186c;              /* cashback badge uses brand pink in this theme */
  --on-pink: #ffffff;

  --shadow: 0 4px 16px rgba(255, 45, 120, .10);
  --shadow-lg: 0 14px 40px rgba(255, 45, 120, .20);
  --radius: 18px;
  --maxw: 1180px;

  --font-display: "Pacifico", "Quicksand", cursive;
  --font-ui: "Quicksand", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Dark (explicit toggle) ---------- */
:root[data-theme="dark"] {
  --pink: #ff7ab6;
  --pink-soft: #ff9ac8;
  --pink-200: #5a2740;
  --pink-050: #2a1420;
  --accent: #ff9ac8;

  --bg: #150a11;
  --bg-grad-a: #1b0d16;
  --bg-grad-b: #220f1b;
  --surface: #221019;
  --surface-2: #2b1522;
  --header: #1b0d16;
  --header-ink: #ffe3f0;
  --ink: #f6e7ef;
  --muted: #c99fb4;
  --line: #3a1d2c;
  --line-2: #35182780;

  --chip-bg: #2b1522;
  --card-bg: #221019;
  --img-a: #311a28;
  --img-b: #3d2030;
  --green: #ff7ab6;
  --on-pink: #2a0f1c;

  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 42px rgba(0, 0, 0, .55);
}

/* ---------- Dark (system default, when user hasn't forced light) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --pink: #ff7ab6; --pink-soft: #ff9ac8; --pink-200: #5a2740; --pink-050: #2a1420; --accent: #ff9ac8;
    --bg: #150a11; --bg-grad-a: #1b0d16; --bg-grad-b: #220f1b;
    --surface: #221019; --surface-2: #2b1522; --header: #1b0d16; --header-ink: #ffe3f0;
    --ink: #f6e7ef; --muted: #c99fb4; --line: #3a1d2c; --line-2: #35182780;
    --chip-bg: #2b1522; --card-bg: #221019; --img-a: #311a28; --img-b: #3d2030;
    --green: #ff7ab6; --on-pink: #2a0f1c;
    --shadow: 0 4px 16px rgba(0,0,0,.45); --shadow-lg: 0 16px 42px rgba(0,0,0,.55);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b)) fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; color: inherit; }
img { max-width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.topbar { background: var(--header); color: var(--header-ink); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.topbar__row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; max-width: var(--maxw); margin: 0 auto; }
.logo { font-family: var(--font-display); font-size: 30px; line-height: 1; flex: 0 0 auto; background: none; border: 0; padding: 0;
        background-image: linear-gradient(90deg, var(--pink), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.zip { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; background: none; border: 0; }
.zip b { color: var(--ink); font-weight: 700; }

.search { flex: 1 1 auto; display: flex; background: var(--surface-2); border: 2px solid var(--pink-200); border-radius: 26px; overflow: hidden; max-width: 540px; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 11px 18px; font-size: 15px; color: var(--ink); font-family: inherit; font-weight: 600; }
.search input::placeholder { color: var(--muted); }
.search button { border: 0; background: var(--pink); color: var(--on-pink); padding: 0 18px; font-size: 17px; }

.iconbtn { display: flex; align-items: center; gap: 7px; color: var(--header-ink); background: none; border: 0; font-size: 13px; white-space: nowrap; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 2px solid var(--pink-200); border-radius: 22px; padding: 7px 12px; color: var(--header-ink); font-weight: 700; font-size: 13px; }
.pill:hover { border-color: var(--pink); }
.login { display: flex; align-items: center; gap: 9px; background: linear-gradient(90deg, var(--pink), var(--pink-soft)); color: var(--on-pink); border: 0; border-radius: 26px; padding: 8px 16px 8px 10px; }
.login .avatar { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.3); display: grid; place-items: center; font-size: 14px; }
.login .lines { line-height: 1.12; text-align: start; }
.login .lines small { display: block; opacity: .9; font-size: 11px; }
.login .lines b { font-size: 13px; }

.nav { border-top: 1px solid var(--line); }
.nav__row { display: flex; align-items: center; gap: 22px; padding: 10px 16px; max-width: var(--maxw); margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.nav__row::-webkit-scrollbar { display: none; }
.nav a, .nav__cats { color: var(--header-ink); font-size: 14px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 7px; background: none; border: 0; }
.nav__cats { font-weight: 800; }
.nav a:hover, .nav__cats:hover { color: var(--pink); }

/* dropdowns (language) */
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; background: var(--surface); border: 2px solid var(--pink-200);
        border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; max-height: 320px; overflow-y: auto; z-index: 60; }
.menu button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; background: none; border: 0;
               padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink); text-align: start; }
.menu button:hover { background: var(--surface-2); }
.menu button.active { color: var(--pink); }
.menu button .sub { color: var(--muted); font-size: 12px; }

/* ---------- Promo ribbon + countdown ---------- */
.promo { background: linear-gradient(90deg, var(--pink), var(--accent)); color: #fff; }
.promo__row { display: flex; align-items: center; gap: 18px; padding: 12px 16px; max-width: var(--maxw); margin: 0 auto; flex-wrap: wrap; }
.promo__flash { font-weight: 800; background: rgba(255,255,255,.22); padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.promo__txt { font-size: 15px; font-weight: 600; }
.promo__timer { display: flex; gap: 7px; margin-inline-start: auto; }
.tbox { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.5); border-radius: 10px; padding: 5px 9px; text-align: center; min-width: 50px; }
.tbox b { font-size: 17px; display: block; line-height: 1; font-weight: 800; }
.tbox small { font-size: 10px; text-transform: uppercase; opacity: .9; }
.btn-pink { background: #fff; color: var(--accent); font-weight: 800; border: 0; border-radius: 24px; padding: 10px 22px; font-size: 14px; }
.btn-pink:hover { transform: translateY(-1px); }

/* ---------- Hero ---------- */
.hero { padding: 20px 0 4px; }
.hero__stage { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 300px; box-shadow: var(--shadow); }
.slide { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-align: center; padding: 30px; }
.slide.active { display: flex; }
.slide__tag { font-family: var(--font-display); font-size: clamp(32px, 6vw, 60px); text-shadow: 0 4px 20px rgba(0,0,0,.35); }
.slide__sub { font-size: 19px; margin-top: 8px; font-weight: 600; opacity: .97; max-width: 640px; }
.slide__cta { margin-top: 16px; background: #fff; color: var(--accent); font-weight: 800; border: 0; border-radius: 24px; padding: 11px 26px; font-size: 15px; }
.ad-label { position: absolute; top: 10px; inset-inline-start: 12px; font-size: 11px; color: rgba(255,255,255,.75); }
.hero__dots { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pink-200); border: 0; padding: 0; }
.dot.active { background: var(--pink); width: 24px; border-radius: 6px; }
.hero__arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.28); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; display: grid; place-items: center; }
.hero__arrow.left { inset-inline-start: 10px; } .hero__arrow.right { inset-inline-end: 10px; }

/* ---------- Sections ---------- */
.section { padding: 24px 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section__head h2 { font-size: 22px; margin: 0; color: var(--ink); font-weight: 800; }
.section__more { color: var(--pink); font-weight: 800; font-size: 14px; white-space: nowrap; }

/* ---------- Merchant cashback row ---------- */
.merchants { display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 14px; scrollbar-width: thin; }
.merchant { flex: 0 0 auto; width: 86px; text-align: center; background: none; border: 0; }
.merchant__badge { width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; box-shadow: var(--shadow); border: 3px solid var(--surface); }
.merchant__name { font-size: 12px; color: var(--ink); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.merchant__cb { font-size: 12px; font-weight: 800; color: var(--pink); display: block; }

/* ---------- Category pills ---------- */
.cat-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.cat-pill { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--card-bg); border: 2px solid var(--pink-200); border-radius: 16px; padding: 12px 16px; min-width: 92px; font-weight: 700; font-size: 13px; color: var(--ink); }
.cat-pill:hover { border-color: var(--pink); transform: translateY(-2px); }
.cat-pill .ico { font-size: 26px; }

/* ---------- Product grid/rail ---------- */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.card { background: var(--card-bg); border: 2px solid var(--line-2); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--pink-200); }
.card__img { height: 150px; border-radius: 14px; background: linear-gradient(135deg, var(--img-a), var(--img-b)); display: grid; place-items: center; font-size: 56px; margin-bottom: 10px; position: relative; }
.card__cb { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--green); color: var(--on-pink); font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; }
.card__flag { position: absolute; top: 8px; inset-inline-end: 8px; background: var(--surface); color: var(--pink); font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 20px; box-shadow: var(--shadow); }
.card__title { font-size: 14px; line-height: 1.35; color: var(--ink); min-height: 56px; margin: 0 0 8px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__rating { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.card__rating b { color: #f2a900; }
.card__old { font-size: 12px; color: var(--muted); text-decoration: line-through; }
.card__price { font-size: 20px; font-weight: 800; color: var(--pink); }
.card__price small { font-size: 12px; font-weight: 700; color: var(--muted); }
.card__store { font-size: 12px; color: var(--muted); margin: 4px 0 10px; font-weight: 600; }
.card__store b { color: var(--ink); }
.card__btn { margin-top: auto; background: linear-gradient(90deg, var(--pink), var(--pink-soft)); color: var(--on-pink); font-weight: 800; border: 0; border-radius: 24px; padding: 9px; font-size: 14px; }
.card__btn:hover { filter: brightness(1.05); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: var(--chip-bg); border: 2px solid var(--pink-200); border-radius: 22px; padding: 9px 18px; font-size: 14px; font-weight: 700; color: var(--ink); }
.chip:hover { border-color: var(--pink); color: var(--pink); }

/* ---------- Trust band ---------- */
.trust { background: linear-gradient(90deg, var(--pink), var(--accent)); color: #fff; margin-top: 28px; }
.trust__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 22px; padding: 34px 16px; max-width: var(--maxw); margin: 0 auto; }
.trust h3 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.trust p { margin: 0; color: rgba(255,255,255,.92); font-size: 13px; line-height: 1.5; font-weight: 500; }

/* ---------- Footer ---------- */
footer { background: var(--header); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.footer__row { padding: 26px 16px; max-width: var(--maxw); margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; align-items: center; }
.footer__logo { font-family: var(--font-display); color: var(--pink); font-size: 24px; }
.footer__note { max-width: 560px; line-height: 1.5; font-weight: 500; }

/* ---------- Results view ---------- */
.results { padding: 24px 0; min-height: 52vh; }
.results__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.results__head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.results__count { color: var(--muted); font-size: 14px; font-weight: 600; }
.back { background: var(--surface); border: 2px solid var(--pink-200); border-radius: 20px; padding: 8px 16px; font-size: 14px; font-weight: 700; color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-weight: 600; }

/* ---------- RTL niceties ---------- */
:root[dir="rtl"] .hero__arrow.left { transform: translateY(-50%) scaleX(-1); }
:root[dir="rtl"] .hero__arrow.right { transform: translateY(-50%) scaleX(-1); }

@media (max-width: 760px) {
  .zip, .login .lines, .nav__row .nav-extra { display: none; }
  .promo__timer { margin-inline-start: 0; }
  .section__head h2 { font-size: 18px; }
  .logo { font-size: 26px; }
}
