/* ========== 首页 ========== */
.home-header {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: var(--space-md) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-md));
  color: white;
}

.location-bar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.location-icon {
  width: 16px;
  height: 16px;
}

.location-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-sm) var(--space-md);
  gap: var(--space-sm);
}

.search-input {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.search-btn {
  padding: var(--space-xs) var(--space-md);
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* Banner轮播 */
.banner-swiper {
  margin: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  height: 180px;
}

.banner-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-dots {
  position: absolute;
  bottom: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.5);
  transition: all 0.3s;
}

.banner-dot.active {
  width: 16px;
  background: white;
}

/* 分类网格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.category-name {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* 公告栏 */
.notice-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
}

.notice-icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.notice-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.notice-btn {
  padding: var(--space-xs) var(--space-sm);
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Tab切换 */
.tab-nav {
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  margin-top: var(--space-sm);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-nav-item {
  font-size: var(--text-base);
  color: var(--text-secondary);
  white-space: nowrap;
  padding-bottom: var(--space-sm);
  position: relative;
  font-weight: 500;
}

.tab-nav-item.active {
  color: var(--primary);
}

.tab-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  gap: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 2px;
}

.filter-item.active {
  color: var(--primary);
  font-weight: 500;
}

.filter-tags {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
}

/* 商家卡片 */
.store-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.store-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.store-info {
  flex: 1;
  min-width: 0;
}

.store-name {
  font-size: var(--text-lg);
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.store-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.store-rating {
  color: var(--accent);
  font-weight: bold;
}

.store-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.store-delivery {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* ========== 店铺详情页 ========== */
.store-header {
  position: relative;
  height: 200px;
}

.store-header-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-header-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xl) var(--space-lg) var(--space-md);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
}

.store-header-name {
  font-size: var(--text-xl);
  font-weight: bold;
}

.store-header-meta {
  display: flex;
  gap: var(--space-md);
  font-size: var(--text-sm);
  margin-top: var(--space-xs);
  opacity: 0.9;
}

.store-notice {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--tag-bg);
  font-size: var(--text-sm);
  color: var(--tag-text);
}

/* 店铺左右分栏 */
.store-layout {
  display: flex;
  height: calc(100vh - 200px - 56px);
}

.store-sidebar {
  width: 80px;
  background: var(--bg);
  overflow-y: auto;
}

.store-menu-item {
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  position: relative;
}

.store-menu-item.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 500;
}

.store-menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.store-menu-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  border-radius: var(--radius-full);
}

.store-content {
  flex: 1;
  overflow-y: auto;
  background: var(--surface);
}

.food-section-title {
  padding: var(--space-md);
  font-size: var(--text-sm);
  font-weight: bold;
  color: var(--text-secondary);
  background: var(--bg);
}

.food-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--divider);
}

.food-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.food-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.food-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.food-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.food-sales {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.food-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-sm);
}

/* 购物车底部栏 */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--tab-bar-height);
  background: var(--surface);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 600;
}

.cart-icon-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: var(--shadow-primary);
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: white;
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.cart-info {
  flex: 1;
  margin-left: var(--space-md);
}

.cart-price {
  font-size: var(--text-lg);
  font-weight: bold;
  color: var(--text-primary);
  font-family: var(--font-num);
}

.cart-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.cart-submit {
  padding: var(--space-sm) var(--space-xl);
  background: var(--primary);
  color: white;
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  font-weight: bold;
}

.cart-submit.disabled {
  background: var(--border);
  color: var(--text-tertiary);
}

/* ========== 结算页 ========== */
.checkout-address {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
}

.address-icon {
  width: 40px;
  height: 40px;
  background: var(--tag-bg);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.address-icon img {
  width: 20px;
  height: 20px;
}

.address-info {
  flex: 1;
}

.address-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.address-detail {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.address-arrow {
  color: var(--text-tertiary);
}

/* 订单商品列表 */
.order-store {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg) 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.order-items {
  background: var(--surface);
  margin: 0 var(--space-lg);
  padding: 0 var(--space-lg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.order-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--divider);
}

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

.order-item-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.order-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.order-item-name {
  font-size: var(--text-base);
  color: var(--text-primary);
}

.order-item-price {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-family: var(--font-num);
}

.order-item-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* 费用明细 */
.fee-detail {
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
}

.fee-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.fee-row.total {
  border-top: 1px solid var(--divider);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  font-size: var(--text-lg);
  font-weight: bold;
  color: var(--text-primary);
}

.fee-row.total .price {
  color: var(--danger);
  font-size: var(--text-xl);
}

/* ========== 支付页 ========== */
.payment-header {
  text-align: center;
  padding: var(--space-xl);
  background: var(--surface);
}

.payment-countdown {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.payment-countdown .time {
  color: var(--danger);
  font-weight: bold;
  font-family: var(--font-num);
}

.payment-brand {
  font-size: var(--text-xl);
  font-weight: bold;
  color: var(--text-primary);
}

.payment-amount {
  font-size: var(--text-3xl);
  font-weight: bold;
  color: var(--text-primary);
  font-family: var(--font-num);
  margin-top: var(--space-sm);
}

.payment-method {
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

.payment-method-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--divider);
}

.payment-method-item:last-child {
  border-bottom: none;
}

.payment-method-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
}

.payment-method-name {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.payment-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.payment-radio.active {
  border-color: var(--primary);
  background: var(--primary);
}

.payment-radio.active::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: var(--radius-full);
}

/* ========== 订单列表页 ========== */
.order-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
}

