/* ========================================
   Temu Style — moonstore.app
   ======================================== */

:root {
  --temu-orange: #FF6B00;
  --temu-orange-dark: #E85D00;
  --temu-orange-light: #FFECE0;
  --temu-red: #FF3B30;
  --temu-red-light: #FFF0F0;
  --temu-bg: #FFF8F0;
  --temu-card-bg: #FFFFFF;
  --temu-text: #1A1A1A;
  --temu-text-muted: #6B6B6B;
  --temu-border: #F0E6DD;
  --temu-shadow: 0 2px 8px rgba(0,0,0,0.06);
  --temu-shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --temu-radius: 12px;
  --temu-radius-sm: 8px;
  --temu-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --temu-transition: 0.2s ease;
}

/* Base */
body {
  background: var(--temu-bg);
  font-family: var(--temu-font);
  margin: 0;
  padding-top: 60px;
}

/* ========================================
   Header
   ======================================== */
.temu-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid var(--temu-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.temu-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.temu-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.temu-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.temu-menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--temu-text);
  border-radius: 2px;
}

.temu-logo {
  display: block;
  flex-shrink: 0;
}

.temu-logo img {
  display: block;
  max-height: 40px;
  width: auto;
}

.temu-header-center {
  flex: 1;
  min-width: 0;
  position: relative;
}

.temu-search-container {
  position: relative;
}

.temu-search-form {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color var(--temu-transition);
}

.temu-search-form:focus-within {
  border-color: var(--temu-orange);
  background: #fff;
}

.temu-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 14px;
  outline: none;
  color: var(--temu-text);
  font-family: var(--temu-font);
  min-width: 0;
}

.temu-search-input::placeholder {
  color: var(--temu-text-muted);
}

.temu-search-btn {
  background: none;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--temu-text-muted);
  display: flex;
  align-items: center;
  transition: color var(--temu-transition);
}

.temu-search-btn:hover {
  color: var(--temu-orange);
}

/* Live search dropdown */
.temu-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--temu-radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 1001;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.temu-search-dropdown.active {
  display: block;
}

.temu-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--temu-text);
  border-bottom: 1px solid var(--temu-border);
  transition: background var(--temu-transition);
}

.temu-search-item:last-child {
  border-bottom: none;
}

.temu-search-item:hover {
  background: var(--temu-bg);
}

.temu-search-item-img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #f5f5f5;
}

.temu-search-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.temu-search-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.temu-search-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--temu-red);
}

.temu-search-all {
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--temu-orange);
  border-top: 1px solid var(--temu-border);
  padding: 12px;
}

.temu-search-all:hover {
  background: var(--temu-orange-light);
}

.temu-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.temu-header-cart {
  position: relative;
  color: var(--temu-text);
  text-decoration: none;
  padding: 6px;
  transition: color var(--temu-transition);
}

.temu-header-cart:hover {
  color: var(--temu-orange);
}

.temu-cart-count {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--temu-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.temu-header-spacer {
  height: 0;
}

@media (max-width: 479px) {
  body {
    padding-top: 52px;
  }
  .temu-header-inner {
    height: 48px;
    padding: 0 8px;
    gap: 8px;
  }
  .temu-logo img {
    max-height: 32px;
  }
  .temu-search-input {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* ========================================
   Product Card
   ======================================== */
.temu-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
  padding: 0 12px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 480px) { .temu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) { .temu-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .temu-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }

.temu-card {
  background: var(--temu-card-bg);
  border-radius: var(--temu-radius);
  overflow: hidden;
  box-shadow: var(--temu-shadow);
  transition: box-shadow var(--temu-transition), transform var(--temu-transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.temu-card:hover {
  box-shadow: var(--temu-shadow-hover);
  transform: translateY(-2px);
}

.temu-card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f5f5;
}

.temu-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.temu-card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.temu-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  text-transform: uppercase;
}

.temu-badge-discount {
  background: var(--temu-red);
  color: #fff;
}

.temu-badge-new {
  background: var(--temu-orange);
  color: #fff;
}

.temu-badge-top {
  background: #FFD700;
  color: #1A1A1A;
}

.temu-card-countdown {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  padding: 20px 8px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 2;
}

.temu-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.temu-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--temu-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  min-height: 34px;
}

.temu-card-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.temu-price-current {
  font-size: 18px;
  font-weight: 700;
  color: var(--temu-red);
  line-height: 1;
}

.temu-price-regular {
  font-size: 13px;
  color: var(--temu-text-muted);
  text-decoration: line-through;
  line-height: 1;
}

.temu-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--temu-text-muted);
}

