/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f9fafb;
  color: #1f2937;
  line-height: 1.5;
}

/* 容器样式 - 优化左右侧边距 */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem); /* 响应式内边距 */
}

/* 全局导航栏 */
.global-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(1rem, 3vw, 2rem);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  transition: all 0.3s ease;
}

.global-nav:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.global-nav .logo {
  font-size: 20px;
  font-weight: 600;
  color: #ff6666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-nav .logo i {
  font-size: 22px;
}

.global-nav .nav-links {
  display: flex;
  gap: 16px;
}

.global-nav .nav-links a {
  text-decoration: none;
  color: #333;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.global-nav .nav-links a:hover {
  background: #ffe5e5;
  color: #ff6666;
  transform: translateY(-1px);
}

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

.global-nav .user-actions .search-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.global-nav .user-actions .search-btn:hover {
  color: #ff6666;
  background: #f3f4f6;
}

.global-nav .user-actions .submit-btn {
  background: #ff6666;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.global-nav .user-actions .submit-btn:hover {
  background: #ff4d4d;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(255, 102, 102, 0.2);
}

/* 头部导航（仅小屏显示） */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 999;
  display: none; /* 默认隐藏，小屏显示 */
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-left h2 {
  font-size: 20px;
  color: #1f2937;
}

.select-wrapper {
  position: relative;
}

.select-btn {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #333;
  min-width: 90px;
  transition: all 0.2s ease;
}

.select-btn:hover {
  border-color: #ff6666;
  background: #fff5f5;
}

.select-options {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: none;
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.select-options.active {
  display: block;
}

.select-options div {
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.select-options div:hover {
  background: #fff5f5;
  color: #ff6666;
  padding-left: 16px;
}

.select-options div.active {
  background: #ff6666;
  color: white;
}

/* 内容体上部：周期切换栏 */
.period-container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 16px;
  margin: 20px 0;
}

.period-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.time-display {
  font-size: 18px;
  font-weight: 500;
  color: #1f2937;
  padding: 4px 0;
}

/* 周期切换导航 */
.period-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 6px;
}

.period-nav .period-item {
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: #6b7280;
}

.period-nav .period-item:hover:not(.active) {
  color: #ff6666;
  background: rgba(255, 102, 102, 0.08);
  transform: translateY(-1px);
}

