/* ================================================
   SPA 页面样式
   ================================================ */

/* 页面容器 */
#page-container {
  padding: env(safe-area-inset-top, 12px) 12px 70px;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
  min-height: 100vh;
  padding-top: max(12px, env(safe-area-inset-top));
}

/* ========== 通用 ========== */
.page-loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

.page-error {
  text-align: center;
  padding: 40px;
  color: #e53935;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #999;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 14px;
}

/* ========== Tabbar ========== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #eee;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  color: #999;
  font-size: 10px;
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}

.tab-item.active {
  color: #1a73e8;
}

.tab-item svg {
  transition: transform 0.2s;
}

.tab-item.active svg {
  transform: scale(1.1);
}

.tab-badge {
  position: absolute;
  top: 0;
  right: 8px;
  min-width: 16px;
  height: 16px;
  background: #e53935;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ========== 列表页头部 ========== */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.list-title {
  font-size: 20px;
  font-weight: 600;
}

/* ========== 筛选标签 ========== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.filter-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  background: #f5f5f5;
  border: none;
  border-radius: 16px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: #1a73e8;
  color: #fff;
}

/* ========== 文章卡片 ========== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-article {
  display: block;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card-article:active {
  transform: scale(0.98);
}

.card-cover {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: #f0f0f0;
}

.card-body {
  padding: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 10px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-date {
  font-size: 12px;
  color: #999;
}

/* ========== 创意卡片 ========== */
.card-idea {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card-idea:active {
  transform: scale(0.98);
}

.card-idea .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-idea .card-content {
  font-size: 15px;
  line-height: 1.6;
  color: #333;
}

.card-link {
  display: inline-block;
  margin-top: 10px;
  color: #1a73e8;
  font-size: 13px;
  text-decoration: none;
}

/* ========== 待办列表 ========== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-group {
  margin-bottom: 20px;
}

.task-group-title {
  font-size: 13px;
  color: #999;
  margin-bottom: 10px;
  padding-left: 4px;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.task-item.done {
  opacity: 0.6;
}

.task-item.done .task-title {
  text-decoration: line-through;
}

.task-check {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.task-check input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.task-check .checkmark {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid #ddd;
  border-radius: 50%;
  transition: all 0.2s;
}

.task-check input:checked + .checkmark {
  background: #4caf50;
  border-color: #4caf50;
}

.task-check input:checked + .checkmark::after {
  content: '✓';
  display: block;
  color: #fff;
  font-size: 14px;
  text-align: center;
  line-height: 18px;
}

.task-content {
  flex: 1;
}

.task-title {
  font-size: 15px;
  color: #333;
}

.task-desc {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}

/* ========== 我的页面 ========== */
.page-my {
  padding-bottom: 30px;
}

.page-my-guest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.guest-bg {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 0 0 40px 40px;
  margin: -12px -12px 0;
}

.guest-content {
  margin-top: -60px;
  text-align: center;
}

.guest-avatar {
  width: 80px;
  height: 80px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.guest-tip {
  color: #999;
  margin-bottom: 20px;
}

/* 用户卡片 */
.user-card {
  position: relative;
  margin: -60px -12px 20px;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 0 0 24px 24px;
}

.user-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
}

.user-card-content {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  background: #fff;
}

.user-info {
  color: #fff;
}

.user-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}

.user-email {
  font-size: 13px;
  opacity: 0.8;
}

/* 统计行 */
.stats-row {
  display: flex;
  justify-content: space-around;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #333;
}

.stat-label {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* 菜单 */
.menu-section {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  text-decoration: none;
  color: #333;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.2s;
  cursor: pointer;
}

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

.menu-item:active {
  background: #f9f9f9;
}

.menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.menu-icon-blue { background: #e8f0fe; }
.menu-icon-purple { background: #f3e5f5; }
.menu-icon-orange { background: #fff3e0; }
.menu-icon-green { background: #e8f5e9; }
.menu-icon-red { background: #ffebee; }
.menu-icon-gray { background: #f5f5f5; }
.menu-icon-teal { background: #e0f2f1; }

.menu-text {
  flex: 1;
  font-size: 15px;
}

.menu-badge {
  background: #e53935;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.menu-arrow {
  color: #ccc;
  font-size: 18px;
}

/* 退出按钮 */
.logout-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 20px 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 12px;
  text-align: center;
  color: #e53935;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:active {
  background: #ffebee;
  border-color: #e53935;
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-blue { background: #e8f0fe; color: #1a73e8; }
.tag-green { background: #e8f5e9; color: #43a047; }
.tag-orange { background: #fff3e0; color: #f57c00; }
.tag-red { background: #ffebee; color: #e53935; }
.tag-gray { background: #f5f5f5; color: #757575; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
}

.btn-primary:active {
  background: #1557b0;
}

.btn-success {
  background: #67c23a;
  color: #fff;
}

.btn-success:active {
  background: #529b2f;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: #1a73e8;
}

textarea.form-input {
  resize: none;
}

/* ========== 底部弹窗 ========== */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 300;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  max-height: 80vh;
  overflow-y: auto;
}

.bottom-sheet.show {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.sheet-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.sheet-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
}

.sheet-content {
  padding: 20px;
}

.sheet-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #eee;
}

.sheet-actions .btn {
  flex: 1;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== 确认弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex !important;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 300px;
}

.modal-text {
  font-size: 16px;
  text-align: center;
  margin-bottom: 20px;
}

.modal-btns {
  display: flex;
  gap: 12px;
}

.modal-btns .btn {
  flex: 1;
}

/* ========== 刷新提示 ========== */
.pull-tip {
  text-align: center;
  color: #999;
  font-size: 12px;
  height: 0;
  overflow: hidden;
  transition: height 0.3s;
}

.pull-tip.show {
  height: 30px;
  line-height: 30px;
}

/* ================================================
   文章详情页评论区域（移动端适配）
   ================================================ */
.article-page .comments-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.article-page .comments-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.comment-login-tip {
  text-align: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 16px;
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  resize: none;
  box-sizing: border-box;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #1a73e8;
}

/* ========== 弹窗（覆盖 mobile.css 的底部弹出样式） ========== */
.modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0,0,0,0.5) !important;
  z-index: 1000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: all 0.3s !important;
}

.modal.show {
  opacity: 1 !important;
  visibility: visible !important;
}

.modal-content {
  background: #fff !important;
  border-radius: 16px !important;
  padding: 24px !important;
  width: 100% !important;
  max-width: 400px !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  transform: scale(0.9) !important;
  transition: transform 0.3s !important;
}

.modal.show .modal-content {
  transform: scale(1) !important;
}

.modal-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 16px !important;
}

.modal-title {
  font-size: 18px !important;
  font-weight: 600 !important;
}

.modal-close {
  background: none !important;
  border: none !important;
  font-size: 24px !important;
  color: #999 !important;
  cursor: pointer !important;
  padding: 0 !important;
  line-height: 1 !important;
}

/* 弹窗内表单样式 */
.modal .form-group {
  margin-bottom: 16px;
}

.modal .form-label {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
}

.modal .form-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

.modal .form-input:focus {
  border-color: #409eff;
}

.modal textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.modal select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
