/* ===========================
   RESET & ROOT — SPACE THEME
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --space-bg:    #02020e;
  --space-deep:  #080820;
  --space-card:  rgba(255,255,255,0.04);
  --space-card-h:rgba(255,255,255,0.07);
  --border:      rgba(255,255,255,0.08);
  --border-h:    rgba(255,255,255,0.22);

  /* Stars & cosmic */
  --star-gold:   #fde68a;
  --star-blue:   #bfdbfe;
  --nebula-pur:  rgba(139,92,246,0.25);
  --nebula-blue: rgba(59,130,246,0.18);
  --nebula-teal: rgba(20,184,166,0.12);

  /* Platforms */
  --tiktok-bg:   #010101;
  --tiktok-c1:   #69c9d0;
  --tiktok-c2:   #ee1d52;
  --shopee-bg:   #ee4d2d;
  --shopee-light:#ff7152;

  --text:   #f0f4ff;
  --text2:  rgba(240,244,255,0.55);
  --text3:  rgba(240,244,255,0.28);

  --r:    14px;
  --ease: cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--space-bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ===========================
   STARFIELD CANVAS
=========================== */
#starfield {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

/* ===========================
   NEBULA BLOBS
=========================== */
.nebula {
  position: fixed; border-radius: 50%;
  filter: blur(100px); pointer-events: none; z-index: 0;
  animation: nebula-pulse 18s ease-in-out infinite;
}
.nebula-1 {
  width: 650px; height: 650px;
  background: radial-gradient(circle, rgba(139,92,246,0.22) 0%, transparent 70%);
  top: -250px; left: -200px;
}
.nebula-2 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(6,182,212,0.14) 0%, transparent 70%);
  bottom: -150px; right: -130px;
  animation-delay: -7s;
}
.nebula-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(236,72,153,0.1) 0%, transparent 70%);
  top: 50%; left: 60%;
  animation-delay: -12s;
}
@keyframes nebula-pulse {
  0%,100% { transform: scale(1) translate(0,0); opacity: 1; }
  50%      { transform: scale(1.08) translate(15px,-15px); opacity: 0.7; }
}

/* ===========================
   FLOATING PLANETS
=========================== */
.planet {
  position: fixed; border-radius: 50%;
  pointer-events: none; z-index: 0;
  animation: planet-float ease-in-out infinite;
}
.planet-1 {
  width: 80px; height: 80px;
  background: radial-gradient(circle at 35% 35%,
    #7c3aed 0%, #4c1d95 50%, #1e0a3c 100%);
  box-shadow: inset -8px -8px 20px rgba(0,0,0,0.5),
              0 0 30px rgba(139,92,246,0.3);
  top: 12%; right: 8%;
  animation-duration: 8s;
  animation-delay: 0s;
}
.planet-2 {
  width: 44px; height: 44px;
  background: radial-gradient(circle at 35% 35%,
    #0ea5e9 0%, #0369a1 50%, #082f49 100%);
  box-shadow: inset -5px -5px 12px rgba(0,0,0,0.5),
              0 0 20px rgba(14,165,233,0.3);
  bottom: 20%; left: 5%;
  animation-duration: 11s;
  animation-delay: -4s;
}
@keyframes planet-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-16px); }
}

/* ===========================
   HEADER
=========================== */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(2,2,14,0.8);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 4px 30px rgba(0,0,0,0.6);
}

.back-btn {
  display: flex; align-items: center; gap: 5px;
  color: var(--star-blue); text-decoration: none;
  font-size: 0.82rem; font-weight: 500;
  padding: 6px 12px; border-radius: 50px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  transition: all 0.22s var(--ease);
}
.back-btn:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
}

.header-brand {
  display: flex; align-items: center; gap: 8px;
}
.brand-icon { font-size: 1.3rem; animation: ufo-spin 6s linear infinite; }
@keyframes ufo-spin {
  0%,100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}
.brand-name {
  display: block; font-size: 1rem; font-weight: 700;
  background: linear-gradient(135deg, #e0c3fc, #8ec5fc, #a8edea);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -0.5px; line-height: 1;
}
.brand-sub { font-size: 0.58rem; color: var(--text3); letter-spacing: 0.5px; display: block; }

.item-count {
  font-size: 0.65rem; color: var(--star-blue);
  background: rgba(191,219,254,0.08);
  border: 1px solid rgba(191,219,254,0.15);
  padding: 4px 10px; border-radius: 50px;
  letter-spacing: 0.3px; white-space: nowrap;
}

/* ===========================
   LAYOUT
=========================== */
.container {
  position: relative; z-index: 1;
  max-width: 540px; margin: 0 auto;
  padding: 20px 14px 80px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ===========================
   HERO LABEL
=========================== */
.hero-label {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--star-gold);
  font-size: 0.68rem; letter-spacing: 2px;
  text-transform: uppercase; opacity: 0.7;
  animation: fadein 0.6s ease both;
}
.star-icon { animation: twinkle 2s ease-in-out infinite; }
.star-icon:last-child { animation-delay: -1s; }
@keyframes twinkle { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.8); } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 0.7; transform: translateY(0); } }

