* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'PingFang SC', Roboto, 'Helvetica Neue', sans-serif;
  background: #f0f2f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 5px;
}

.subtitle {
  color: #777;
  font-size: 0.95rem;
}

/* 分类按钮 */
.categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 25px;
}

.cat-btn {
  padding: 8px 18px;
  border: none;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: all 0.2s;
}

.cat-btn.active,
.cat-btn:hover {
  background: #1677ff;
  color: #fff;
}

/* 搜索和新增区 */
.actions {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

#searchInput {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}

#searchInput:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15);
}

#addBtn {
  padding: 10px 22px;
  background: #1677ff;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
}

#addBtn:hover {
  background: #0958d9;
}

/* 资源卡片网格 */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* 单个卡片 */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

.card .card-category {
  font-size: 1.5rem;
  margin-bottom: 10px;
  display: inline-block;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 2px 12px;
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  word-break: break-word;
}

.card .link a {
  color: #1677ff;
  text-decoration: none;
  font-size: 0.9rem;
  word-break: break-all;
}

.card .link a:hover {
  text-decoration: underline;
}

.card .desc {
  color: #666;
  font-size: 0.88rem;
  margin: 10px 0;
}

.card-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.card-actions button {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-actions button:hover {
  color: #1677ff;
}

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 25px 30px;
  width: 90%;
  max-width: 450px;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 20px;
}

.close {
  position: absolute;
  right: 18px;
  top: 12px;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
}

.close:hover {
  color: #333;
}

form label {
  display: block;
  margin: 12px 0 4px;
  font-weight: 500;
  font-size: 0.9rem;
}

form input,
form textarea,
form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

form input:focus,
form textarea:focus,
form select:focus {
  border-color: #1677ff;
  outline: none;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-actions button {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.form-actions button[type="submit"] {
  background: #1677ff;
  color: #fff;
}

.form-actions button[type="submit"]:hover {
  background: #0958d9;
}

.form-actions button[type="button"] {
  background: #f0f0f0;
  color: #555;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #aaa;
  padding: 50px 0;
}

/* 手机适配 */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.7rem;
  }
  .actions {
    flex-direction: column;
  }
}

.action-secondary {
  padding: 10px 18px;
  background: #fff;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #555;
}

.action-secondary:hover {
  border-color: #1677ff;
  color: #1677ff;
}