/**
 * 公共样式 - 爱心捐款公示系统
 * 移动端优先设计
 */

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

/* CSS 变量 */
:root {
  /* 红色系 */
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  /* 橙色系 */
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --orange-700: #c2410c;

  /* 琥珀色系 */
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;

  /* 黄色系 */
  --yellow-50: #fefce8;
  --yellow-400: #facc15;

  /* 灰色系 */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* 绿色系 */
  --green-500: #22c55e;
  --green-600: #16a34a;
}

/* 基础样式 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--red-50) 0%, var(--orange-50) 50%, var(--yellow-50) 100%);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 20px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 主容器 */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
}

/* 头部区域 */
.header {
  background: linear-gradient(135deg, var(--red-600) 0%, var(--orange-500) 100%);
  color: white;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

.header-content {
  position: relative;
  z-index: 1;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo {
  width: 52px;
  height: 52px;
  background: white;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.org-name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}

.org-tag {
  font-size: 18px;
  opacity: 0.9;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 10px;
}

.header-desc {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.6;
}

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
}

.stats.three-col {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px;
  margin-top: -16px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.stats.three-col .stat-card {
  border-radius: 14px;
  padding: 14px 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.stat-card.red { border: 2px solid var(--red-200); }
.stat-card.orange { border: 2px solid var(--orange-200); }
.stat-card.amber { border: 2px solid var(--amber-200); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.stats.three-col .stat-value {
  font-size: 20px;
  margin-bottom: 2px;
}

.stat-value.red { color: var(--red-600); }
.stat-value.orange { color: var(--orange-500); }
.stat-value.amber { color: var(--amber-600); }

.stat-label {
  font-size: 14px;
  color: var(--gray-500);
}

.stats.three-col .stat-label {
  font-size: 12px;
}

/* 列表区域 */
.list-section {
  padding: 0 16px 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--red-500), var(--orange-500));
  border-radius: 2px;
}

.section-title svg {
  width: 20px;
  height: 20px;
  color: var(--orange-500);
}

/* 底部区域 */
.footer {
  background: linear-gradient(135deg, var(--red-600) 0%, var(--orange-500) 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
  margin-top: 16px;
}

.footer-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.footer-sub {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.footer-date {
  font-size: 12px;
  opacity: 0.75;
}

.footer-stats {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-stats #LA-DATA-WIDGET {
  display: inline-block;
  opacity: 0.9;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 999;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 12px;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--red-600);
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

/* 为底部导航留出空间 */
.main-content {
  padding-bottom: 80px;
}

/* 浮动按钮 */
.fab-group {
  position: fixed;
  bottom: 90px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.fab:active {
  transform: scale(0.95);
}

.fab.primary {
  background: linear-gradient(135deg, var(--green-600), var(--green-500));
  color: white;
}

.fab.secondary {
  background: white;
  color: var(--gray-600);
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-500);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* 工具栏 */
.toolbar {
  padding: 16px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gray-100);
}

.search-box {
  position: relative;
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  background: white;
}

.search-box input:focus {
  border-color: var(--orange-400);
}

.search-box input::placeholder {
  color: var(--gray-500);
}

.search-box > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-200);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.search-clear.show {
  display: flex;
}

.sort-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sort-tabs::-webkit-scrollbar {
  display: none;
}

.sort-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 20px;
  background: white;
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sort-tab.active {
  background: linear-gradient(135deg, var(--red-500), var(--orange-400));
  color: white;
  border-color: transparent;
}

.filter-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--gray-500);
}

/* 响应式 */
@media (min-width: 768px) {
  .container {
    max-width: 600px;
  }

  .stats {
    padding: 20px;
    gap: 16px;
  }

  .stats.three-col {
    padding: 18px;
    gap: 14px;
  }

  .stat-value {
    font-size: 32px;
  }

  .stats.three-col .stat-value {
    font-size: 24px;
  }
}
