/* ============================================
   Home Page Template - 1688 Style
   Uses --pp-* variables from main plugin
   ============================================ */

.pph-home-wrapper {
  width: 100%;
  max-width: var(--pp-container, 1370px);
  margin: 0 auto;
  padding: 0 20px;
  font-family: var(--pp-font);
  color: var(--pp-main-text);
  box-sizing: border-box;
}
.pph-home-wrapper *,
.pph-home-wrapper *::before,
.pph-home-wrapper *::after {
  box-sizing: border-box;
}

/* ======================
   TOP SECTION: Sidebar + Banner + Sub-banners
   ====================== */
.pph-top-section {
  display: flex;
  gap: 12px;
  margin-bottom: var(--partMarginBottom, 12px);
  align-items: stretch;
}

/* Category Sidebar */
.pph-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--pp-bg-white);
  border-radius: var(--pp-radius);
  overflow: visible !important;
  border: 1px solid var(--pp-border-light);
  position: relative;
  z-index: 10;
}
.pph-sidebar__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--pp-brand);
}
.pph-sidebar__icon { display: flex; align-items: center; }
.pph-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: visible !important;
}
.pph-sidebar__list::-webkit-scrollbar { width: 5px; }
.pph-sidebar__list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.pph-sidebar__item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px;
  min-height: 44px;
  color: var(--pp-main-text);
  text-decoration: none;
  transition: all 0.15s;
}
.pph-sidebar__item a:hover {
  background: var(--pp-brand-light);
  color: var(--pp-brand);
  padding-inline-start: 20px;
}
.pph-sidebar__item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pph-sidebar__item-arrow {
  color: var(--pp-tip-text);
  font-size: 16px;
}

/* ======================
   MEGA MENU (category dropdown)
   ====================== */
/* 1. Allow sub-menus to extend beyond sidebar boundaries */
.pph-sidebar--megamenu,
.pph-sidebar--megamenu .pph-sidebar__list { overflow: visible !important; }

/* 2. Set parent items as reference for absolute positioning */
.pph-sidebar__item { position: relative; }

/* 3. Floating side panel — hidden by default */
.pph-megamenu {
  display: none;
  position: absolute;
  top: 0;
  inset-inline-start: 100%;
  width: 380px;
  background: var(--pp-bg-white, #fff);
  border: 1px solid var(--pp-border, rgba(0,0,0,0.08));
  border-radius: 0 var(--pp-radius) var(--pp-radius) 0;
  box-shadow: 4px 4px 24px rgba(0,0,0,0.15);
  padding: 20px 24px;
  z-index: 10000;
}

/* 4. Show on hover */
.pph-sidebar__item--has-children:hover > .pph-megamenu,
.pph-sidebar__item--has-children:focus-within > .pph-megamenu {
  display: block;
}

/* Inner layout */
.pph-megamenu__inner { display: flex; flex-direction: column; gap: 12px; }
.pph-megamenu__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--pp-main-text);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--pp-border-light);
}
.pph-megamenu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
}
.pph-megamenu__item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  font-size: 13px;
  color: var(--pp-main-text);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.pph-megamenu__item a:hover {
  color: var(--pp-brand);
  background: var(--pp-brand-light);
  padding-inline-start: 8px;
}
.pph-megamenu__count {
  font-size: 11px;
  color: var(--pp-tip-text);
  margin-inline-start: 4px;
}
.pph-megamenu__viewall {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pp-brand);
  text-decoration: none;
  padding-top: 8px;
  border-top: 1px solid var(--pp-border-light);
}
.pph-megamenu__viewall:hover { text-decoration: underline; }

/* Main Banner Carousel */
.pph-banner {
  flex: 1;
  min-width: 0;
  position: relative;
  border-radius: var(--pp-radius);
  overflow: hidden;
  background: var(--pp-bg-gray);
  min-height: var(--home-banner-height, 360px);
}
.pph-banner__track {
  width: 100%;
  height: 100%;
  position: relative;
}
.pph-banner__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.pph-banner__slide.active { opacity: 1; }
.pph-banner__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pph-banner__slide--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}
.pph-banner__placeholder {
  text-align: center;
  color: var(--pp-tip-text);
}
.pph-banner__placeholder svg { display: block; margin: 0 auto 12px; }
.pph-banner__placeholder p { font-size: 14px; margin: 0; }

