/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
}

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

/* 头部样式 */
header {
  background: #333;
  color: #fff;
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header h1 a {
  color: #fff;
  text-decoration: none;
  font-size: 1.8rem;
}

nav {
  margin-top: 10px;
}

nav ul {
  list-style: none;
  display: flex;
}

nav ul li {
  margin-right: 20px;
}

nav ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  transition: color 0.3s;
}

nav ul li a:hover {
  color: #4CAF50;
}

/* 主内容样式 */
main {
  padding: 30px 0;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

section {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

section h2 {
  margin-bottom: 20px;
  color: #333;
  border-bottom: 2px solid #4CAF50;
  padding-bottom: 10px;
}

/* 关于我部分 */
.about p {
  font-size: 1.1rem;
  line-height: 1.8;
}

/* TODOList样式 */
.todos-section {
  background-color: #fff;
}

.todo-form {
  margin-bottom: 20px;
}

.todo-form form {
  display: flex;
  gap: 10px;
}

.todo-form input[type="text"] {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.todo-form button {
  padding: 12px 20px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.todo-form button:hover {
  background-color: #45a049;
}

.todo-list ul {
  list-style: none;
}

.todo-list li {
  margin-bottom: 10px;
  background-color: #f9f9f9;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.todo-item {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.todo-list li:hover {
  background-color: #f0f0f0;
}

.todo-list li.completed span {
  text-decoration: line-through;
  color: #777;
}

.toggle-btn {
  background: none;
  border: 1px solid #ddd;
  width: 25px;
  height: 25px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.todo-content {
  flex: 1;
}

.todo-actions {
  display: flex;
  gap: 5px;
}

.edit-btn {
  background-color: #2196F3;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.edit-btn:hover {
  background-color: #1976D2;
}

.delete-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.delete-btn:hover {
  background-color: #d32f2f;
}

.edit-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.edit-form input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.95rem;
}

.save-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.save-btn:hover {
  background-color: #45a049;
}

.cancel-btn {
  background-color: #757575;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.cancel-btn:hover {
  background-color: #616161;
}

/* 作品集样式 */
.portfolio-form-container {
  margin-bottom: 30px;
  padding: 20px;
  background-color: #f0f0f0;
  border-radius: 8px;
}

.add-portfolio-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.add-portfolio-btn:hover {
  background-color: #45a049;
}

.portfolio-form {
  margin-top: 20px;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.form-actions button[type="submit"] {
  background-color: #4CAF50;
  color: white;
}

.form-actions button[type="submit"]:hover {
  background-color: #45a049;
}

.form-actions button[type="button"] {
  background-color: #757575;
  color: white;
}

.form-actions button[type="button"]:hover {
  background-color: #616161;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
}

.portfolio-item {
  background-color: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

.portfolio-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.portfolio-image {
  height: 200px;
  overflow: hidden;
}

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

.portfolio-item:hover .portfolio-image img {
  transform: scale(1.05);
}

.portfolio-content {
  padding: 15px;
}

.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.portfolio-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2rem;
}

.portfolio-category {
  background-color: #2196F3;
  color: white;
  padding: 3px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
}

.portfolio-description {
  color: #666;
  margin-bottom: 15px;
  line-height: 1.6;
}

.portfolio-technologies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
}

.tech-tag {
  background-color: #f1f1f1;
  color: #555;
  padding: 3px 10px;
  border-radius: 15px;
  font-size: 0.8rem;
}

.portfolio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.portfolio-link {
  padding: 8px 12px;
  background-color: #4CAF50;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.portfolio-link:hover {
  background-color: #45a049;
}

.edit-portfolio-btn {
  background-color: #2196F3;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.edit-portfolio-btn:hover {
  background-color: #1976D2;
}

.delete-portfolio-btn {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
  font-size: 0.9rem;
}

.delete-portfolio-btn:hover {
  background-color: #d32f2f;
}

.portfolio-edit-form {
  background-color: white;
  padding: 20px;
  margin: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.portfolio-edit-form .form-group {
  margin-bottom: 12px;
}

.portfolio-edit-form .form-group label {
  font-size: 0.9rem;
}

.portfolio-edit-form .form-group input,
.portfolio-edit-form .form-group textarea {
  padding: 8px;
  font-size: 0.9rem;
}

.portfolio-edit-form .form-actions {
  margin-top: 15px;
}

/* 错误页面样式 */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page h2 {
  font-size: 5rem;
  margin-bottom: 20px;
  color: #4CAF50;
  border-bottom: none;
}

.error-page p {
  font-size: 1.5rem;
  margin-bottom: 30px;
}

.btn {
  display: inline-block;
  padding: 12px 25px;
  background-color: #4CAF50;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 1.1rem;
  transition: background-color 0.3s;
}

.btn:hover {
  background-color: #45a049;
}

/* 页脚样式 */
footer {
  background-color: #333;
  color: white;
  padding: 20px 0;
  text-align: center;
}

footer a {
  color: #4CAF50;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .container {
    width: 95%;
  }
  
  header h1 a {
    font-size: 1.5rem;
  }
  
  nav ul {
    flex-direction: column;
  }
  
  nav ul li {
    margin-bottom: 10px;
  }
  
  .todo-form form {
    flex-direction: column;
  }
  
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}