/* ===========================
   SEARCH
=========================== */
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 50px; padding: 10px 16px;
  transition: all 0.22s;
}
.search-box:focus-within {
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1), 0 0 20px rgba(139,92,246,0.1);
}
.search-icon { color: var(--text3); flex-shrink: 0; }
#search-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem;
}
#search-input::placeholder { color: var(--text3); }
.clear-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text3); font-size: 0.78rem; padding: 2px 4px;
  border-radius: 50%; transition: color 0.2s; display: none;
}
.clear-btn.visible { display: block; }
.clear-btn:hover { color: var(--text); }

/* ===========================
   PLATFORM TABS — Big cards
=========================== */
.platform-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ptab {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 16px; cursor: pointer;
  transition: all 0.28s var(--ease);
  position: relative; overflow: hidden;
}
.ptab::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity 0.3s;
}
.ptab:hover { transform: translateY(-3px); }

.ptab-icon { font-size: 1.5rem; line-height: 1; }
.ptab-label {
  font-size: 0.75rem; font-weight: 600;
  color: var(--text2); letter-spacing: 0.2px;
  white-space: nowrap;
}
.ptab-count {
  font-size: 0.62rem; color: var(--text3);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 1px 8px; border-radius: 20px;
  min-width: 28px; text-align: center;
}