.pph-banner__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.4);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0;
  z-index: 3;
}
.pph-banner:hover .pph-banner__nav { opacity: 1; }
.pph-banner__nav:hover { background: var(--pp-brand); }
.pph-banner__prev { inset-inline-start: 16px; }
.pph-banner__next { inset-inline-end: 16px; }

.pph-banner__dots {
  position: absolute;
  bottom: 16px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}
.pph-banner__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.pph-banner__dot.active {
  background: var(--pp-brand);
  width: 20px;
  border-radius: 4px;
}
/* ======================
   SHANGJI (Products Section in Banner Area)
   1688-style grouped product cards by category
   ====================== */
.pph-shangji {
  background: var(--pp-bg-white);
  border-radius: var(--pp-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: var(--home-banner-height, 360px);
}

.pph-shangji__head {
  border-bottom: 1px solid var(--pp-border-light);
  padding: 14px 20px;
  flex-shrink: 0;
}
.pph-shangji__head-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
}
.pph-shangji__head-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--pp-main-text);
}
.pph-shangji__head-more {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--pp-brand);
  font-weight: 500;
  transition: opacity 0.2s;
}
.pph-shangji__head-more:hover { opacity: 0.8; }

.pph-shangji__container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}

.pph-shangji__card {
  background: var(--pp-bg-gray);
  border-radius: var(--pp-radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pph-shangji__card-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--pp-main-text);
  background: var(--pp-bg-white);
  border-bottom: 1px solid var(--pp-border-light);
  transition: color 0.2s;
}
.pph-shangji__card-head:hover { color: var(--pp-brand); }
.pph-shangji__card-icon { color: var(--pp-brand); display: flex; }
.pph-shangji__card-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pph-shangji__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 4px;
  flex: 1;
}

.pph-shangji__item {
  position: relative;
  display: block;
  border-radius: var(--pp-radius-sm);
  overflow: hidden;
  text-decoration: none;
  aspect-ratio: 1/1;
  background: var(--pp-bg-white);
}
.pph-shangji__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.pph-shangji__item:hover img { transform: scale(1.05); }

.pph-shangji__price {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 16px 8px 6px;
  font-family: var(--pp-font-price);
  text-align: start;
}
.pph-shangji__price del {
  color: rgba(255,255,255,0.6);
  font-weight: 400;
  font-size: 11px;
  margin-inline-start: 4px;
}

/* Responsive shangji */
@media (max-width: 1200px) {
  .pph-shangji__container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .pph-shangji__container { grid-template-columns: 1fr; }
  .pph-shangji__list { grid-template-columns: repeat(4, 1fr); }
}

