.crystal-library-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
  background: linear-gradient(to bottom, #f8f9fa, #ffffff);
}

/* 离线提示样式 */
.offline-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 12px;
  margin-bottom: 20px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid #f5c6cb;
  animation: fadeIn 0.5s ease;
}

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

.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-title {
  font-size: 2.8rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  font-weight: 700;
  background: linear-gradient(45deg, #2c3e50, #3498db, #2ecc71);
  -webkit-background-clip: text;
  background-clip: text; /* 标准属性，增强兼容性 */
  -webkit-text-fill-color: transparent;
  animation: titleGradient 8s ease infinite;
}

@keyframes titleGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.page-description {
  font-size: 1.2em;
  color: #666;
}

.search-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}

.search-box {
  width: 80%;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  overflow: hidden;
}

#crystal-search {
  flex: 1;
  padding: 15px 25px;
  font-size: 16px;
  border: none;
  outline: none;
  transition: all 0.3s;
  background: transparent;
}

#crystal-search:focus {
  background: rgba(74, 144, 226, 0.05);
}

/* .search-btn {
  background: #4a90e2;
  color: white;
  border: none;
  padding: 15px 30px;
  cursor: pointer;
  transition: background-color 0.3s;
  height: 100%;
  font-size: 1.1em;
} */

.search-btn:hover {
  background: #357abd;
}

.ai-scan-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(45deg, #3498db, #2ecc71);
  color: white;
  border: none;
  padding: 1.2rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.ai-scan-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: 0.5s;
}

.ai-scan-btn:hover::before {
  left: 100%;
}

.ai-scan-btn:hover {
  background: #27ae60;
}

/* 新增 - 分类过滤区样式 */
.filter-section {
  margin-bottom: 40px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  padding: 25px;
  border: 1px solid rgba(0,0,0,0.03);
}

.filter-group {
  margin-bottom: 25px;
}

.filter-group:last-child {
  margin-bottom: 0;
}

.filter-title {
  font-size: 1.2em;
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-title i {
  color: #4a90e2;
}

.filter-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  background: #f8f9fa;
  border: 2px solid transparent;
  padding: 0.85rem 1.75rem;
  border-radius: 8px;
  color: #666;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
  text-decoration: none;
  display: inline-block;
}

.filter-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(52, 152, 219, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  z-index: -1;
}

.filter-btn:hover::before {
  width: 300%;
  height: 300%;
}

.filter-btn:hover {
  border-color: #4a90e2;
  color: #4a90e2;
}

.filter-btn.active {
  background: #4a90e2;
  border-color: #4a90e2;
  color: white;
}

/* 当前过滤条件样式 */
.current-filters {
  margin-bottom: 25px;
}

.filter-tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-tag {
  background: #e6f0fd;
  color: #4a90e2;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.remove-filter {
  color: #4a90e2;
  text-decoration: none;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  background: rgba(74, 144, 226, 0.1);
  transition: all 0.2s;
}

.remove-filter:hover {
  background: rgba(74, 144, 226, 0.2);
}

.clear-all-filters {
  margin-left: auto;
  color: #666;
  text-decoration: none;
  font-size: 0.9em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.clear-all-filters:hover {
  color: #4a90e2;
}

/* 矿物卡片样式 */
.crystal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 20px 0;
}

.crystal-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0,0,0,0.03);
  height: 100%;
}

.crystal-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.crystal-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.crystal-preview {
  width: 100%;
  height: 220px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f8fa;
}

/* 图片占位符样式 */
.img-placeholder {
  background-color: #f6f8fa;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.2), rgba(255,255,255,0));
  transform: translateX(-100%);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  100% {
    transform: translateX(100%);
  }
}

.crystal-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.5s;
}

.crystal-card:hover .crystal-preview img {
  transform: scale(1.05);
}

.crystal-info {
  padding: 20px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.9), rgba(255,255,255,1));
}

.crystal-name {
  font-size: 1.3em;
  color: #2c3e50;
  margin-bottom: 8px;
  font-weight: 600;
}

.crystal-meta {
  color: #666;
  margin-bottom: 12px;
  font-size: 0.95em;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.meta-formula {
  font-style: italic;
  color: #4a90e2;
}

.meta-system, .meta-category {
  color: #555;
}

.meta-divider {
  color: #ddd;
  margin: 0 2px;
}

.crystal-brief {
  color: #777;
  font-size: 0.95em;
  line-height: 1.5;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3; /* 标准属性，增强兼容性 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-link {
  color: #4a90e2;
  font-weight: 500;
  font-size: 0.95em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.crystal-card:hover .detail-link {
  color: #3498db;
}

/* 视图模式 */
.view-mode-switch {
  display: flex;
  gap: 10px;
}

.mode-btn {
  background: #f5f7fa;
  border: 1px solid #e0e6ed;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.95em;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mode-btn.active, .mode-btn:hover {
  background: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
}

#crystal-list.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

#crystal-list.list-view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#crystal-list.list-view .crystal-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
}

#crystal-list.list-view .crystal-preview {
  width: 200px;
  height: auto;
  min-height: 200px;
  flex-shrink: 0;
}

#crystal-list.list-view .crystal-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#crystal-list.list-view .crystal-brief {
  flex-grow: 1;
  margin-bottom: 15px;
  -webkit-line-clamp: 4;
  line-clamp: 4; /* 标准属性，增强兼容性 */
}

/* 分页样式 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  gap: 6px;
}

.pagination .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  background-color: #f5f7fa;
  color: #666;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid #e0e6ed;
}

.pagination .page-link:hover {
  background-color: #e6eff9;
  color: #4a90e2;
  border-color: #4a90e2;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.1);
}

.pagination .page-link.active {
  background-color: #4a90e2;
  color: #fff;
  border-color: #4a90e2;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.2);
}

.pagination .prev-link,
.pagination .next-link {
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .crystal-library-container {
    padding: 1rem;
  }
  
  .page-title {
    font-size: 2.2rem;
  }
  
  .page-description {
    font-size: 1em;
  }
  
  .search-toolbar {
    flex-direction: column;
    gap: 15px;
  }

  .search-box {
    width: 100%;
  }
  
  .filter-section {
    padding: 15px;
  }
  
  .filter-options {
    justify-content: flex-start;
  }
  
  .filter-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.9em;
  }

  #crystal-list.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }
  
  #crystal-list.list-view .crystal-preview {
    width: 120px;
    min-height: 120px;
  }
  
  .crystal-info {
    padding: 15px;
  }
  
  .crystal-name {
    font-size: 1.1em;
  }
  
  .pagination {
    flex-wrap: wrap;
    margin-top: 30px;
  }
  
  .pagination .page-link {
    min-width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }
}