/* frontend/sdp/sdp.css */
/* IMPORTANT:
   - Do NOT restyle Home components.
   - Cat row + product cards inherit Home/main.css.
   - This file only handles page layout + topbar + grid shell.
*/

:root{
  --sdp-topbar-h: 56px; /* fixed topbar height */
  --sdp-gap: 10px;
  --sdp-pad: var(--pad);
}

/* page base */
.sdpPage{
  background: var(--bg);
}

/* =========================
   FIXED TOPBAR (one state)
========================= */
.sdpTopbar{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--sdp-topbar-h);
  z-index: 220;
}

.sdpTopbar__bg{
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,0.16), transparent 55%),
    radial-gradient(circle at 80% 25%, rgba(15,23,42,0.16), transparent 55%),
    linear-gradient(135deg, rgba(243,107,33,1), rgba(235,77,4,1));
}

.sdpTopbar__inner{
  position: relative;
  height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--sdp-pad);

  display: grid;
  grid-template-columns: 40px auto 1fr; /* back | title | search */
  align-items: center;
  gap: 10px;
}

.sdpIconBtn{
  border: 0;
  background: transparent;
  color: #fff;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sdpIconBtn i{
  font-size: 18px;
  line-height: 1;
}

.sdpTopbar__title{
  max-width: 170px;
  min-width: 0;
  color: #fff;
  font-weight: 950;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* Search bar: white background (as requested) */
.sdpSearchBar{
  height: 38px;
  border-radius: 999px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  background: #fff;
  border: 1px solid rgba(15,23,42,0.10);
  color: rgba(15,23,42,0.78);

  cursor: pointer;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.sdpSearchBar__icon{
  font-size: 14px;
  opacity: 0.75;
}

.sdpSearchFlipBox{
  position: relative;
  height: 18px;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  color: rgba(15,23,42,0.72);
}

/* =========================
   CAT ROW + SUBCAT ROW placement only
   (actual styling comes from Home/main.css)
========================= */
/* Cat row sits directly under fixed topbar */
.sdpCatLineBar{
  position: sticky;
  top: var(--sdp-topbar-h);
  z-index: 210;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* Subcat row sits under cat row in flow */
/* Subcat must clear sticky cat row (and never hide behind it) */
.sdpSubcatBar{
  position: sticky;
  top: calc(var(--sdp-topbar-h) + 56px); /* ✅ assumes cat row ≈ 56px */
  z-index: 205;                         /* under cat row, above feed */
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 4px var(--sdp-pad) 3px;      /* ✅ tighter */
}


/* =========================
   MAIN spacing under fixed topbar
========================= */
/* SDP can breathe wider than Home before it caps */
.sdpMain{
  width: 100%;
  max-width: 1180px;              /* ✅ grows with page, then caps */
  margin: 0 auto;
  padding-top: var(--sdp-topbar-h); /* ✅ no extra “mystery” gap */
}


/* =========================
   FEED GRID SHELL
   Cards themselves are Home .pCard--fresh
========================= */

/* Give the feed a small breathing gap from subcats/cat bar */
.sdpFeed{
  padding: 30px 0 14px; /* ✅ top gap restored (was too tight), no side padding here */
}

/* 2-col grid: 1px shy edges + 1px between columns, but proper vertical spacing */
.sdpGrid{
  --edge: 5px;      /* ✅ 1px shy of container (container is full-width until max) */
  --colGap: 5px;    /* ✅ 1px between left/right cards */
  --rowGap: 10px;   /* ✅ vertical breathing room so cards don’t touch */

  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--colGap);
  row-gap: var(--rowGap);

  padding-left: var(--edge);
  padding-right: var(--edge);

  width: 100%;
  /* max width per card */
  --cardMax: 200px;

  /* each column can grow, but not beyond --cardMax */
  grid-template-columns: repeat(2, minmax(0, var(--cardMax)));

  /* center the 2-column grid when there’s extra space */
  justify-content: center;
}

/* Make sure cards stretch inside grid (SDP-only) */
.sdpGrid > .pCard{
  width: 100%;
  max-width: 100%;
}

/* infinite loading row */
.sdpLoadRow{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0 6px;
}

.sdpSpinner{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(15,23,42,0.12);
  border-top-color: rgba(15,23,42,0.45);
  animation: sdpSpin 0.9s linear infinite;
}

@keyframes sdpSpin{
  to{ transform: rotate(360deg); }
}

.sdpBottomPad{
  height: 18px;
}

/* responsive tweaks only (still layout glue) */
@media (min-width: 700px){
  .sdpTopbar__title{ max-width: 240px; }

  /* Keep edge rule tight, but make it less “glued” on bigger screens */
  .sdpGrid{ --rowGap: 12px; }
}

@media (min-width: 1000px){
  .sdpGrid{ --edge: 12px; --gap: 12px; }
}

/* SDP: force the “pop” switch state to brand orange */
/* SDP override: switching row “pop” must be orange */
.sdpPage .pSwitch.pSwitch--pop{
  color: var(--brand) !important;
}

