/* ==================== 全局样式 ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #3498db;
  --primary-dark: #2980b9;
  --success-color: #27ae60;
  --danger-color: #e74c3c;
  --text-color: #2c3e50;
  --text-light: #7f8c8d;
  --bg-light: #f5f5f5;
  --border-color: #ecf0f1;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg-light);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== 导航栏 ==================== */

.navbar {
  background: white;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  gap: 30px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-color);
  margin: 0;
}

.tagline {
  font-size: 12px;
  color: var(--text-light);
  margin: 0;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  flex: 1;
}

.nav-link {
  text-decoration: none;
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 4px;
  transition: all 0.3s;
  font-size: 14px;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary-color);
  color: white;
}

.nav-right {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-left: auto;
}

/* ==================== 按钮 ==================== */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  font-weight: 500;
}

.btn-primary {
  background: #1890ff;
  color: #fff;
}

.btn-primary:hover {
  background: #40a9ff;
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-block {
  width: 100%;
}

/* ==================== 搜索栏 ==================== */

.search-section {
  background: white;
  padding: 12px 0;
  margin: 0;
  box-shadow: var(--shadow);
}

.search-box {
  position: relative;
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 60px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

.search-suggest-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

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

.search-suggest-item:hover {
  background: #f5f5f5;
}

.search-suggest-item:active {
  background: #e6f7ff;
}

.search-history {
  padding: 8px 16px;
  color: #999;
  font-size: 12px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.search-history-item {
  color: #1890ff;
  cursor: pointer;
  margin-right: 8px;
}

.search-history-item:hover {
  text-decoration: underline;
}

.search-btn {
  padding: 12px 20px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
}

.search-btn:hover {
  background: #40a9ff;
}

/* ==================== 素材网格 ==================== */

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.material-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.material-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.card-image {
  width: 100%;
  height: 150px;
  background: var(--bg-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-image::after {
  content: '⬇️ 点击下载';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.material-card:hover .card-image::after {
  opacity: 1;
}

.material-card:hover .card-image img {
  transform: scale(1.05);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
}

.material-card:hover .card-overlay {
  opacity: 1;
}

.card-overlay .download-btn {
  background: #1890ff;
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.card-image {
  width: 100%;
  height: 150px;
  background: var(--bg-light);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-image::after {
  content: '⬇️ 点击下载';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.material-card:hover .card-image::after {
  opacity: 1;
}

.material-card:hover .card-image img {
  transform: scale(1.05);
}

.card-info {
  padding: 1px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 20px;
}

.material-card h3 {
  padding: 0;
  margin: 0 0 1px 0;
  font-size: 13px;
  color: #333;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.material-card p {
  padding: 0;
  margin: 4px 0 0 0;
  font-size: 12px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  border-top: 1px solid #e8e8e8;
  gap: 8px;
  background: #e6f7ff;
}

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

.category-badge {
  background: #e6f7ff;
  color: #1890ff;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.downloads {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

.download-btn {
  padding: 6px 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.download-btn:hover {
  background: var(--primary-dark);
}

.category-badge {
  background: var(--primary-color);
  color: white;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

.downloads {
  font-size: 12px;
  color: var(--text-light);
}

.material-card h3 {
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text-color);
  line-height: 1.4;
}

.material-card p {
  padding: 0 16px;
  font-size: 14px;
  color: var(--text-light);
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
}

.file-size {
  font-size: 12px;
  color: var(--text-light);
}

.download-btn {
  background: var(--success-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
  font-weight: 500;
}

.download-btn:hover {
  background: #229954;
}

/* ==================== 用户菜单 ==================== */

.user-menu {
  position: absolute;
  top: 60px;
  right: 20px;
  background: white;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 101;
  min-width: 150px;
}

.menu-item {
  display: block;
  padding: 12px 16px;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.3s;
  border-bottom: 1px solid var(--border-color);
}

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

.menu-item:hover {
  background: var(--bg-light);
}

/* ==================== 模态框 ==================== */

.modal {
  display: flex;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  animation: slideIn 0.3s ease-out;
}

.modal-sm {
  max-width: 400px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.3s;
}

.close-btn:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 20px;
}

/* ==================== 表单 ==================== */

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  font-weight: 500;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-section input,
.form-section textarea,
.form-section select {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-section input:focus,
.form-section textarea:focus,
.form-section select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* ==================== 状态提示 ==================== */

.loading,
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 16px;
}

.loading {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==================== 下载信息 ==================== */

.download-info {
  background: var(--bg-light);
  padding: 20px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.download-info h3 {
  margin-bottom: 15px;
  color: var(--text-color);
}

.download-info p {
  margin: 8px 0;
  color: var(--text-light);
  font-size: 14px;
}

.download-info strong {
  color: var(--text-color);
}

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 15px;
    padding: 10px 20px;
  }

  .nav-links {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
  }

  .nav-right {
    width: 100%;
    justify-content: center;
  }

  .materials-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .modal-content {
    width: 95%;
    max-width: 100%;
  }

  .search-box {
  position: relative;
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 18px;
  }

  .tagline {
    display: none;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 12px;
  }

  .materials-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .material-card h3 {
    font-size: 14px;
    padding: 8px 12px;
  }

  .material-card p {
    font-size: 12px;
    padding: 0 12px;
  }
}

/* ==================== Banner 位 ==================== */
.banner-section {
  width: 100%;
  min-height: 200px;
  background: #ffffff;
  overflow: hidden;
  position: relative;
}
/* 强制 Banner 有可见背景，防止后台设置白色背景导致内容不可见 */
.banner-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  z-index: 0;
  pointer-events: none;
}
.banner-container {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 200px;
  position: relative;
}
.banner-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.banner-content.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}
.banner-img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}
.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.banner-text {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  flex-wrap: wrap;
  justify-content: center;
}
.banner-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.banner-subtitle {
  font-size: 14px;
  opacity: 0.9;
}
.banner-btn {
  padding: 6px 16px;
  border: 1.5px solid currentColor;
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.banner-btn:hover { opacity: 0.8; }

/* ==================== Banner 轮播指示器 ==================== */
.banner-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.3s;
}
.banner-dot.active {
  background: #fff;
  transform: scale(1.2);
}
.banner-section {
  position: relative;
}

/* ==================== 页脚 ==================== */
.footer {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 40px 0 20px;
  margin-top: 60px;
}
.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}
.footer-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #fff;
}
.footer-section p {
  font-size: 13px;
  line-height: 1.6;
  color: #bdc3c7;
  margin-bottom: 8px;
}
.footer-section ul {
  list-style: none;
}
.footer-section ul li {
  margin-bottom: 6px;
}
.footer-section a {
  color: #3498db;
  text-decoration: none;
  font-size: 13px;
}
.footer-section a:hover {
  text-decoration: underline;
}
.footer-bottom {
  border-top: 1px solid #34495e;
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #95a5a6;
}
.footer-bottom a {
  color: #3498db;
  text-decoration: none;
}
.footer-bottom a:hover {
  text-decoration: underline;
}

/* ==================== 版权来源样式 ==================== */
.download-info .source-link {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #3498db;
  color: #fff;
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  transition: background 0.2s;
}
.download-info .source-link:hover {
  background: #2980b9;
}
.download-info .source-text {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #f0f0f0;
  color: #666;
  border-radius: 20px;
  font-size: 13px;
}

/* ==================== 分页 ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  margin: 30px auto;
  max-width: 600px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.page-btn {
  padding: 10px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.page-btn:hover:not(:disabled) {
  background: var(--primary-dark, #2980b9);
  transform: translateY(-1px);
}

.page-btn:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
}

.page-info {
  font-size: 14px;
  color: var(--text-color);
  font-weight: 500;
  padding: 0 16px;
}

/* ==================== 排序按钮 ==================== */
.sort-buttons {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.sort-btn {
  padding: 8px 14px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.sort-btn:hover {
  background: #e8e8e8;
  border-color: #999;
}

.sort-btn.active {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
}
