/* base.css - Auto-split from styles.css */
.wrap {
  max-width: 1280px;
  margin: 28px auto 80px;
  padding: 0 40px;
}

/* KREAM Logo */
.logo {
  margin-bottom: 8px;
  padding-left: 40px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  display: inline-block;
}

.logo:hover {
  opacity: 0.8;
}

.logo:active {
  opacity: 0.6;
}

/* 搜索头部 */
.search_hdr {
    padding-top: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.ipt {
    width: 480px;
    border: none;
    outline: none;
    color: #000;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 29px;
    padding: 0 190px 0 5px;
    background: transparent;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}

.ipt::placeholder {
  color: #9c9c9c;
}

.btn-clear {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 20px;
  height: 20px;
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
}

.btn-clear::before,
.btn-clear::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 2px;
  background: #9c9c9c;
  top: 50%;
  left: 50%;
}

.btn-clear::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.btn-clear::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-clear:hover::before,
.btn-clear:hover::after {
  background: #666;
}

/* 区块样式 */
.section {
  margin-top: 24px;
}

.section .title {
  font-size: 16px;
  font-weight: 700;
  margin: 14px 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title .ts {
  font-weight: 400;
  font-size: 12px;
  color: var(--sub);
}

/* 搜索结果 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px 16px;
  margin-top: 24px;
}

/* 商品卡片 */
.product-card {
  background: white;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  border: none;
  transition: all 0.2s ease;
  cursor: pointer;
  min-width: 0;
}

.product-card:hover {
  transform: none;
  box-shadow: none;
}

.product-image {
  width: 100%;
  aspect-ratio: 1;
  background: #f4f4f4;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* 图片占位符样式 */
.product-image-placeholder {
  width: 100%;
  height: 100%;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image-placeholder .loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #222;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.product-image-placeholder .loading-text {
  font-size: 14px;
  color: #666;
  font-family: var(--font-primary);
}

.product-image-placeholder .error-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.product-image-placeholder .error-icon {
  font-size: 24px;
  color: #dc2626;
}

.product-image-placeholder .error-text {
  font-size: 12px;
  color: #dc2626;
  font-family: var(--font-primary);
}

/* 加载中占位符样式 */
.product-image-placeholder .loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.product-image-placeholder .loading-placeholder .loading-text {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
  font-weight: 500;
}

.product-card:hover .product-image img {
  transform: scale(1.02);
}

.product-status {
  position: absolute;
  top: 6px;
  right: 4px;
  background: transparent;
  color: rgb(78, 78, 78);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.product-info {
  padding: 12px 0;
}

.product-brand {
  font-size: 12px;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
  line-height: 1.2;
}

.product-name {
  font-size: 13px;
  font-weight: 400;
  color: #222;
  margin-bottom: 4px;
  line-height: 1.3;
  /* 预留两行高度，确保价格在同一基线 */
  min-height: calc(1.3em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-translated-name {
  font-size: 11px;
  color: #a7a7a7;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

/* 快速配送和쿠폰标签 */
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.product-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  padding: 0 4px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 500;
}

.product-tag.delivery {
  background: #f2f9f6;
  color: #31b46e;
}

.product-tag.coupon {
  background: #f4f4f4;
  color: #828b9d;
}

.product-price {
  font-size: 14px;
  font-weight: 700;
  color: #222;
  margin-bottom: 8px;
  line-height: 1.2;
}

.product-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #666;
  line-height: 1.2;
}

.product-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 分页控制 */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 20px 0;
  border-top: 1px solid var(--chip-bg);
  margin-top: 30px;
}

.pagination-info {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--sub);
}

.pagination-controls {
  display: flex;
  gap: 12px;
}

.page-btn {
  padding: 12px 20px;
  border: 2px solid var(--text);
  background: var(--text);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-left: 12px;
}

.page-btn:hover:not(:disabled) {
  background: white;
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--sub);
}

.search-loading {
  text-align: center;
  margin-top: 120px;
  padding: 80px 20px;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--text);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  font-size: 18px;
  color: var(--sub);
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--sub);
  border-radius: 50%;
  animation: dots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dots {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* 小尺寸 loading-spinner（详情页等上下文） */
.detail-loading .loading-spinner,
.search-loading ~ .loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