/* Sub-banners */
.pph-subbanners {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pph-subbanner {
  flex: 1;
  border-radius: var(--pp-radius);
  overflow: hidden;
  display: block;
  background: var(--pp-bg-gray);
  transition: transform 0.2s;
}
.pph-subbanner:hover { transform: translateY(-2px); }
.pph-subbanner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ======================
   USER CARD (logged-out visitor panel) — 1688 style
   ====================== */
.pph-usercard {
  --userCardWidth: 320px;
  --primaryColor: #ff5b00;
  --bodyBgColor: #f3f4f6;
  font-family: 'PingFang SC', 'Microsoft Yahei', sans-serif;
  line-height: 1.35;
  -webkit-text-size-adjust: none;
  background: linear-gradient(180deg,#fce5c7,#fff4e9 23%,#fdf5ec00 33%),linear-gradient(180deg,#fff5eb,#fffdfc);
  border-radius: 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 362px;
  overflow: hidden;
  position: relative;
  width: var(--userCardWidth);
  flex: 0 0 var(--userCardWidth);
}

/* === Head (gradient orange top) === */
.pph-usercard__head {
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Greeting name */
.pph-usercard__greeting {
  display: flex;
  align-items: center;
}
.pph-usercard__greeting a {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
}
.pph-usercard__greeting a:hover { color: var(--primaryColor); }

/* Assets row (Bonus / Vouchers / Pay Later) */
.pph-usercard__assets {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pph-usercard__assets a {
  font-size: 13px;
  color: #1a1a1a;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
  transition: color 0.2s;
}
.pph-usercard__assets a:hover { color: var(--primaryColor); }

/* Shortcuts grid (Cart / Wishlist / Followed / History) */
.pph-usercard__shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.pph-usercard__shortcuts a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #333;
  text-decoration: none;
  padding: 8px 0;
  border-radius: 6px;
  text-align: center;
  transition: background 0.2s;
}
.pph-usercard__shortcuts a:hover { background: rgba(255,91,0,0.08); }
.pph-usercard__shortcuts svg {
  width: 22px;
  height: 22px;
  stroke: #1a1a1a;
  fill: none;
  stroke-width: 2;
}
.pph-usercard__shortcuts a:hover svg { stroke: var(--primaryColor); }

/* === Guide (white bottom section) === */
.pph-usercard__guide {
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  margin: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

/* Slogan */
.pph-usercard__slogan {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Feature links */
.pph-usercard__features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.pph-usercard__feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pph-usercard__feature svg {
  width: 16px;
  height: 16px;
  stroke: var(--primaryColor);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Login button */
.pph-usercard__login {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  background: linear-gradient(90deg, #ff7a18 0%, #ff5b00 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 19px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}
.pph-usercard__login:hover { opacity: 0.9; }
/* ======================
   SECTIONS (shared)
   ====================== */
.pph-section {
  background: var(--pp-bg-white);
  border-radius: var(--pp-radius-lg);
  padding: 20px 24px;
  margin-bottom: var(--partMarginBottom, 12px);
}
.pph-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pph-section__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--pp-main-text);
  margin: 0;
  position: relative;
  padding-inline-start: 12px;
}
.pph-section__title::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: var(--pp-brand);
  border-radius: 2px;
}
.pph-section__more {
  font-size: 14px;
  color: var(--pp-brand);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 8px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: opacity 0.2s;
}
.pph-section__more:hover { opacity: 0.8; }

/* ======================
   CATEGORY GRID
   ====================== */
.pph-catgrid {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 12px !important;
    padding-bottom: 10px !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}
.pph-catgrid::-webkit-scrollbar {
    display: none;
}
.pph-catgrid__item {
    flex: 0 0 auto !important;
    width: 120px !important;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-radius: var(--pp-radius);
    text-decoration: none;
    color: var(--pp-main-text);
    min-width: 0;
    overflow: hidden;
    transition: all 0.2s;
}
.pph-catgrid__item:hover {
  background: var(--pp-brand-light);
  transform: translateY(-2px);
}
.pph-catgrid__img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--pp-bg-gray);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pph-catgrid__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pph-catgrid__placeholder {
  font-size: 24px;
  font-weight: 700;
  color: var(--pp-brand);
}
.pph-catgrid__name {
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Category product count */
.pph-catgrid__count {
  font-size: 12px;
  color: var(--pp-secondary-text);
  text-align: center;
  margin-top: 2px;
}

/* ======================
   CATGRID CAROUSEL MODE (scrollable)
   ====================== */
/* ======================
   HOME PROMO BANNER
   ====================== */
.pph-home-promo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: var(--pp-radius);
  margin-bottom: var(--partMarginBottom, 12px);
}
.pph-home-promo__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--pp-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pph-home-promo__text {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--pp-main-text);
}
.pph-home-promo__link {
  color: var(--pp-brand);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.pph-home-promo__link:hover { opacity: 0.8; text-decoration: underline; }

/* ======================
   PRODUCTS GRID
   ====================== */
.pph-products-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}
.pph-product-card {
  display: flex;
  flex-direction: column;
  background: var(--pp-bg-white);
  border: 1px solid var(--pp-border-light);
  border-radius: var(--pp-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.pph-product-card:hover {
  border-color: var(--pp-brand);
  box-shadow: var(--pp-shadow-hover);
  transform: translateY(-2px);
}
.pph-product-card__img {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  position: relative;
  background: var(--pp-bg-gray);
}
.pph-product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.pph-product-card:hover .pph-product-card__img img {
  transform: scale(1.05);
}
.pph-product-card__badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: var(--pp-brand);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
}
.pph-product-card__body {
  padding: 10px 12px;
}
.pph-product-card__title {
  font-size: 13px;
  font-weight: 400;
  color: var(--pp-main-text);
  margin: 0 0 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.pph-product-card__price {
  font-size: 16px;
  font-weight: 700;
  color: var(--pp-brand);
  font-family: var(--pp-font-price);
}
.pph-product-card__price del {
  font-size: 12px;
  color: var(--pp-tip-text);
  font-weight: 400;
  margin-inline-start: 6px;
}
/* ======================
   SERVICES BAR
   ====================== */
.pph-services-bar {
  background: var(--pp-bg-white);
  border-radius: var(--pp-radius-lg);
  padding: 20px 24px;
  margin-bottom: var(--partMarginBottom, 12px);
}
.pph-services-bar__inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.pph-services-bar__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--pp-main-text);
  padding: 12px;
  border-radius: var(--pp-radius);
  background: var(--pp-bg-gray);
  transition: all 0.2s;
}
.pph-services-bar__item:hover {
  background: var(--pp-brand-light);
}
.pph-services-bar__item svg {
  color: var(--pp-brand);
  flex-shrink: 0;
}

/* ======================
   FOOTER
   ====================== */
.pph-footer {
  background: #1a1a2e;
  color: #fff;
  border-radius: var(--pp-radius-lg) var(--pp-radius-lg) 0 0;
  padding: 40px 24px 0;
  margin-top: 24px;
}
.pph-footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.pph-footer__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: #fff;
}
.pph-footer__about {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.7);
  margin: 0;
}
.pph-footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pph-footer__links li {
  margin-bottom: 10px;
}
.pph-footer__links a {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  display: inline-block;
  padding: 4px 0;
  min-height: 36px;
  transition: color 0.2s;
}
.pph-footer__links a:hover {
  color: var(--pp-brand);
}
.pph-footer__social {
  display: flex;
  gap: 12px;
}
.pph-footer__social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.2s;
}
.pph-footer__social-link:hover {
  background: var(--pp-brand);
  transform: translateY(-2px);
}
.pph-footer__bottom {
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}
.pph-footer__bottom p { margin: 0; }