.order-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-md) 0;
  font-size: var(--text-base);
  color: var(--text-secondary);
  position: relative;
}

.order-tab.active {
  color: var(--primary);
  font-weight: 500;
}

.order-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

.order-card {
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.order-card-store {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.order-card-status {
  font-size: var(--text-sm);
  color: var(--primary);
}

.order-card-body {
  display: flex;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--divider);
}

.order-card-imgs {
  display: flex;
  gap: var(--space-xs);
}

.order-card-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.order-card-info {
  flex: 1;
}

.order-card-goods {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.order-card-price {
  font-size: var(--text-base);
  font-weight: bold;
  color: var(--text-primary);
  font-family: var(--font-num);
  margin-top: var(--space-xs);
}

.order-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
}

/* ========== 订单详情/追踪页 ========== */
.order-track {
  background: var(--surface);
  padding: var(--space-xl) var(--space-lg);
  margin-bottom: var(--space-sm);
}

.order-track-status {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.order-track-status-title {
  font-size: var(--text-xl);
  font-weight: bold;
  color: var(--primary);
}

.order-track-status-time {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.timeline {
  position: relative;
  padding-left: 40px;
}

.timeline-line {
  position: absolute;
  left: 15px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -33px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  z-index: 2;
}

.timeline-item.active .timeline-dot {
  background: var(--primary);
  color: white;
}

.timeline-item.completed .timeline-dot {
  background: var(--success);
  color: white;
}

.timeline-content {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.timeline-item.active .timeline-content {
  color: var(--text-primary);
  font-weight: 500;
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* 骑手信息 */
.rider-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
}

.rider-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.rider-info {
  flex: 1;
}

.rider-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.rider-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.rider-actions {
  display: flex;
  gap: var(--space-sm);
}

.rider-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  color: var(--primary);
}

/* ========== 个人中心页 ========== */
.profile-header {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: var(--space-xl) var(--space-lg);
  padding-top: calc(var(--safe-top) + var(--space-xl));
  color: white;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  border: 3px solid rgba(255,255,255,0.3);
  object-fit: cover;
}

.profile-name {
  font-size: var(--text-xl);
  font-weight: bold;
}

.profile-phone {
  font-size: var(--text-sm);
  opacity: 0.9;
  margin-top: var(--space-xs);
}

.profile-stats {
  display: flex;
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-md) 0;
}

.profile-stat {
  flex: 1;
  text-align: center;
  border-right: 1px solid var(--divider);
}

.profile-stat:last-child {
  border-right: none;
}

.profile-stat-value {
  font-size: var(--text-xl);
  font-weight: bold;
  color: var(--primary);
  font-family: var(--font-num);
}

.profile-stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ========== 跑腿页 ========== */
.errand-tabs {
  display: flex;
  background: var(--surface);
  padding: var(--space-sm);
  gap: var(--space-sm);
}

.errand-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-md) 0;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--text-secondary);
  background: var(--bg);
  transition: all 0.2s;
}

.errand-tab.active {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

.errand-form {
  background: var(--surface);
  margin: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
}

.form-row {
  display: flex;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--divider);
}

.form-row:last-child {
  border-bottom: none;
}

.form-label {
  width: 80px;
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 500;
}

.form-input {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-select {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
}

/* ========== 启动页 ========== */
.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s;
}

.splash-logo {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-xl);
  object-fit: contain;
  animation: splash-bounce 1s ease-in-out;
}

@keyframes splash-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.splash-brand {
  font-size: var(--text-3xl);
  font-weight: bold;
  color: white;
  margin-top: var(--space-xl);
}

.splash-slogan {
  font-size: var(--text-base);
  color: rgba(255,255,255,0.9);
  margin-top: var(--space-sm);
}

.splash-version {
  position: absolute;
  bottom: var(--space-xl);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.7);
}

/* ========== 动画类 ========== */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.scale-in {
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 商品飞入购物车动画 */
@keyframes flyToCart {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(0.2) translateY(-200px) translateX(100px); opacity: 0; }
}

.fly-animation {
  position: fixed;
  z-index: 999;
  animation: flyToCart 0.5s ease-in forwards;
  pointer-events: none;
}
