/* ============================================================================
   现代化蓝色系浅色主题 - 商城 UI 升级（手机端优化版）
   ============================================================================
   设计理念：清新大方、卡片式布局、大图标、现代化渐变
   色系：蓝色系（#165DFF 为主色）
   手机优化：常用功能双排显示、搜索栏仅显示放大镜图标
   ============================================================================ */

:root {
  /* 颜色变量 */
  --bg: #f0f4f9;                    /* 浅蓝灰背景 */
  --card: #ffffff;                  /* 卡片白色 */
  --text: #1a2332;                  /* 深色文字 */
  --text-secondary: #5a6b7d;        /* 次级文字 */
  --text-muted: #8a96a6;            /* 淡化文字 */
  --line: #e0e8f0;                  /* 分割线 */
  --brand: #165DFF;                 /* 主品牌色 - 科技蓝 */
  --brand-light: #e8f0ff;           /* 浅蓝背景 */
  --brand-dark: #0b3d91;            /* 深蓝 */
  --brand-gradient: linear-gradient(135deg, #0b3d91 0%, #165DFF 100%);
  --success: #10b981;               /* 成功绿 */
  --danger: #ef4444;                /* 危险红 */
  --warning: #f59e0b;               /* 警告黄 */
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(22, 93, 255, 0.08);
  --shadow-lg: 0 8px 24px rgba(22, 93, 255, 0.12);
  --shadow-xl: 0 12px 32px rgba(22, 93, 255, 0.15);
  
  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* 间距 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
}

/* ============================================================================
   基础样式
   ============================================================================ */

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  margin-top: 0;
  padding-top: 0;
}

/* ============================================================================
   导航栏 - 顶部应用栏
   ============================================================================ */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand-gradient);
  color: #fff;
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.appbar .row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.app-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50vw;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.muted {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
}

/* 图标按钮 */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.badge {
  position: relative;
}

.badge .dot {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid #fff;
  box-shadow: var(--shadow-md);
}

/* 搜索栏 - 优化版本 */
.searchbar {
  margin-top: var(--spacing-md);
  display: flex;
  gap: var(--spacing-md);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.searchbar input {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0 var(--spacing-md);
  outline: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 500;
  transition: all 0.2s ease;
}

.searchbar input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.searchbar input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

/* 搜索按钮 - 仅显示放大镜图标 */
.searchbar button {
  height: 44px;
  width: 44px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.searchbar button:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.searchbar button svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

/* ============================================================================
   卡片组件
   ============================================================================ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-light);
}

.card.p {
  padding: var(--spacing-lg);
}

/* ============================================================================
   分区标题
   ============================================================================ */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
  position: relative;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--brand-gradient);
  border-radius: 2px;
  flex-shrink: 0;
}

.section-title .more {
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.section-title .more::after {
  content: '›';
  font-size: 16px;
  line-height: 1;
}

/* ============================================================================
   分类宫格 - 卡片式布局
   ============================================================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 1200px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 960px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .app-tile {
    padding: 10px 6px;
    gap: 6px;
  }

  .app-tile .icon {
    width: 40px;
    height: 40px;
  }

  .app-tile .icon svg {
    width: 20px;
    height: 20px;
  }

  .app-tile .name {
    font-size: 11px;
  }
}

/* 分类卡片 */
.app-tile {
  padding: 14px 10px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(22, 93, 255, 0.06) 0%, rgba(22, 93, 255, 0.01) 100%);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.app-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
  background: linear-gradient(135deg, rgba(22, 93, 255, 0.12) 0%, rgba(22, 93, 255, 0.04) 100%);
}

.app-tile .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  box-shadow: 0 3px 10px rgba(22, 93, 255, 0.28);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.app-tile:hover .icon {
  transform: scale(1.08) rotate(4deg);
  box-shadow: 0 5px 14px rgba(22, 93, 255, 0.38);
}

.app-tile .icon svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.app-tile .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.app-tile .name {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text);
  word-break: break-all;
}

.app-tile .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* ============================================================================
   Banner 区域 - 现代化设计
   ============================================================================ */

.banner {
  min-height: 160px;
  border-radius: var(--radius-xl);
  background: var(--brand-gradient);
  color: #fff;
  padding: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  position: relative;
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-xl);
}