/* ======================
   RESPONSIVE
   Breakpoints:
     1400px  -> wide screen adjustment
     1200px  -> normal desktop / large laptop
     1024px  -> laptop / small desktop (iPad landscape)
      768px  -> tablet portrait
      480px  -> phone
   ====================== */

/* --- Wide desktop (>1400px): keep 1370px container, comfortable spacing --- */

/* --- Wide desktop (<=1400px) --- */
@media (max-width: 1400px) {
  .pph-products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pph-shangji__container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-shangji__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --- Laptop (<=1200px) --- */
@media (max-width: 1200px) {
  .pph-products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pph-sidebar { width: 180px; }
  .pph-subbanners { width: 180px; }
  .pph-shangji__container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-shangji__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pph-section { padding: 18px 20px; }
}

/* --- Laptop / small desktop / iPad landscape (<=1024px) --- */
@media (max-width: 1024px) {
  .pph-top-section { flex-direction: column; }
  .pph-sidebar { width: 100%; }
  .pph-sidebar__list { max-height: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; }
  .pph-sidebar__item { flex: 1 1 auto; }
  .pph-sidebar__item a { padding: 10px 12px; border-radius: 4px; min-height: 44px; }
  /* Mega menu: disable dropdown on tablets, links go direct */
  .pph-megamenu { display: none !important; }
  .pph-megamenu__title { display: none; }
  .pph-megamenu__viewall { display: none; }
  .pph-subbanners { width: 100%; flex-direction: row; }
  .pph-banner { min-height: 240px; }
  .pph-products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pph-footer__inner { grid-template-columns: 1fr 1fr; }

  /* Products-in-slide mode: hide categories sidebar + ad images, give full width */
  .pph-top-section--products .pph-sidebar { display: none; }
  .pph-top-section--products .pph-subbanners { display: none; }
  .pph-top-section--products .pph-shangji { min-height: auto; }
  .pph-shangji__container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-shangji__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Tablet portrait (<=768px) --- */
@media (max-width: 768px) {
  .pph-home-wrapper { padding: 0 12px; }
  .pph-products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-catgrid { grid-template-columns: none; }
  .pph-services-bar__inner { grid-template-columns: repeat(2, 1fr); }
  .pph-footer__inner { grid-template-columns: 1fr; gap: 20px; }
  .pph-section__title { font-size: 17px; }
  .pph-subbanners { flex-direction: column; }
  .pph-section { padding: 14px 16px; }
  .pph-banner { min-height: 200px; }

  /* Products-in-slide mode: keep sidebar + ads hidden */
  .pph-top-section--products .pph-sidebar { display: none; }
  .pph-top-section--products .pph-subbanners { display: none; }
  .pph-shangji__container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-shangji__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- Phone (<=480px) --- */
@media (max-width: 480px) {
  .pph-home-wrapper { padding: 0 10px; }
  .pph-products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pph-catgrid { grid-template-columns: none; gap: 10px; }
  .pph-services-bar__inner { grid-template-columns: 1fr; gap: 10px; }
  .pph-section { padding: 12px 12px; border-radius: var(--pp-radius); }
  .pph-section__title { font-size: 16px; }
  .pph-banner { min-height: 160px; border-radius: var(--pp-radius); }
  .pph-subbanners { gap: 8px; }
  .pph-shangji__container { grid-template-columns: 1fr; }
  .pph-shangji__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pph-shangji__head { padding: 10px 14px; }
  .pph-shangji__head-title { font-size: 16px; }
  .pph-card-detailed__number { font-size: 16px; }
  .pph-card-detailed__title { font-size: 12px; }
  /* Two-column detailed cards at phone â€” make them compact */
  .pph-card-detailed { padding-bottom: 8px; }
  .pph-card-detailed__picture { aspect-ratio: 1 / 1; }
  .pph-card-detailed__img { height: 100%; }
  .pph-card-detailed__find-similar { font-size: 10px; padding: 4px 8px; }
  .pph-card-detailed__services { display: none; }
  .pph-card-detailed__company { font-size: 11px; }
  .pph-card-detailed__price-card { padding: 6px; }
}

/* RTL adjustments */
[dir="rtl"] .pph-banner__prev { transform: translateY(-50%) scaleX(-1); }
[dir="rtl"] .pph-banner__next { transform: translateY(-50%) scaleX(-1); }
[dir="rtl"] .pph-banner__nav:hover { transform: translateY(-50%) scaleX(-1); }
/* ======================
   PRODUCT CARD TEMPLATES
   ====================== */

/* --- COMPACT TEMPLATE (shangji style: image + price overlay) --- */
.pph-card-compact {
  position: relative;
  display: block;
  border-radius: var(--pp-radius-sm);
  overflow: hidden;
  text-decoration: none;
  aspect-ratio: 1/1;
  background: var(--pp-bg-white);
  transition: transform 0.2s;
}
.pph-card-compact:hover { transform: translateY(-2px); }
.pph-card-compact img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.pph-card-compact:hover img { transform: scale(1.05); }
.pph-card-compact__price {
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 1px;
  font-family: var(--pp-font-price);
}
.pph-card-compact__currency { font-size: 12px; }
.pph-card-compact__amount { font-size: 15px; }

/* --- DETAILED TEMPLATE (full card: image + title + price + services + store) --- */
.pph-card-detailed {
  background-color: var(--pp-bg-white);
  border-radius: var(--pp-radius);
  cursor: pointer;
  overflow: hidden;
  padding-bottom: 10px;
  position: relative;
  transition: box-shadow 0.3s ease, transform 0.2s;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--pp-border-light);
}
.pph-card-detailed:hover {
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.pph-card-detailed__picture {
  border-radius: 0 0 var(--pp-radius) var(--pp-radius);
  overflow: hidden;
  padding-top: 100%;
  position: relative;
  transition: all 0.5s ease;
  width: 100%;
}
.pph-card-detailed__picture a {
  position: absolute;
  inset: 0;
  display: block;
}
.pph-card-detailed__img {
  height: 100%;
  left: 0;
  object-fit: cover;
  position: absolute;
  top: 0;
  transition: all 0.5s ease;
  width: 100%;
}
.pph-card-detailed__picture:hover .pph-card-detailed__img {
  transform: scale(1.05);
}

/* Find similar button (shows on hover) */
.pph-card-detailed__find-similar {
  bottom: 12px;
  box-sizing: border-box;
  display: none;
  height: 32px;
  inset-inline-start: 0;
  padding: 0 14px;
  position: absolute;
  width: 100%;
  z-index: 99;
}
.pph-card-detailed__picture:hover .pph-card-detailed__find-similar {
  display: block;
}
.pph-card-detailed__find-similar-link { height: 100%; }
.pph-card-detailed__find-similar-btn {
  align-items: center;
  background: var(--pp-brand);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  height: 100%;
  justify-content: center;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
  transition: background 0.2s;
}
.pph-card-detailed__find-similar-btn:hover {
  background: var(--pp-brand-hover);
}

/* Discount badge */
.pph-card-detailed__badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: var(--pp-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  z-index: 2;
}

/* Title */
.pph-card-detailed__title-wrap {
  height: 24px;
  line-height: 24px;
  padding: 0 8px;
  margin-top: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pph-card-detailed__icon-tag {
  background: var(--pp-brand-light);
  color: var(--pp-brand);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  flex-shrink: 0;
  line-height: 18px;
}
.pph-card-detailed__title {
  font-size: 14px;
  font-weight: 400;
  color: var(--pp-main-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.pph-card-detailed__title:hover { color: var(--pp-brand); }

/* Price */
.pph-card-detailed__price-card {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  height: 26px;
  line-height: 26px;
  overflow: hidden;
  padding: 0 8px;
  margin-top: 6px;
}
.pph-card-detailed__price {
  display: flex;
  align-items: baseline;
  transform: translateY(1px);
}
.pph-card-detailed__symbol {
  color: var(--pp-brand);
  font-family: var(--pp-font-price);
  font-size: 16px;
  font-weight: 700;
  margin-inline-end: 2px;
}
.pph-card-detailed__number {
  color: var(--pp-brand);
  font-family: var(--pp-font-price);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}
.pph-card-detailed__price-other {
  color: #999;
  font-size: 13px;
  margin-inline-start: 6px;
}
.pph-card-detailed__price-unit {
  color: #999;
  font-size: 13px;
  margin-inline-start: 4px;
}

/* Services */
.pph-card-detailed__services {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  height: 20px;
  overflow: hidden;
  padding: 0 8px;
  margin-top: 6px;
  gap: 4px;
}
.pph-card-detailed__service-item {
  align-items: center;
  display: flex;
  color: #999;
  font-size: 13px;
}
.pph-card-detailed__service-item--brand {
  color: var(--pp-brand);
}

/* Promo badges */
.pph-card-detailed__promo-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  animation: pph-promo-pulse 2s ease-in-out infinite;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
@keyframes pph-promo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Countdown timer */
.pph-card-detailed__countdown {
  margin: 6px 8px 0;
  padding: 6px 8px;
  background: rgba(26, 43, 60, 0.05);
  border: 1px solid #1A2B3C;
  border-radius: 6px;
  text-align: center;
}
.pph-card-detailed__countdown--evergreen {
  background: linear-gradient(135deg, rgba(255,91,0,0.08), rgba(194,23,0,0.05));
  border: 1px solid #FF5B00;
  animation: pph-evergreen-glow 3s ease-in-out infinite;
}
@keyframes pph-evergreen-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,91,0,0.1); }
  50% { box-shadow: 0 0 8px 2px rgba(255,91,0,0.15); }
}
.pph-card-detailed__countdown--fixed {
  background: linear-gradient(135deg, rgba(34,197,94,0.08), rgba(22,163,74,0.05));
  border: 1px solid #22c55e;
}
.pph-card-detailed__countdown-text {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}
.pph-card-detailed__countdown-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.pph-cd-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 28px;
}
.pph-cd-unit b {
  font-size: 13px;
  font-weight: 800;
  color: #1A2B3C;
  line-height: 1;
}
.pph-cd-unit small {
  font-size: 9px;
  color: #999;
  margin-top: 1px;
}
.pph-cd-sep {
  font-size: 12px;
  font-weight: 700;
  color: #999;
}

/* Company/Store */
.pph-card-detailed__company {
  align-items: center;
  color: #999;
  display: flex;
  height: 24px;
  overflow: hidden;
  padding: 0 8px;
  text-decoration: none;
  margin-top: 6px;
  transition: color 0.2s;
}
.pph-card-detailed__company:hover { color: var(--pp-brand); }
.pph-card-detailed__company-icon {
  height: 14px;
  margin-inline-end: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.pph-card-detailed__company-name {
  color: #999;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pph-card-detailed__company:hover .pph-card-detailed__company-name {
  color: var(--pp-brand);
}

/* Responsive */
@media (max-width: 768px) {
  .pph-card-detailed__number { font-size: 18px; }
  .pph-card-detailed__title { font-size: 13px; }
  .pph-card-detailed__find-similar { display: block !important; }
}

/* Shangji list adapts to card template */
.pph-shangji__list .pph-card-compact {
  border-radius: var(--pp-radius-sm);
}
.pph-shangji__list .pph-card-detailed {
  margin-bottom: 0;
}
/* When detailed cards are used in shangji, switch to single column */
.pph-shangji__list:has(.pph-card-detailed) {
  grid-template-columns: 1fr;
  gap: 6px;
}