.temu-sold-count {
  display: flex;
  align-items: center;
  gap: 4px;
}

.temu-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--temu-orange);
  color: #fff;
  border: none;
  border-radius: var(--temu-radius-sm);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background var(--temu-transition);
  text-decoration: none;
}

.temu-btn:hover {
  background: var(--temu-orange-dark);
  color: #fff;
}

.temu-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ========================================
   Archive / Catalog header
   ======================================== */
.temu-catalog-header {
  padding: 20px 12px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.temu-catalog-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--temu-text);
}

.temu-catalog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Override WooCommerce result count */
.woocommerce .woocommerce-result-count,
.temu-result-count {
  font-size: 13px;
  color: var(--temu-text-muted);
  float: none;
  margin: 0;
}

/* Override WooCommerce ordering */
.woocommerce .woocommerce-ordering {
  float: none;
  margin: 0;
}

.woocommerce .woocommerce-ordering select,
.temu-orderby {
  padding: 6px 12px;
  border: 1px solid var(--temu-border);
  border-radius: var(--temu-radius-sm);
  font-size: 13px;
  color: var(--temu-text);
  background: var(--temu-card-bg);
  cursor: pointer;
}

/* Override WooCommerce breadcrumb */
.woocommerce .woocommerce-breadcrumb {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 12px 0;
  font-size: 12px;
  color: var(--temu-text-muted);
}

.woocommerce .woocommerce-breadcrumb a {
  color: var(--temu-orange);
  text-decoration: none;
}

/* Hide default WooCommerce page title (we have our own) */
.woocommerce-products-header {
  display: none;
}

/* Override WooCommerce notices */
.woocommerce .woocommerce-notices-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

.woocommerce .woocommerce-message,
.woocommerce .woocommerce-info {
  border-top-color: var(--temu-orange);
}

.woocommerce .woocommerce-message::before,
.woocommerce .woocommerce-info::before {
  color: var(--temu-orange);
}

.temu-pagination,
.woocommerce nav.woocommerce-pagination {
  padding: 24px 12px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.woocommerce nav.woocommerce-pagination ul {
  display: flex;
  justify-content: center;
  gap: 6px;
  border: none;
  margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li {
  border: none;
  margin: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--temu-border);
  border-radius: var(--temu-radius-sm);
  font-size: 13px;
  text-decoration: none;
  color: var(--temu-text);
  background: var(--temu-card-bg);
}

.woocommerce nav.woocommerce-pagination ul li span.current {
  background: var(--temu-orange);
  color: #fff;
  border-color: var(--temu-orange);
}

/* Override WooCommerce product grid (in case any UL wrapping leaks) */
.woocommerce ul.products {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  column-gap: normal;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
  display: none;
}

.woocommerce ul.products li.product {
  float: none;
  width: auto !important;
  margin: 0 !important;
  padding: 0;
  clear: none;
}

.woocommerce-page .content-area,
.woocommerce-page .site-main {
  max-width: 100%;
}

/* Remove any parent theme sidebar interference */
.woocommerce-page #primary,
.woocommerce-page #main {
  width: 100%;
  float: none;
  padding: 0;
}

/* Hide parent theme page header/banner */
.page-header,
.breadcrumbs,
.vw-page-title,
.vw-breadcrumb {
  display: none;
}

/* ========================================
   Single Product
   ======================================== */
