/* ========== 头部导航 ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 30px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
}

.logo-icon {
  width: 28px;
  height: 28px;
}

.nav {
  display: flex;
  gap: 24px;
}

.nav-item {
  font-size: 15px;
  color: var(--text-secondary);
  padding: 8px 0;
  position: relative;
  transition: color 0.2s;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.header-center {
  flex: 1;
  max-width: 480px;
  margin: 0 40px;
}

.search-box {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 0 16px;
  height: 36px;
  transition: background 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  background: var(--bg-white);
  box-shadow: 0 0 0 2px var(--primary);
}

.search-input {
  flex: 1;
  background: transparent;
  font-size: 14px;
  padding-right: 10px;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-btn {
  padding: 4px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.search-btn:hover {
  color: var(--text);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.upload-btn {
  background: var(--primary);
  color: var(--bg-white);
}

.upload-btn:hover {
  background: #c5001f;
}

.icon-btn {
  position: relative;
  padding: 8px;
  color: var(--text-secondary);
}

.icon-btn:hover {
  color: var(--text);
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.2s;
}

.user-avatar:hover {
  opacity: 0.85;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========== 侧边栏 ========== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
  z-index: 90;
}

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-left: 10px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.category-item:hover {
  background: #f5f5f5;
}

.category-item.active {
  background: #fff0f0;
  color: var(--primary);
}

.category-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.category-icon {
  font-size: 18px;
}

.category-name {
  font-size: 14px;
  flex: 1;
}

.color-filter {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 0 4px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}

.color-btn:hover {
  transform: scale(1.1);
}

.color-btn.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--bg-white);
}

.board-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.board-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.board-item:hover {
  background: #f5f5f5;
}

.board-icon {
  font-size: 16px;
}

.board-name {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.new-board-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px dashed #ddd;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.new-board-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff0f0;
}

/* ========== 主内容区 ========== */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 20px;
  min-height: calc(100vh - var(--header-height));
}

/* ========== 瀑布流布局 ========== */
.waterfall {
  display: flex;
  flex-wrap: wrap;
  margin-left: -10px;
}

.waterfall-column {
  flex: 1;
  min-width: 240px;
  max-width: 400px;
  padding-left: 10px;
}

.waterfall-item {
  display: block;
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.waterfall-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.waterfall-item img {
  width: 100%;
  display: block;
}

.waterfall-item .item-info {
  padding: 12px;
}

.waterfall-item .item-title {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.waterfall-item .item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.waterfall-item .item-author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.waterfall-item .item-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.waterfall-item .item-author-name {
  font-size: 12px;
  color: var(--text-secondary);
}

.waterfall-item .item-stats {
  display: flex;
  gap: 12px;
}

.waterfall-item .item-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.waterfall-item .item-stat svg {
  width: 14px;
  height: 14px;
}

/* 瀑布流图片容器 - 保持比例 */
.waterfall-item .image-wrapper {
  position: relative;
  overflow: hidden;
}

.waterfall-item .image-wrapper img {
  width: 100%;
  height: auto;
  transition: transform 0.3s;
}

.waterfall-item:hover .image-wrapper img {
  transform: scale(1.03);
}

/* 悬浮操作按钮 */
.waterfall-item .item-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s;
}

.waterfall-item:hover .item-actions {
  opacity: 1;
  transform: translateY(0);
}

.waterfall-item .action-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.waterfall-item .action-btn:hover {
  background: var(--primary);
  color: white;
}

.waterfall-item .action-btn.liked {
  color: var(--primary);
}

.waterfall-item .action-btn.collected {
  background: var(--primary);
  color: white;
}

/* ========== 加载更多 ========== */
.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== 图片预览弹窗 ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(0,0,0,0.7);
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-nav:hover {
  background: rgba(0,0,0,0.7);
}

.modal-nav.prev {
  left: 10px;
}

.modal-nav.next {
  right: 10px;
}

.modal-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  overflow: hidden;
}

.modal-image {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.modal-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}

.modal-info-left {
  flex: 1;
}

.modal-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.modal-author-name {
  font-size: 14px;
  font-weight: 500;
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tag {
  padding: 4px 10px;
  background: #f5f5f5;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.modal-tag:hover {
  background: var(--primary);
  color: white;
}

.modal-info-right {
  display: flex;
  gap: 10px;
}

.modal-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  border: 1px solid #ddd;
  transition: all 0.2s;
}

.modal-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.like-btn.liked {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.collect-btn.collected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ========== 采集弹窗 ========== */
.collect-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
}

.collect-modal.active {
  display: flex;
}

.collect-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
}

.collect-modal-content {
  position: relative;
  width: 340px;
  max-height: 80vh;
  background: var(--bg-white);
  border-radius: 12px;
  padding: 20px;
  overflow-y: auto;
  z-index: 1;
}

.collect-modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.collect-board-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.collect-board-item:hover {
  background: #f5f5f5;
}

.collect-board-item.selected {
  background: #fff0f0;
}

.collect-board-cover {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
}

.collect-board-info {
  flex: 1;
}

.collect-board-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.collect-board-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.collect-board-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.collect-board-item.selected .collect-board-check {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.collect-new-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  border: 1px dashed #ddd;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s;
}

.collect-new-board:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff0f0;
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
  }
  .main {
    margin-left: 200px;
  }
}

@media (max-width: 992px) {
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
  }
  .header-center {
    display: none;
  }
  .nav {
    gap: 16px;
  }
  .nav-item {
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 12px;
  }
  .header-left {
    gap: 16px;
  }
  .logo span {
    display: none;
  }
  .nav {
    display: none;
  }
  .header-right {
    gap: 8px;
  }
  .upload-btn span {
    display: none;
  }
  .upload-btn {
    padding: 8px;
    border-radius: 50%;
  }
  .icon-btn {
    display: none;
  }
  .waterfall-column {
    min-width: 160px;
  }
}

@media (max-width: 480px) {
  .waterfall {
    margin-left: 0;
  }
  .waterfall-column {
    min-width: 100%;
    padding-left: 0;
  }
  .waterfall-item {
    margin-bottom: 8px;
  }
}