/* Banner 背景装饰 */
.banner::before {
  content: "";
  position: absolute;
  right: -100px;
  top: -100px;
  width: 300px;
  height: 300px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.banner::after {
  content: "";
  position: absolute;
  left: -80px;
  bottom: -80px;
  width: 250px;
  height: 250px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.banner > * {
  position: relative;
  z-index: 2;
}

.banner .t1 {
  font-weight: 800;
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 var(--spacing-md) 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.banner .t2 {
  font-size: 14px;
  opacity: 0.95;
  line-height: 1.6;
  margin: 0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.banner .cta {
  margin-top: var(--spacing-lg);
}

.banner .cta a {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-md);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  transition: all 0.3s ease;
  cursor: pointer;
}

.banner .cta a:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   快捷入口 - 功能按钮（手机端双排显示）
   ============================================================================ */

.quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 960px) {
  .quick {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 手机端：双排显示（2 列） */
@media (max-width: 520px) {
  .quick {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }
}

.quick a {
  padding: 24px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: var(--brand);
  box-shadow: 0 2px 10px rgba(22,93,255,0.07);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-direction: column;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.quick a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
}

.quick a:hover {
  border-color: var(--brand);
  transform: translateY(-5px);
  box-shadow: 0 10px 24px rgba(22,93,255,0.18);
  color: #fff;
}

.quick a:hover::before {
  opacity: 1;
}

.quick a > * {
  position: relative;
  z-index: 1;
}

.quick a svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.quick a:hover svg {
  transform: scale(1.15);
}

/* ============================================================================
   商品卡片列表
   ============================================================================ */

/* 商品卡片 — 淘宝风格：图片在上1:1、信息在下 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: var(--spacing-xl);
}

@media (min-width: 960px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

.pcard {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
  padding: 0;
}

.pcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(22,93,255,.14);
  border-color: var(--brand-light);
}

/* 旧布局 top 行隐藏 */
.pcard .top { display: none !important; }

/* 1:1 商品主图（淘宝风格） */
.pimg {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f5f7fb;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  display: block;
  border-radius: 0;
  border: none;
  height: auto;
}

.pimg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.pcard:hover .pimg img { transform: scale(1.04); }

/* 无图占位符 */
.pimg-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  color: #93c5fd;
  font-weight: 800;
  font-size: 12px;
  gap: 6px;
}

.pimg-placeholder svg { width: 36px; height: 36px; fill: #93c5fd; opacity: .7; }

/* 卡片信息区 */
.pcard-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pmeta {
  flex: 1;
  min-width: 0;
}

.pname {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 var(--spacing-sm) 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.psub {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price {
  margin-top: auto;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  /* 高度自适应，兼容登录/未登录两种价格展示 */
  min-height: 36px;
  flex-wrap: nowrap;
}

/* 未登录时的登录按钮 - 手机端优化 */
.login-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e8ecf1 100%);
  border: 1px solid #d0d8e0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #64748b;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.4;
}

.price-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  overflow: hidden;
}

.price-main {
  font-weight: 800;
  color: #e4393c;
  font-size: 15px;
  line-height: 1;
}

.price-old {
  font-size: 11px;
  color: #94a3b8;
  text-decoration: line-through;
}

.price-none {
  font-size: 12px;
  color: #94a3b8;
}

.price-arrow {
  font-size: 11px;
  color: #94a3b8;
  flex-shrink: 0;
  font-weight: 500;
}

.price .v {
  font-weight: 800;
  color: var(--brand);
  font-size: 18px;
  line-height: 1;
}

.price .u {
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================================================
   按钮组件
   ============================================================================ */

.btn {
  border: 0;
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-lg);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn.primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(22, 93, 255, 0.4);
}

.btn.ghost {
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid #dbeafe;
}

.btn.ghost:hover {
  background: #dbeafe;
  border-color: var(--brand);
}

/* ============================================================================
   表格
   ============================================================================ */

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
}

.table th {
  color: var(--text-secondary);
  font-weight: 700;
  background: var(--brand-light);
}

/* ============================================================================
   数量步进器
   ============================================================================ */

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card);
}

.stepper button {
  width: 40px;
  height: 40px;
  border: 0;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  transition: all 0.2s;
  font-size: 16px;
}

.stepper button:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.stepper input {
  width: 70px;
  height: 40px;
  border: 0;
  text-align: center;
  outline: none;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
}

/* ============================================================================
   底部固定操作栏
   ============================================================================ */

.bottom-bar {
  position: sticky;
  bottom: 0;
  z-index: 15;
  margin-top: var(--spacing-xl);
  background: rgba(240, 244, 249, 0.9);
  backdrop-filter: blur(10px);
  padding: var(--spacing-md);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

/* ============================================================================
   响应式设计
   ============================================================================ */

@media (max-width: 768px) {
  .appbar .row {
    flex-wrap: wrap;
  }

  .app-title {
    max-width: 100%;
  }

  .searchbar {
    max-width: 100%;
    order: 3;
    flex-basis: 100%;
  }

  .section-title h2 {
    font-size: 16px;
  }

  .banner {
    min-height: 140px;
    padding: var(--spacing-lg);
  }

  .banner .t1 {
    font-size: 24px;
  }

  .banner .t2 {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: var(--spacing-md);
  }

  .banner {
    min-height: 120px;
    padding: var(--spacing-md);
  }

  .banner .t1 {
    font-size: 20px;
  }

  .banner .t2 {
    font-size: 12px;
  }

  .app-tile .icon {
    width: 48px;
    height: 48px;
  }

  .app-tile .icon svg {
    width: 24px;
    height: 24px;
  }

  .pimg {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  /* 手机端搜索栏优化 */
  .searchbar {
    gap: var(--spacing-sm);
  }

  .searchbar input {
    height: 40px;
    font-size: 14px;
    padding: 0 var(--spacing-md);
  }

  .searchbar button {
    height: 40px;
    width: 40px;
  }

  /* 手机端常用功能优化 - 双排显示 */
  .quick {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }

  .quick a {
    padding: var(--spacing-md);
    font-size: 12px;
    gap: var(--spacing-sm);
  }

  .quick a svg {
    width: 18px;
    height: 18px;
  }
}