.temu-single-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .temu-single-wrapper {
    grid-template-columns: 1fr 1fr;
  }
}

.temu-gallery {
  position: sticky;
  top: 20px;
}

.temu-gallery-main {
  border-radius: var(--temu-radius);
  overflow: hidden;
  margin-bottom: 12px;
  aspect-ratio: 1 / 1;
  background: #f5f5f5;
}

.temu-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.temu-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.temu-gallery-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.temu-gallery-thumbs img.active {
  border-color: var(--temu-orange);
}

.temu-single-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.temu-single-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.temu-single-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--temu-text);
  margin: 0;
  line-height: 1.3;
}

.temu-single-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.temu-single-price .price-current {
  font-size: 32px;
  font-weight: 800;
  color: var(--temu-red);
}

.temu-single-price .price-regular {
  font-size: 16px;
  color: var(--temu-text-muted);
  text-decoration: line-through;
}

.temu-single-price .price-discount {
  font-size: 13px;
  font-weight: 600;
  color: var(--temu-red);
  background: var(--temu-red-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.temu-social-proof {
  font-size: 13px;
  color: var(--temu-text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.temu-social-proof strong {
  color: var(--temu-text);
}

.temu-flash-countdown {
  background: var(--temu-red-light);
  border: 1px solid var(--temu-red);
  border-radius: var(--temu-radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.temu-flash-countdown .countdown-label {
  color: var(--temu-red);
}

.temu-flash-countdown .countdown-timer {
  color: var(--temu-red);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.temu-variations select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--temu-border);
  border-radius: var(--temu-radius-sm);
  font-size: 14px;
  background: var(--temu-card-bg);
}

.temu-quantity {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--temu-border);
  border-radius: var(--temu-radius-sm);
  overflow: hidden;
  width: fit-content;
}

.temu-quantity button {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.temu-quantity input {
  width: 48px;
  height: 36px;
  border: none;
  border-left: 1px solid var(--temu-border);
  border-right: 1px solid var(--temu-border);
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

/* ========================================
   Homepage
   ======================================== */
.hero-section {
  background: linear-gradient(135deg, var(--temu-orange) 0%, var(--temu-orange-dark) 100%);
  color: #fff;
  padding: 40px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}

.hero-section p {
  font-size: 14px;
  opacity: 0.9;
  margin: 0 0 20px;
}

.hero-section .hero-btn {
  display: inline-block;
  padding: 12px 32px;
  background: #fff;
  color: var(--temu-orange);
  border-radius: 24px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: transform var(--temu-transition);
}

.hero-section .hero-btn:hover {
  transform: scale(1.05);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--temu-text);
  margin: 0 0 16px;
  padding: 0 12px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.section-flash {
  background: var(--temu-red-light);
  padding: 24px 0;
  margin: 24px 0;
}

.section-flash .section-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.flash-global-countdown {
  font-size: 14px;
  color: var(--temu-red);
  font-weight: 600;
}

.flash-global-countdown .countdown-timer {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.categories-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 12px 8px;
  max-width: 1200px;
  margin: 0 auto;
  -webkit-overflow-scrolling: touch;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  text-decoration: none;
  color: var(--temu-text);
}

.category-chip .cat-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--temu-card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--temu-shadow);
  overflow: hidden;
}

.category-chip .cat-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-chip .cat-label {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

/* ========================================
   Toast Notification
   ======================================== */
.temu-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--temu-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.temu-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========================================
   Mobile Bottom Cart Bar
   ======================================== */
.temu-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--temu-card-bg);
  padding: 10px 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  z-index: 100;
}

@media (max-width: 767px) {
  .temu-bottom-bar {
    display: block;
  }
}

.temu-bottom-bar .temu-btn {
  font-size: 16px;
  padding: 14px;
}

/* ========================================
   Responsive helpers
   ======================================== */
@media (max-width: 479px) {
  .temu-card-title {
    font-size: 12px;
  }
  .temu-price-current {
    font-size: 16px;
  }
  .temu-single-title {
    font-size: 18px;
  }
}