.period-nav .period-item.active {
  background: #fff;
  color: #ff6666;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 主内容容器 */
.content-container {
  display: flex;
  flex: 1;
  gap: 20px;
  margin-top: 1rem; /* 重点调整：content-container上边距 */
  max-width: 1400px; /* 限制最大宽度，提升大屏体验 */
  margin-left: auto;
  margin-right: auto;
}

/* 中部内容区 */
.main {
  flex: 1;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.main:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

/* 右侧归档栏 */
.sidebar {
  width: 280px;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  flex-shrink: 0; /* 防止压缩 */
}

.sidebar:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

.sidebar h3 {
  font-size: 16px;
  color: #1f2937;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar h3 i {
  color: #ff6666;
}

.archive-list {
  list-style: none;
}

.archive-list li {
  margin: 8px 0;
  cursor: pointer;
  color: #333;
  transition: color 0.2s ease, padding-left 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.archive-list li i {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.archive-list li:hover i {
  opacity: 1;
}

.archive-list li.year-title {
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 4px;
  color: #1f2937;
}

.archive-list li.year-title:first-child {
  margin-top: 0;
}

.archive-list li:hover:not(.year-title) {
  color: #ff6666;
  padding-left: 4px;
  transform: translateX(2px);
}

.archive-list li.active {
  color: #ff6666;
  font-weight: 600;
}

.archive-list li.active i {
  opacity: 1;
}

/* 产品卡片样式 */
.product {
  border: 1px solid #f0f0f0;
  padding: 20px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.product::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: #ff6666;
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.product:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  transform: translateY(-2px);
  border-color: #ffe5e5;
}

.product:hover::before {
  transform: scaleY(1);
}

.product .product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  transition: color 0.2s ease;
}

.product:hover .title {
  color: #ff6666;
}

.product-rank {
  font-size: 16px;
  font-weight: 700;
  color: #e5e7eb;
  margin-right: 8px;
  transition: color 0.3s ease;
}

.product:hover .product-rank {
  color: #ff6666;
}

.desc {
  color: #4b5563;
  margin-bottom: 12px;
  line-height: 1.5;
  font-size: 14px;
}

.product .votes {
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease;
}

.product:hover .votes {
  color: #ff6666;
}

.product .votes::before {
  content: '▲';
  color: #ff6666;
  font-size: 12px;
}

.product-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.product:hover .product-actions {
  opacity: 1;
  transform: translateY(0);
}

.product-actions button {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.product-actions button:hover {
  background: #fff5f5;
  border-color: #ff6666;
  color: #ff6666;
}

/* 日期导航条（Daily专用） */
.date-nav {
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.date-btn {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s ease;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.date-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 102, 102, 0.05);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left center;
}

.date-btn:hover {
  border-color: #ff6666;
  color: #ff6666;
}

.date-btn:hover::after {
  transform: scaleX(1);
}

.date-btn.active {
  background: #ff6666;
  color: white;
  border-color: #ff6666;
}

.date-btn.active::after {
  display: none;
}

.date-nav.hidden {
  display: none;
}

/* 周导航条（Weekly专用） */
.week-nav {
  display: none;
  align-items: center;
  margin: 16px 0;
}

.week-nav.visible {
  display: flex;
}

.nav-arrow {
  font-weight: 600;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  border-color: #ff6666;
  color: #ff6666;
  background: #fff5f5;
  transform: scale(1.05);
}

.nav-arrow:active {
  transform: scale(0.98);
}

.nav-arrow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #eee;
  color: #999;
  transform: none;
}

.week-display {
  margin: 0 12px;
  min-width: 80px;
  text-align: center;
  font-size: 14px;
  color: #333;
}

/* 加载状态 & 无数据 */
.loading {
  text-align: center;
  padding: 40px 0;
  color: #6b7280;
  font-size: 14px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ff6666;
  border-top-color: transparent;
  border-radius: 50%;
  margin-left: 8px;
  animation: spin 1s linear infinite;
}

.no-data {
  text-align: center;
  padding: 40px 0;
  color: #999;
  font-size: 14px;
}

.no-data i {
  font-size: 24px;
  margin-bottom: 12px;
  color: #e5e7eb;
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 响应式适配 - 补充更多移动端样式 */
@media (max-width: 768px) {
  /* 全局导航栏 - 移动端样式调整 */
  .global-nav {
    padding: 8px clamp(0.5rem, 2vw, 1rem);
  }

  .global-nav .logo {
    font-size: 16px;
  }

  .global-nav .logo i {
    font-size: 18px;
  }

  .global-nav .user-actions {
    gap: 8px;
  }

  .global-nav .user-actions .submit-btn {
    padding: 4px 12px;
    font-size: 12px;
  }

  /* 产品卡片 - 移动端样式调整 */
  .product {
    padding: 12px;
  }

  .title {
    font-size: 16px;
  }

  .product-rank {
    font-size: 14px;
  }

  .desc {
    font-size: 13px;
  }

  .product-actions button {
    padding: 3px 6px;
    font-size: 11px;
  }

  .repo-card .card-meta {
    display: none; /* 完全隐藏 */
    /* 或使用 visibility: hidden; 保留占位空间 */
  }

  /* 可选：隐藏后调整其他元素间距，避免空白 */
  .repo-card .card-title {
      margin-bottom: 4px; /* 减小标题底部间距 */
  }

  .repo-card .card-description {
      margin-top: 4px; /* 调整描述顶部间距 */
  }
}

/* 触摸反馈优化 */
* {
  -webkit-tap-highlight-color: transparent;
}

/* 移动端字体适配 */
html {
  font-size: 16px;
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 992px) {
  /* 大屏：显示右侧归档菜单，隐藏头部年月选择器 */
  .sidebar {
    display: block;
  }
  .header {
    display: none;
  }
}

@media (max-width: 1024px) and (min-width: 1023px) {
  /* 中屏：归档菜单放底部，隐藏头部年月选择器 */
  .content-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    margin-top: 20px;
    display: block;
  }
  .header {
    display: none;
  }
}

@media (max-width: 1023px) {
  /* 小屏：显示头部年月选择器，隐藏归档菜单 */
  .header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .sidebar {
    display: none;
  }

  /* 小屏周期切换样式 */
  .period-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .period-nav {
    width: 100%;
    justify-content: space-between;
  }

  .period-nav .period-item {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 14px;
  }

  .select-btn {
    font-size: 13px;
    min-width: 75px;
  }

  .main {
    padding: 16px;
  }

  .product {
    padding: 16px;
  }

  .global-nav .nav-links {
    display: none;
  }
}

.collapsed {
  display: none;
}

.year-title {
  cursor: pointer;
}

