/* ================================
   移动端响应式优化
   ================================ */

/* 汉堡菜单按钮 */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  color: #374151;
}

/* 侧边栏菜单 - 优化性能 */
.mobile-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  border-left: 1px solid #e8e8e8;
  will-change: right;
  -webkit-overflow-scrolling: touch;
}

.mobile-sidebar.open {
  right: 0;
}

.mobile-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

.mobile-sidebar-header h2 {
  font-size: 1.125rem;
  font-weight: 400;
  color: #1f2937;
  letter-spacing: 0.025em;
}

.mobile-sidebar-close {
  width: 36px;
  height: 36px;
  background: white;
  border: 1px solid #e8e8e8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  transition: all 0.2s;
}

.mobile-sidebar-close:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.mobile-sidebar-close svg {
  width: 20px;
  height: 20px;
  color: #333;
}

.mobile-sidebar-nav {
  padding: 20px 16px;
}

.mobile-nav-item {
  display: block;
  padding: 14px 16px;
  margin-bottom: 2px;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 300;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid #e8e8e8;
  background: white;
  letter-spacing: 0.015em;
}

.mobile-nav-item:hover {
  background: #f9fafb;
  border-color: #742581;
  color: #742581;
}

.mobile-nav-item.active {
  background: #faf5ff;
  color: #742581;
  border-color: #742581;
  font-weight: 400;
}

/* 遮罩层 */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  /* Header适配 */
  header .flex.items-center.justify-between {
    height: 56px !important;
    padding: 0;
  }
  
  header h1 {
    font-size: 1.1rem;
    font-weight: 400;
    flex: 1;
    letter-spacing: 0.025em;
    color: #1f2937;
  }
  
  /* 隐藏PC端标签页 */
  .desktop-tabs {
    display: none !important;
  }
  
  /* 显示汉堡菜单 */
  .mobile-menu-btn {
    display: flex;
  }
  
  /* 搜索框移动端 - 隐藏在主header */
  #searchInput {
    display: none !important;
  }
  
  /* 移动端搜索栏 */
  .mobile-search-bar {
    display: block;
    padding: 8px 16px;
    background: white;
    border-bottom: 1px solid #e8e8e8;
  }
  
  .mobile-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
  }
  
  .mobile-search-input:focus {
    border-color: #333;
  }
  
  /* 统计卡片移动端 */
  .stat-card {
    padding: 1rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  /* 博客卡片移动端 */
  .blog-card-content {
    padding: 1rem;
  }
  
  .blog-title {
    font-size: 1rem;
  }
  
  /* 成员网格移动端 */
  .member-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .member-item {
    padding: 0.75rem;
    font-size: 0.75rem;
  }
  
  /* 博客详情页移动端 */
  #blogDetail {
    padding: 1rem 0.5rem;
  }
  
  #blogDetail article {
    padding: 1rem;
  }
  
  #blogDetail h1 {
    font-size: 1.5rem;
    line-height: 1.4;
  }
  
  /* 移动端博客详情头部优化 */
  #blogDetail header {
    margin-bottom: 1.5rem !important;
    padding-bottom: 1rem !important;
  }
  
  #blogDetail header .flex {
    flex-wrap: wrap;
    gap: 0.5rem !important;
    font-size: 0.875rem;
  }
  
  #blogDetail header .font-medium {
    font-size: 1rem;
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* 操作按钮移动端 */
  .action-buttons {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 1.5rem !important;
  }
  
  .action-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
  }
  
  .action-btn.primary {
    background: #2563eb;
    border-color: #2563eb;
  }
  
  .share-dropdown {
    width: 100%;
    position: relative;
  }
  
  .share-menu {
    /* 移动端：向下居中弹出 */
    top: calc(100% + 8px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    /* 移动端：2列布局 */
    grid-template-columns: repeat(2, 1fr);
    min-width: 200px;
  }
  
  /* Toast移动端 */
  .toast {
    bottom: 20px;
    max-width: 90%;
    font-size: 13px;
  }
  
  /* 进度对话框移动端 */
  .download-progress {
    width: 90%;
    min-width: auto;
    padding: 20px;
  }
  
  /* 博客内容移动端字体优化 */
  .blog-content-official {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
    font-size: 15px;
    line-height: 1.8;
  }
  
  .blog-content-official img {
    margin: 1rem 0;
  }
  
  /* 容器移动端 */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* 小屏幕手机 (<375px) */
@media (max-width: 374px) {
  header h1 {
    font-size: 0.9rem;
  }
  
  .tab-item {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .blog-title {
    font-size: 0.9rem;
  }
  
  #blogDetail h1 {
    font-size: 1.25rem;
  }
  
  .action-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
}
