/**
 * H5 应用公共样式
 * 对应原小程序 app.wxss
 */

/* ===== 基础样式重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 链接 ===== */
a {
  color: inherit;
  text-decoration: none;
}

/* ===== 按钮 ===== */
button {
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
}

.btn-primary:active {
  opacity: 0.9;
  transform: scale(0.98);
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

/* ===== 容器 ===== */
.container {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding-bottom: 60px;
}

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: 12px;
  margin: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.card-more {
  display: flex;
  align-items: center;
  color: #9CA3AF;
  font-size: 13px;
}

.card-more::after {
  content: '›';
  margin-left: 2px;
}

/* ===== Flex 布局 ===== */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-wrap {
  flex-wrap: wrap;
}

/* ===== 文本 ===== */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-gray {
  color: #9CA3AF;
}

.text-green {
  color: #10B981;
}

.text-red {
  color: #ef4444;
}

.text-bold {
  font-weight: 600;
}

/* ===== 间距 ===== */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.p-4 { padding: 4px; }
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }

/* ===== 徽章 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background-color: #ef4444;
}

.badge-green {
  background-color: #10B981;
}

/* ===== 头像 ===== */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-small {
  width: 36px;
  height: 36px;
}

.avatar-large {
  width: 64px;
  height: 64px;
}

/* ===== 标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background-color: #f0f9f6;
  color: #10B981;
}

.tag-gray {
  background-color: #f5f5f5;
  color: #666;
}

/* ===== 输入框 ===== */
.input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: #10B981;
}

.input-placeholder {
  color: #9CA3AF;
}

/* ===== 分割线 ===== */
.divider {
  height: 1px;
  background-color: #e5e5e5;
  margin: 12px 0;
}

/* ===== 空状态 ===== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9CA3AF;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-text {
  font-size: 14px;
}

/* ===== 加载 ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f5f5f5;
  border-top-color: #10B981;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
}

.toast-container.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.toast-content {
  padding: 12px 24px;
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  max-width: 280px;
  text-align: center;
}

/* ===== 模态框 ===== */
.modal-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-container.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 280px;
  overflow: hidden;
}

.modal-header {
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.modal-body {
  padding: 0 16px 16px;
  font-size: 14px;
  color: #666;
  text-align: center;
}

.modal-footer {
  display: flex;
  border-top: 1px solid #e5e5e5;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  text-align: center;
}

.modal-btn.cancel {
  color: #666;
  border-right: 1px solid #e5e5e5;
}

.modal-btn.confirm {
  color: #10B981;
  font-weight: 500;
}

/* ===== TabBar ===== */
#tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: #fff;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.tabbar {
  display: flex;
  height: 50px;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9CA3AF;
  transition: color 0.2s;
}

.tabbar-item.active {
  color: #10B981;
}

.tabbar-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.tabbar-text {
  font-size: 10px;
}

/* ===== 页面容器 ===== */
#page-container {
  min-height: calc(100vh - 50px);
  padding-bottom: 60px;
}

/* ===== 原型样式（从 wxss 移植） ===== */
/* 状态徽章 */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

.status-online {
  background: #d1fae5;
  color: #059669;
}

.status-offline {
  background: #f5f5f5;
  color: #666;
}

.status-serving {
  background: #fee2e2;
  color: #dc2626;
}

/* 价格样式 */
.price {
  color: #ef4444;
  font-weight: 600;
}

.price-unit {
  font-size: 12px;
  font-weight: normal;
  color: #666;
}

/* 列表项 */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.list-item:last-child {
  border-bottom: none;
}

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: #f5f5f5;
  border-radius: 20px;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
}

.search-icon {
  margin-right: 8px;
  color: #9CA3AF;
}

/* 网格布局 */
.grid {
  display: grid;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(20px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.3s ease;
}
