* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f9f7f0;
  min-height: 100vh;
  color: #333;
}

/* 认证页面样式 */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  text-align: center;
  color: #667eea;
  margin-bottom: 10px;
  font-size: 24px;
}

.auth-box h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #555;
  font-size: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: #4a9c88;
  color: white;
}

.btn-primary:hover {
  background: #3a7c6c;
}

.btn-secondary {
  background: rgba(168, 216, 185, 0.8);
  color: #2a5d67;
  border: 1px solid #a8d8b9;
}

.btn-secondary:hover {
  background: #a8d8b9;
  color: white;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-warning {
  background: #ffc107;
  color: #333;
}

.btn-warning:hover {
  background: #e0a800;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-restore {
  padding: 6px 12px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin-right: 5px;
}

.btn-restore:hover {
  background: #218838;
}

.btn-delete-sm {
  padding: 6px 12px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.btn-delete-sm:hover {
  background: #c82333;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  margin: 2px;
}

.auth-links {
  margin-top: 20px;
  text-align: center;
  display: flex;
  justify-content: space-between;
}

.auth-links a {
  color: #667eea;
  text-decoration: none;
  font-size: 14px;
}

.auth-links a:hover {
  text-decoration: underline;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #f5c6cb;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 20px;
  border: 1px solid #c3e6cb;
}

/* 容器样式 */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  min-height: 100vh;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 3px solid #a8d8b9;
  margin-bottom: 30px;
  background: rgba(168, 216, 185, 0.1);
  border-radius: 10px 10px 0 0;
}

header h1 {
  color: #2a5d67;
  font-size: 2.2rem;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 2px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-actions span {
  margin-right: 15px;
  color: #555;
}

/* 班级列表样式 */
.class-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px 0;
}

.class-card {
  background: white;
  border: 2px solid #eee;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.class-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.class-card h3 {
  color: #333;
  margin-bottom: 10px;
  font-size: 20px;
}

.class-date {
  color: #999;
  font-size: 14px;
  margin-bottom: 20px;
}

.class-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.create-card {
  border: 2px dashed #667eea;
  background: #f8f9ff;
  cursor: pointer;
}

.create-card a {
  text-decoration: none;
  color: #667eea;
  display: block;
}

.create-icon {
  font-size: 48px;
  color: #667eea;
  margin-bottom: 10px;
}

/* 工具栏样式 */
.toolbar {
  display: flex;
  gap: 12px;
  padding: 20px 25px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0d6c3;
}

.toolbar input[type="text"] {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  flex: 1;
  min-width: 200px;
}

.toolbar select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: white;
}

.menu-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: white;
  min-width: 160px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  z-index: 1;
  border-radius: 5px;
  overflow: hidden;
}

.menu-dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  color: #333;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  transition: background 0.3s;
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}

/* 主内容区域 */
.main-content {
  display: flex;
  gap: 20px;
}

/* 学生网格样式 */
.students-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
}

.student-card {
  background: rgba(245, 245, 245, 0.8);
  border: 2px solid #e0d6c3;
  border-radius: 12px;
  padding: 20px 15px;
  text-align: center;
  transition: all 0.4s ease;
  position: relative;
  cursor: pointer;
}

.card-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.student-card:hover .card-delete-btn {
  opacity: 1;
}

.card-delete-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}

.student-card:hover {
  background: rgba(168, 216, 185, 0.2);
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-color: #4a9c88;
}

.student-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.sprite-container {
  position: relative;
  margin: 10px 0;
}

.sprite-display {
  position: relative;
  margin: 10px auto;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sprite-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0d6c3 0%, #c8b8a0 100%);
  border: 3px solid #a8d8b9;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.sprite-placeholder {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  color: #2a5d67;
  background: linear-gradient(135deg, #e0d6c3 0%, #c8b8a0 100%);
  border: 3px solid #a8d8b9;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.sprite-image:hover,
.sprite-placeholder:hover {
  transform: scale(1.05);
  border-color: #4a9c88;
  box-shadow: 0 8px 20px rgba(74, 156, 136, 0.4);
}

.level-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #4a9c88 0%, #3a7c6c 100%);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  border: 2px solid white;
  z-index: 10;
}

.student-card h3 {
  margin: 12px 0 8px;
  font-size: 1.1rem;
  color: #2a5d67;
  font-weight: 700;
}

.student-number {
  font-size: 0.9rem;
  color: #666;
  margin: 8px 0 5px;
  font-weight: 500;
}

.student-id {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 8px;
}

.points {
  font-size: 1.1rem;
  color: #4a9c88;
  font-weight: bold;
  margin: 12px 0;
  padding: 8px;
  background: rgba(74, 156, 136, 0.1);
  border-radius: 8px;
}

.student-actions {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 10px;
}

/* 排行榜样式 */
.ranking-sidebar {
  width: 320px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  border: 2px solid #e0d6c3;
}

.ranking-sidebar h2 {
  color: #2a5d67;
  margin-bottom: 20px;
  font-size: 1.5rem;
  text-align: center;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.ranking-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s;
}

.tab-btn.active {
  background: #667eea;
  color: white;
}

.ranking-list {
  margin-bottom: 15px;
}

.ranking-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: rgba(245, 245, 245, 0.8);
  border-radius: 8px;
  margin-bottom: 10px;
  gap: 12px;
  transition: all 0.3s ease;
  border: 1px solid #e0d6c3;
}

.ranking-item:hover {
  background: rgba(168, 216, 185, 0.2);
  transform: translateX(5px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.ranking-item .rank {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #4a9c88 0%, #3a7c6c 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.ranking-item:nth-child(1) .rank {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #333;
  font-size: 16px;
}

.ranking-item:nth-child(2) .rank {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
  color: #333;
}

.ranking-item:nth-child(3) .rank {
  background: linear-gradient(135deg, #cd7f32 0%, #e8a87c 100%);
  color: white;
}

.ranking-item .name {
  flex: 1;
  font-weight: 500;
}

.ranking-item .level {
  font-size: 12px;
  color: #667eea;
}

.ranking-item .points {
  font-weight: bold;
  color: #28a745;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .ranking-sidebar {
    width: 100%;
  }

  .students-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar input[type="text"],
  .toolbar select {
    width: 100%;
  }

  header {
    flex-direction: column;
    gap: 15px;
  }

  .header-actions {
    flex-direction: column;
    width: 100%;
  }

  .header-actions .btn {
    width: 100%;
  }

  .class-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .auth-box {
    padding: 20px;
  }

  .students-grid {
    grid-template-columns: 1fr;
  }

  .sprite-image {
    width: 80px;
    height: 80px;
  }
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 30px;
  border: 1px solid #888;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
}

.import-section,
.management-section {
  margin: 25px 0;
  padding: 20px;
  background: #f9f7f0;
  border-radius: 10px;
  border: 1px solid #e0d6c3;
}

.import-section h3,
.management-section h3 {
  color: #2a5d67;
  margin-bottom: 15px;
  font-size: 1.2rem;
  border-bottom: 2px solid #a8d8b9;
  padding-bottom: 8px;
}

.hint {
  color: #666;
  font-size: 0.9rem;
  margin-top: 10px;
  font-style: italic;
}

.file-input {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 15px 0;
  border: 2px dashed #667eea;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
}

.file-input:hover {
  border-color: #5568d3;
  background: #f8f9ff;
}

.import-result {
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  min-height: 50px;
}

.management-section .form-group {
  margin-bottom: 15px;
}

.management-section label {
  display: block;
  font-weight: 600;
  color: #2a5d67;
  margin-bottom: 8px;
}

.management-section input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.management-section input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}
