/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f0f8ff;
  color: #333;
  line-height: 1.6;
}

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

header {
  background-color: #007bff;
  color: white;
  padding: 15px 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

header h1 {
  text-align: center;
  font-size: 24px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

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

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

/* 首页样式 */
.class-selector {
  max-width: 500px;
  margin: 50px auto;
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.class-selector h2 {
  text-align: center;
  color: #007bff;
  margin-bottom: 20px;
}

.class-list {
  list-style: none;
  margin-top: 20px;
}

.class-list li {
  margin-bottom: 10px;
}

.class-list a {
  display: block;
  padding: 12px;
  background: #e9f5ff;
  color: #007bff;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.class-list a:hover {
  background: #d0e9ff;
}

/* 点名页样式 */
.attendance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.select-all {
  display: flex;
  align-items: center;
  gap: 5px;
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.student-card {
  background: white;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
  transition: transform 0.3s ease, border-color 0.3s ease;
  border: 2px solid #dee2e6;
}

.student-card:hover {
  transform: translateY(-5px);
}

.student-card.present {
  border-color: #007bff; /* 已到 - 蓝色 */
}

.student-card.late {
  border-color: #ffc107; /* 迟到 - 黄色 */
}

.student-card.leave {
  border-color: #dc3545; /* 请假 - 红色 */
}

.student-card.out {
  border-color: #28a745; /* 外出 - 绿色 */
}

.student-card.absent {
  border-color: #dc3545; /* 缺席 - 红色 */
}

.student-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  border: 2px solid #007bff;
}

.student-class {
  font-size: 12px;
  color: #667;
  margin-bottom: 5px;
}

.student-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.student-no {
  font-size: 12px;
  color: #999;
  margin-bottom: 15px;
}

.student-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* 刷卡页样式 */
.swipe-container {
  max-width: 400px;
  margin: 50px auto;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
  text-align: center;
}

.swipe-container h2 {
  color: #007bff;
  margin-bottom: 30px;
}

.swipe-input {
  margin-bottom: 20px;
}

.swipe-message {
  margin-top: 20px;
  padding: 15px;
  border-radius: 4px;
  font-weight: 500;
}

.swipe-message.success {
  background-color: #d4edda;
  color: #155724;
}

.swipe-message.warning {
  background-color: #fff3cd;
  color: #856404;
}

.swipe-message.error {
  background-color: #f8d7da;
  color: #721c24;
}

/* 登录页样式 */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  background: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.login-container h2 {
  text-align: center;
  color: #007bff;
  margin-bottom: 30px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

.login-footer a {
  color: #007bff;
  text-decoration: none;
}

/* 管理员后台样式 */
.admin-tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
}

.admin-tab {
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  border-bottom: 3px solid transparent;
}

.admin-tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.data-table th, .data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
}

.data-table th {
  background-color: #e9f5ff;
  color: #007bff;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-present {
  background-color: #cce5ff;
  color: #004085;
}

.badge-late {
  background-color: #fff3cd;
  color: #856404;
}

.badge-leave {
  background-color: #f8d7da;
  color: #721c24;
}

.badge-out {
  background-color: #d4edda;
  color: #155724;
}

.badge-absent {
  background-color: #f8d7da;
  color: #721c24;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .student-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .attendance-header {
    flex-direction: column;
    align-items: flex-start;
  }
}