/* ============================================
   前端全局样式 - 热工WP
   ============================================ */

/* --- CSS 变量定义 --- */
:root {
  --primary: #165DFF;
  --primary-light: #E8F3FF;
  --secondary: #36CFC9;
  --warning: #FF7D00;
  --danger: #F53F3F;

  --bg-main: #F5F7FA;
  --bg-card: #FFFFFF;
  --border: #EEEEEE;

  --text-primary: #1D2129;
  --text-secondary: #4E5969;
  --text-hint: #86909C;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* --- 全局重置 --- */

/* 暗黑模式基础 - 防止闪烁 */
html.dark body {
  background-color: #0f172a !important;
  color: #e0e0e0;
}
html.dark .bg-gray-50 {
  background-color: #0f172a !important;
}
html.dark .bg-white {
  background-color: #1a1a2e !important;
}
html.dark .text-gray-800 {
  color: #e0e0e0 !important;
}
html.dark .text-gray-600 {
  color: #b0b0b0 !important;
}
html.dark .text-gray-400 {
  color: #808080 !important;
}
html.dark .border-gray-100,
html.dark .border-gray-200 {
  border-color: #2a2a4a !important;
}
html.dark .shadow-sm {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- 渐变背景类 --- */
.gradient-blue {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.gradient-green {
  background: linear-gradient(135deg, #11998e, #38ef7d);
}

.gradient-purple {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* --- 头部样式 --- */
.page-header {
  padding: 20px 16px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-hint);
}

/* --- 卡片样式 --- */
.section-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}

/* --- 输入框样式 --- */
.input-focus {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-focus:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.15);
}

.input-focus::placeholder {
  color: var(--text-hint);
}

/* --- 结果输入框样式 --- */
.result-input {
  width: 96px;
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  background: transparent;
  border-bottom: 2px solid transparent;
  outline: none;
  transition: border-color 0.3s ease;
  -moz-appearance: textfield;
}

.result-input::-webkit-outer-spin-button,
.result-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.result-input:hover {
  border-bottom-color: var(--border);
}

.result-input:focus {
  border-bottom-color: var(--primary);
}

/* --- 结果项样式 --- */
.result-item {
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.result-item:hover {
  transform: translateY(-2px);
  background-color: var(--primary-light);
}

/* --- 按钮样式 --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.btn-secondary:hover {
  background-color: var(--bg-main);
  border-color: var(--text-hint);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--danger);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.15s ease;
}

.btn-gradient:hover {
  opacity: 0.9;
}

.btn-gradient:active {
  transform: scale(0.97);
}

/* --- 底部导航栏 --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 999;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--text-hint);
  font-size: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.3s ease;
}

.bottom-nav-item .nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.bottom-nav-item.active {
  color: var(--primary);
}

/* --- 历史记录项 --- */
.history-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.history-item:hover {
  transform: translateX(4px);
  background-color: var(--primary-light);
}

/* --- 通知提示 --- */
.notification {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 90%;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  z-index: 2000;
  font-size: 14px;
  color: var(--text-primary);
  text-align: center;
}

/* --- 搜索框 --- */
.search-container {
  position: relative;
  width: 100%;
}

.search-container .search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 14px;
  background: var(--bg-main);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-container .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.15);
}

.search-container .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  font-size: 16px;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

.search-suggestions .suggestion-item {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.search-suggestions .suggestion-item:hover {
  background-color: var(--primary-light);
}

/* --- 标签/徽章 --- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: var(--danger);
  color: #FFFFFF;
}

.badge-resolved {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: #E8FFEA;
  color: #00B42A;
  border: 1px solid #00B42A;
}

/* --- 付费标记 --- */
.paid-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #FF7D00, #FFB320);
  color: #FFFFFF;
}

.free-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #E8FFEA;
  color: #00B42A;
}

/* --- 匿名标记 --- */
.anonymous-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #F2F3F5;
  color: var(--text-hint);
}

/* --- 帖子卡片 --- */
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-card-pinned {
  border-left: 3px solid var(--primary);
}

/* --- 文档项 --- */
.document-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.document-item:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.document-item .doc-icon {
  font-size: 24px;
  margin-right: 12px;
  color: var(--primary);
}

.document-item .doc-info {
  flex: 1;
}

.document-item .doc-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.document-item .doc-meta {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 2px;
}

/* --- 个人中心 --- */
.profile-header {
  text-align: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #FFFFFF;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.profile-header .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}

.profile-header .username {
  font-size: 18px;
  font-weight: 600;
}

.profile-header .user-id {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
  margin-top: -20px;
}

.stats-grid .stat-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stats-grid .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.stats-grid .stat-label {
  font-size: 12px;
  color: var(--text-hint);
  margin-top: 2px;
}

/* --- 签到日历 --- */
.checkin-calendar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.checkin-calendar .calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.checkin-calendar .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.checkin-calendar .calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  color: var(--text-secondary);
}

.checkin-calendar .calendar-day.checked {
  background: var(--primary);
  color: #FFFFFF;
  font-weight: 600;
}

.checkin-calendar .calendar-day.today {
  border: 2px solid var(--primary);
  font-weight: 600;
}

.checkin-calendar .calendar-day.empty {
  visibility: hidden;
}

/* --- 积分明细 --- */
.points-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.points-item:last-child {
  border-bottom: none;
}

.points-earn {
  color: #00B42A;
  font-weight: 600;
  font-size: 14px;
}

.points-spend {
  color: var(--danger);
  font-weight: 600;
  font-size: 14px;
}

/* --- 响应式布局 --- */
@media (max-width: 640px) {
  .responsive-grid {
    grid-template-columns: 1fr;
  }

  .section-card {
    padding: 12px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .responsive-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1025px) {
  .responsive-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .section-card {
    padding: 20px;
  }
}

/* --- 工具类 --- */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.font-medium {
  font-weight: 500;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }

.rounded-full {
  border-radius: 9999px;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.grid {
  display: grid;
}