/* All tab */
.ptab-all.active {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 4px 20px rgba(139,92,246,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}
.ptab-all.active .ptab-label { color: #d8b4fe; }
.ptab-all.active .ptab-count { background: rgba(139,92,246,0.2); color: #d8b4fe; border-color: rgba(139,92,246,0.3); }
.ptab-all:hover:not(.active) { border-color: rgba(139,92,246,0.3); }

/* TikTok tab */
.ptab-tiktok.active {
  background: rgba(1,1,1,0.6);
  border-color: var(--tiktok-c1);
  box-shadow: 0 4px 24px rgba(105,201,208,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}
.ptab-tiktok.active .ptab-label { color: var(--tiktok-c1); }
.ptab-tiktok.active .ptab-count { background: rgba(105,201,208,0.15); color: var(--tiktok-c1); border-color: rgba(105,201,208,0.3); }
.ptab-tiktok:hover:not(.active) { border-color: rgba(105,201,208,0.3); }

/* Shopee tab */
.ptab-shopee.active {
  background: rgba(238,77,45,0.15);
  border-color: var(--shopee-bg);
  box-shadow: 0 4px 24px rgba(238,77,45,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
}
.ptab-shopee.active .ptab-label { color: var(--shopee-light); }
.ptab-shopee.active .ptab-count { background: rgba(238,77,45,0.2); color: var(--shopee-light); border-color: rgba(238,77,45,0.3); }
.ptab-shopee:hover:not(.active) { border-color: rgba(238,77,45,0.3); }

/* ===========================
   CATEGORY SUB-FILTER
=========================== */
.cat-tabs-wrap { overflow-x: auto; scrollbar-width: none; }
.cat-tabs-wrap::-webkit-scrollbar { display: none; }
.cat-tabs { display: flex; gap: 7px; min-width: max-content; padding-bottom: 2px; }

.cat-tab {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 50px; color: var(--text3);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.74rem; font-weight: 500;
  padding: 5px 12px; cursor: pointer;
  white-space: nowrap; transition: all 0.2s var(--ease);
}
.cat-tab:hover { border-color: rgba(255,255,255,0.2); color: var(--text2); }
.cat-tab.active {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
}

/* ===========================
   PRODUCT GRID
=========================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
}

/* ===========================
   PRODUCT CARD
=========================== */
.product-card {
  position: relative;
  background: var(--space-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  text-decoration: none; color: var(--text);
  display: flex; flex-direction: column;
  transition: all 0.3s var(--ease);
  animation: card-in 0.5s cubic-bezier(0.16,1,0.3,1) both;
  backdrop-filter: blur(10px);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.product-card:hover {
  background: var(--space-card-h);
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

/* TikTok card hover */
.product-card.tk:hover {
  border-color: rgba(105,201,208,0.4);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 20px rgba(105,201,208,0.1);
}
/* Shopee card hover */
.product-card.sp:hover {
  border-color: rgba(238,77,45,0.4);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 20px rgba(238,77,45,0.1);
}

/* ── Image ── */
.card-img-wrap {
  position: relative; width: 100%; aspect-ratio: 1/1; overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.product-card.sp .card-img-wrap {
  background: #ffffff;
}
.product-card.sp .card-img-wrap img {
  object-fit: contain;
  padding: 6px;
}
.product-card:hover .card-img-wrap img { transform: scale(1.07); }
.card-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(6,182,212,0.05));
}

/* Platform badge */
.platform-badge {
  position: absolute; top: 7px; left: 7px;
  border-radius: 8px; font-size: 0.58rem; font-weight: 700;
  padding: 3px 7px; letter-spacing: 0.5px;
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: center; gap: 3px;
  backdrop-filter: blur(8px);
}
.badge-tiktok {
  background: rgba(1,1,1,0.8);
  color: var(--tiktok-c1);
  border: 1px solid rgba(105,201,208,0.4);
}
.badge-shopee {
  background: rgba(238,77,45,0.85);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}

/* NEW badge */
.card-new {
  position: absolute; top: 7px; right: 7px;
  background: rgba(139,92,246,0.9);
  color: #fff; border-radius: 6px;
  font-size: 0.58rem; font-weight: 700; padding: 2px 7px;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 2px 8px rgba(139,92,246,0.5);
  animation: new-glow 2s ease-in-out infinite;
}
@keyframes new-glow {
  0%,100% { box-shadow: 0 2px 8px rgba(139,92,246,0.5); }
  50%      { box-shadow: 0 2px 14px rgba(139,92,246,0.9); }
}

/* ── Body ── */
.card-body {
  padding: 10px 11px 12px;
  display: flex; flex-direction: column; gap: 4px; flex: 1;
}
.card-name {
  font-size: 0.81rem; font-weight: 600; color: var(--text);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub {
  font-size: 0.64rem; color: var(--text3);
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.1px;
}
.card-footer {
  display: flex; align-items: center;
  justify-content: space-between; margin-top: 5px;
}
.card-price {
  font-size: 0.8rem; font-weight: 700;
  color: var(--star-gold);
  text-shadow: 0 0 10px rgba(253,230,138,0.4);
}
.card-cta {
  font-size: 0.62rem; font-weight: 600;
  color: var(--text2);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; padding: 3px 8px;
  transition: all 0.2s;
}
.product-card:hover .card-cta {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.product-card.tk:hover .card-cta { background: rgba(105,201,208,0.15); border-color: rgba(105,201,208,0.35); color: var(--tiktok-c1); }
.product-card.sp:hover .card-cta { background: rgba(238,77,45,0.15);   border-color: rgba(238,77,45,0.35);   color: var(--shopee-light); }

/* ===========================
   EMPTY STATE
=========================== */
.empty-state {
  text-align: center; padding: 60px 20px;
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.empty-icon { font-size: 3.5rem; }
.empty-state p { font-size: 0.95rem; font-weight: 600; color: var(--text2); }
.empty-state span { font-size: 0.7rem; color: var(--text3); }

/* ===========================
   ADD BANNER
=========================== */
.add-banner {
  display: flex; align-items: center; gap: 14px;
  background: rgba(139,92,246,0.05);
  border: 1px dashed rgba(139,92,246,0.2);
  border-radius: var(--r); padding: 16px; margin-top: 4px;
  font-size: 1.5rem;
}
.add-text { display: flex; flex-direction: column; gap: 3px; }
.add-text strong { font-size: 0.85rem; color: var(--text2); }
.add-text span { font-size: 0.65rem; color: var(--text3); }

/* ===========================
   PLATFORM LOGO IMAGES
=========================== */
.platform-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.tiktok-logo-img {
  border-radius: 10px;
}

.shopee-logo-img {
  border-radius: 8px;
  background: #fff;
  padding: 2px;
}

/* ===========================
   RIPPLE
=========================== */
.ripple {
  position: absolute; border-radius: 50%;
  pointer-events: none;
  animation: ripple-out 0.6s ease-out forwards;
}
@keyframes ripple-out {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(4); opacity: 0; }
}

/* ===========================
   RESPONSIVE
=========================== */
@media (min-width: 520px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) {
  .ptab-label { font-size: 0.68rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
