/* ═══════════════════════════════════════════════════════════════════
   MAKAY — Activity Layer  |  activity-layer.css
   Adds social proof signals, live cues, and energy to every screen.
   Zero changes to existing styles — pure additive layer.
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. LIVE TICKER STRIP (fixed, directly below the app header) ─────── */
#activityTicker {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  height: 32px;
  background: linear-gradient(90deg, #0f2566 0%, #19378C 40%, #1f4bb5 100%);
  /* Fixed below the header — header is 56px + safe-area */
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 999; /* just below header (1000) */
}
#activityTicker::before,
#activityTicker::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
}
#activityTicker::before {
  left: 0;
  background: linear-gradient(90deg, #0f2566, transparent);
}
#activityTicker::after {
  right: 0;
  background: linear-gradient(270deg, #1f4bb5, transparent);
}
.ticker-dot {
  width: 6px; height: 6px;
  background: #2ecc71;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 12px;
  animation: tickerPulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(46,204,113,0.6);
}
@keyframes tickerPulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,204,113,0.6); }
  70%  { box-shadow: 0 0 0 5px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
.ticker-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: tickerScroll 28s linear infinite;
  flex-shrink: 0;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.92);
  font-size: 11px;
  font-weight: 500;
  padding: 0 20px;
  letter-spacing: 0.1px;
}
.ticker-item .material-symbols-rounded {
  font-size: 13px;
  opacity: 0.85;
}
.ticker-sep {
  color: rgba(255,255,255,0.25);
  font-size: 14px;
  padding: 0 4px;
}

/* ── 2. SOCIAL PROOF CHIPS on product cards ─────────────────────────── */
.activity-chip-wrap {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}
.activity-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  line-height: 1.4;
  letter-spacing: 0.1px;
  white-space: nowrap;
}
.chip-hot {
  background: #fff3e0;
  color: #d35400;
  border: 1px solid #fbd7a4;
}
.chip-new {
  background: #e8f9f0;
  color: #1a7a47;
  border: 1px solid #a8e6c2;
}
.chip-low {
  background: #fef2f2;
  color: #c0392b;
  border: 1px solid #f5c6c6;
}
.chip-views {
  background: #f0f4ff;
  color: #19378C;
  border: 1px solid #c5d2f0;
}
.chip-saved {
  background: #fdf4ff;
  color: #7b2d8b;
  border: 1px solid #e2b4f0;
}
.activity-chip .material-symbols-rounded {
  font-size: 10px;
}

