/* ========================================
   零笼无人机市场平台 - 全局样式
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 导航栏 */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

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

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline { background: #fff; border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--gray-400); background: var(--gray-50); }

.btn-sm { padding: 5px 12px; font-size: 0.875rem; }
.btn-lg { padding: 10px 24px; font-size: 1.05rem; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--gray-800);
  background: #fff;
  transition: border .2s, box-shadow .2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }

/* 卡片 */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 20px; }

/* 布局容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-wrapper {
  flex: 1;
  padding: 24px 0;
}

/* 地图容器 */
.map-full { width: 100%; height: calc(100vh - 60px); }
.map-box { width: 100%; height: 400px; border-radius: var(--radius); border: 1px solid var(--gray-200); }

/* 需求卡片 */
.demand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.demand-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow .2s;
}
.demand-card:hover { box-shadow: var(--shadow-md); }
.demand-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.demand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.demand-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.tag-scene { background: #dbeafe; color: #1e40af; }
.tag-budget { background: #dcfce7; color: #166534; }
.tag-days { background: #fef3c7; color: #92400e; }
.tag-status-pending { background: #fef3c7; color: #92400e; }
.tag-status-approved { background: #dcfce7; color: #166534; }
.tag-status-rejected { background: #fee2e2; color: #991b1b; }
.tag-status-active { background: #dcfce7; color: #166534; }
.tag-status-expired { background: #fee2e2; color: #991b1b; }
.tag-status-ended { background: #e0e7ff; color: #3730a3; }
.demand-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 10px;
}
.demand-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--gray-400);
}

/* 搜索栏 */
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.search-bar .form-input,
.search-bar .form-select { width: auto; min-width: 180px; }

/* 统计面板 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
tr:hover td { background: var(--gray-50); }

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-close {
  background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray-400);
}

/* Toast 提示 */
#toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #fff;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 260px;
  animation: slideIn .3s ease;
  font-size: 0.9rem;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 登录区域 */
.auth-box {
  max-width: 400px;
  margin: 40px auto;
}
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.active {
  color: var(--primary);
  border-color: var(--primary);
}

/* 用户头像 */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state svg {
  width: 64px; height: 64px;
  margin-bottom: 16px;
  opacity: .5;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}
.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-200);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--gray-700);
}
.page-btn:hover { background: var(--gray-50); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 页脚 */
.footer {
  background: #fff;
  border-top: 1px solid var(--gray-200);
  padding: 20px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-400);
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .search-bar .form-input,
  .search-bar .form-select { width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .demand-grid { grid-template-columns: 1fr; }
}

/* 管理员标识 */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* 微信登录按钮 */
.wechat-btn {
  background: #07c160;
  color: #fff;
}
.wechat-btn:hover { background: #06ad56; }

/* 图表容器 */
.chart-box {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  height: 320px;
  position: relative;
}

/* ========================================
   卖家秀 - 瀑布流
   ======================================== */

.waterfall {
  column-count: 4;
  column-gap: 16px;
}
.waterfall-item {
  break-inside: avoid;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s;
  cursor: pointer;
}
.waterfall-item:hover {
  box-shadow: var(--shadow-md);
}
.waterfall-img {
  width: 100%;
  display: block;
  background: var(--gray-100);
  object-fit: cover;
}
.waterfall-body {
  padding: 12px;
}
.waterfall-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.waterfall-author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.waterfall-stats {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--gray-400);
}
.waterfall-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

@media (max-width: 1024px) {
  .waterfall { column-count: 3; }
}
@media (max-width: 768px) {
  .waterfall { column-count: 2; column-gap: 10px; }
  .waterfall-body { padding: 10px; }
}
@media (max-width: 480px) {
  .waterfall { column-count: 1; }
}

/* 卖家秀详情 */
.showcase-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.showcase-gallery img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--gray-200);
}
.showcase-content {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--gray-700);
  white-space: pre-wrap;
}
.showcase-actions {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  margin: 16px 0;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: all .2s;
}
.action-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.action-btn.liked { color: var(--danger); }

/* 评论 */
.comment-list { margin-top: 16px; }
.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.comment-body { flex: 1; }
.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-800);
}
.comment-text {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-top: 4px;
  line-height: 1.5;
}
.comment-time {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* 附件 */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-700);
}
.attachment-item:hover { background: var(--gray-100); }

/* 图片上传预览 */
.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-preview-item .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 图片灯箱 */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.lightbox-overlay.open { opacity: 1; pointer-events: auto; }
.lightbox-overlay img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
}