/* ── 3. "JUST LISTED" flash badge on very new cards ─────────────────── */
.just-listed-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  pointer-events: none;
  animation: justListedIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  box-shadow: 0 2px 6px rgba(39,174,96,0.45);
  z-index: 3;
}
@keyframes justListedIn {
  from { opacity: 0; transform: scale(0.5) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── 4. GHOST VIEWER COUNT (floating on card image on hover) ────────── */
.card-viewer-ghost {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.58);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 3;
}
.card-viewer-ghost .material-symbols-rounded { font-size: 11px; }
.product-card:hover .card-viewer-ghost,
.brand-product-card:hover .card-viewer-ghost {
  opacity: 1;
  transform: translateY(0);
}

/* ── 5. PURCHASE TOAST SNACKBAR (bottom-left, non-blocking) ─────────── */
#activityToast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 12px);
  left: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.activity-toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px 10px 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.13), 0 1px 4px rgba(0,0,0,0.07);
  max-width: 260px;
  pointer-events: auto;
  animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  border-left: 3px solid #19378C;
}
.activity-toast-item.toast-out {
  animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(-20px) scale(0.9); }
}
.toast-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  background: #eef1f9;
  display: flex; align-items: center; justify-content: center;
  color: #19378C;
  overflow: hidden;
}
.toast-avatar .material-symbols-rounded {
  font-size: 18px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.toast-text { flex: 1; min-width: 0; }
.toast-action {
  font-size: 11px;
  font-weight: 700;
  color: #19378C;
  white-space: nowrap;
}
.toast-detail {
  font-size: 10.5px;
  color: #666;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 6. "ACTIVE NOW" indicator on user avatars ──────────────────────── */
.avatar-active-dot {
  width: 9px; height: 9px;
  background: #2ecc71;
  border: 2px solid #fff;
  border-radius: 50%;
  position: absolute;
  bottom: 1px; right: 1px;
  z-index: 2;
}

/* ── 7. SECTION TITLE activity counters ─────────────────────────────── */
.section-title-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #eef1f9;
  color: #19378C;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── 8. HOME LIVE STATS BAR (fixed, below ticker) ───────────────────── */
#homeLiveStats {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #f0f0f5;
  padding: 0;
  overflow: hidden;
  /* Fixed below ticker: header(56px) + ticker(32px) + safe-area */
  position: fixed;
  top: calc(88px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 998;
  height: 52px;
}
.live-stat-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  gap: 0;
  border-right: 1px solid #f0f0f5;
  min-width: 0;
  overflow: hidden;
}
.live-stat-cell:last-child { border-right: none; }
.live-stat-icon {
  font-size: 13px !important;
  color: #19378C;
  line-height: 1;
  margin-bottom: 1px;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.live-stat-num {
  font-size: 13px;
  font-weight: 800;
  color: #19378C;
  line-height: 1.15;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.live-stat-label {
  font-size: 8.5px;
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  padding: 0 3px;
  margin-top: 1px;
  line-height: 1.2;
}

/* ── 9. RECENCY PILL on section titles ──────────────────────────────── */
.recency-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}
.recency-pill.new {
  background: #e8f9f0;
  color: #1a7a47;
}
.recency-pill.hot {
  background: #fff3e0;
  color: #d35400;
}
.recency-pill-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: dotBlink 1.5s ease-in-out infinite;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── 10. CARD ENTRY WAVE (staggered pop on grid load) ──────────────── */
@keyframes cardWavePop {
  0%   { opacity: 0; transform: translateY(18px) scale(0.96); }
  60%  { transform: translateY(-3px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.product-card.wave-in {
  animation: cardWavePop 0.42s cubic-bezier(0.34,1.2,0.64,1) both;
}

/* ── 11. PROFILE ACTIVITY FEED: richer event rows ───────────────────── */
.act-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f5f5f8;
  cursor: default;
  transition: background 0.15s;
}
.act-event-row:active { background: #f8f9fd; }
.act-event-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.act-event-icon.sale   { background: #e8f9f0; }
.act-event-icon.view   { background: #f0f4ff; }
.act-event-icon.save   { background: #fdf4ff; }
.act-event-icon.post   { background: #fffbea; }
.act-event-icon.follow { background: #fef2f2; }
.act-event-body { flex: 1; min-width: 0; }
.act-event-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-event-meta {
  font-size: 10.5px;
  color: #999;
  margin-top: 2px;
}
.act-event-ago {
  font-size: 10px;
  color: #bbb;
  flex-shrink: 0;
}

/* ── 12. CATEGORY tile live count dot ───────────────────────────────── */
.cat-live-count {
  position: absolute;
  top: -3px; right: -3px;
  background: #e74c3c;
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  min-width: 14px; height: 14px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
  padding: 0 2px;
  line-height: 1;
  pointer-events: none;
}

/* ── 13. SEARCH: "X people searched this" sub-hint ─────────────────── */
.search-trend-hint {
  font-size: 10.5px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 14px 8px;
  animation: fadeInUp 0.3s ease both;
}
.search-trend-hint .material-symbols-rounded { font-size: 13px; color: #d35400; }

/* ── 14. PLASTAY section social line ────────────────────────────────── */
.plastay-social-line {
  font-size: 10.5px;
  color: #7b2d8b;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.plastay-social-line .material-symbols-rounded { font-size: 11px; }

/* ── 15. NOTIFICATION bell wiggle on new notif ──────────────────────── */
@keyframes bellWiggle {
  0%   { transform: rotate(0); }
  15%  { transform: rotate(20deg); }
  30%  { transform: rotate(-16deg); }
  45%  { transform: rotate(12deg); }
  60%  { transform: rotate(-8deg); }
  75%  { transform: rotate(4deg); }
  100% { transform: rotate(0); }
}
.bell-wiggle { animation: bellWiggle 0.6s ease both; }

/* ── 16. SHIMMER on stat numbers (count-up feel) ────────────────────── */
@keyframes numFlip {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.stat-flip { animation: numFlip 0.35s cubic-bezier(0.34,1.4,0.64,1) both; }

/* ── 17. MESSAGES: typing dots indicator ─────────────────────────────── */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  background: #f0f0f5;
  border-radius: 16px;
  height: 28px;
}
.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #999;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-4px); opacity: 1; }
}

/* ── 18. SECTION fade-in on scroll into view ────────────────────────── */
@keyframes sectionReveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-revealed {
  animation: sectionReveal 0.4s ease both;
}

/* ── 19. NAV TAB bounce on tap ──────────────────────────────────────── */
@keyframes tabBounce {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-5px) scale(1.15); }
  70%  { transform: translateY(1px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}
.tab-bounce { animation: tabBounce 0.35s cubic-bezier(0.34,1.4,0.64,1) both; }

/* ── 20. BRAND card "New goods" indicator ───────────────────────────── */
.brand-new-goods-dot {
  position: absolute;
  top: 0; right: 0;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #e74c3c;
  border: 1.5px solid #fff;
  animation: tickerPulse 1.6s ease-in-out infinite;
}

/* ── 21. fadeInUp helper (shared) ───────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 22. PRICE DISPLAY — old strikethrough + new price, side by side ─── */

/* Wrapper sits inline inside .product-price-row / .card-price-row */
.price-change-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  animation: priceTagIn 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
}

/* Old (previous) price — red + strikethrough */
.price-old {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e74c3c;
  text-decoration: line-through;
  text-decoration-color: #e74c3c;
  text-decoration-thickness: 1.5px;
  white-space: nowrap;
  line-height: 1.3;
  opacity: 0.85;
}

/* New (current) price on cards */
.price-new {
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
  line-height: 1.3;
  letter-spacing: -0.3px;
}
.price-new.price-dropped { color: #1a9e5c; }  /* green  — price went down */
.price-new.price-raised  { color: #e74c3c; }  /* red    — price went up  */

@keyframes priceTagIn {
  from { opacity: 0; transform: scale(0.8) translateY(4px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ── 23. PRICE HISTORY — product detail page & brand overlay ────────── */
#productPriceHistory,
#bpOverlayPriceHistory {
  margin-top: 2px;
  margin-bottom: 4px;
}

.price-history-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  animation: fadeInUp 0.3s ease both;
}

/* Old price in detail — red strikethrough, larger */
.price-history-row .price-old {
  font-size: 15px;
  font-weight: 700;
  color: #e74c3c;
  text-decoration: line-through;
  text-decoration-color: #e74c3c;
  text-decoration-thickness: 2px;
  opacity: 0.85;
}

/* New price in detail — bold, large, colored */
.price-history-row .price-new {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}
.price-history-row .price-new.price-dropped { color: #1a9e5c; }
.price-history-row .price-new.price-raised  { color: #e74c3c; }

/* "↓ Decreased by X%" / "↑ Increased by X%" pill */
.price-change-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.price-change-pill.pill-drop {
  background: #e8f9f0;
  color: #1a9e5c;
  border: 1px solid #a8e6c2;
}
.price-change-pill.pill-raise {
  background: #fef2f2;
  color: #e74c3c;
  border: 1px solid #f5c6c6;
}