.login-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #FAFAFA;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease-out;
}

.login-page.fade-out {
  opacity: 0;
  pointer-events: none;
}

.login-container {
  text-align: center;
  max-width: 400px;
  width: 100%;
  padding: 32px;
}

.login-header {
  margin-bottom: 40px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.login-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--cls-color-text);
  margin: 0 0 4px;
}

.login-subtitle {
  font-size: 14px;
  color: #9E9E9E;
  margin: 0;
}

.code-input-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}

.code-input-cell {
  width: 56px;
  height: 64px;
  border: 2px solid var(--cls-color-border);
  border-radius: 12px;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  line-height: 64px;
  color: var(--cls-color-text);
}

.code-input-cell.active {
  border-color: var(--cls-color-primary);
  box-shadow: 0 0 0 3px var(--cls-color-primary-bg);
}

.code-input-cell.active::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 24px;
  background: var(--cls-color-primary);
  animation: blink 1s step-end infinite;
}

.code-input-cell.filled {
  border-color: var(--cls-color-primary);
}

.code-input-cell.error {
  border-color: var(--cls-color-error);
  animation: shake 0.4s ease-in-out;
}

.code-input-cell.success {
  border-color: var(--cls-color-success);
  background: rgba(56, 142, 60, 0.06);
  animation: successPop 0.3s ease-out;
}

.code-input-cell.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--cls-color-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.code-input-cell.loading {
  color: transparent;
}

.login-error {
  color: var(--cls-color-error);
  font-size: 14px;
  margin-top: 8px;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.login-error.visible {
  opacity: 1;
}

.error-icon {
  font-size: 16px;
}

.error-retry {
  padding: 2px 12px;
  border: 1px solid var(--cls-color-error);
  border-radius: 4px;
  background: white;
  color: var(--cls-color-error);
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}

.error-retry:hover {
  background: var(--cls-color-error-bg);
}

.login-class-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--cls-color-success);
  margin-top: 12px;
  display: none;
  opacity: 0;
}

.login-class-name.fade-in {
  animation: fadeIn 0.3s ease-in forwards;
}

.login-guide {
  margin-top: 32px;
  padding: 20px 24px;
  background: var(--cls-color-primary-bg);
  border-radius: var(--cls-radius-md);
  border: 1px solid var(--cls-color-border-light);
  text-align: left;
}

.login-guide-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--cls-color-primary);
  margin: 0 0 12px;
}

.login-guide-content p {
  font-size: 14px;
  color: var(--cls-color-text-light);
  margin: 6px 0;
  line-height: 1.6;
}

.login-guide-content strong {
  color: var(--cls-color-text);
}

.login-hint {
  font-size: 14px;
  color: #9E9E9E;
  margin-top: 24px;
}

.recent-classes {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--cls-color-border-light);
}

.recent-title {
  font-size: 13px;
  color: #9E9E9E;
  margin-bottom: 12px;
}

.recent-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.recent-class-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--cls-color-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 160px;
}

.recent-class-card:hover {
  border-color: var(--cls-color-primary);
  background: var(--cls-color-primary-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.1);
}

.recent-class-card:active {
  transform: translateY(0);
}

.card-icon {
  font-size: 24px;
}

.card-info {
  flex: 1;
  text-align: left;
}

.card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--cls-color-text);
}

.card-code {
  font-size: 12px;
  color: var(--cls-color-text-light);
  font-family: monospace;
}

.card-time {
  font-size: 11px;
  color: #BDBDBD;
  white-space: nowrap;
}

.card-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.card-status .status-dot.online {
  background: #4CAF50;
}

.card-status .status-dot.expired {
  background: #BDBDBD;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-8px); }
  20% { transform: translateX(8px); }
  30% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  50% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  90% { transform: translateX(-1px); }
}

@keyframes successPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-height: 600px) {
  .login-logo { font-size: 48px; margin-bottom: 8px; }
  .login-title { font-size: 22px; }
  .login-header { margin-bottom: 24px; }
  .login-hint { margin-top: 16px; }
}

@media (max-width: 480px) {
  .login-container { padding: 16px; }
  .code-input-cell { width: 44px; height: 52px; font-size: 22px; line-height: 52px; }
  .code-input-group { gap: 8px; }
}

.teacher-login-form {
  max-width: 340px;
  margin: 0 auto;
  text-align: left;
}

.teacher-form-group {
  margin-bottom: 20px;
}

.teacher-form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--cls-color-text);
  margin-bottom: 6px;
}

.teacher-form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--cls-color-border);
  border-radius: var(--cls-radius-md);
  font-size: 15px;
  color: var(--cls-color-text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.teacher-form-input:focus {
  border-color: var(--cls-color-primary);
  box-shadow: 0 0 0 3px var(--cls-color-primary-bg);
}

.teacher-form-input::placeholder {
  color: #BDBDBD;
}

.teacher-login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--cls-radius-md);
  background: var(--cls-color-primary);
  color: var(--cls-color-text-white);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  outline: none;
}

.teacher-login-btn:hover {
  background: var(--cls-color-primary-dark, #1565C0);
}

.teacher-login-btn:active {
  transform: scale(0.98);
}

.teacher-login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.teacher-login-error {
  color: var(--cls-color-error);
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

.teacher-login-register {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--cls-color-text-light);
}

.teacher-login-register a {
  color: var(--cls-color-primary);
  text-decoration: none;
  cursor: pointer;
}

.teacher-login-register a:hover {
  text-decoration: underline;
}

.invite-banner {
  background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
  border: 1px solid #90CAF9;
  border-radius: var(--cls-radius-lg, 12px);
  padding: 16px 20px;
  margin-bottom: 24px;
  text-align: center;
}

.invite-banner-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.invite-banner-text {
  font-size: 15px;
  color: var(--cls-color-text);
  margin-bottom: 4px;
}

.invite-banner-text strong {
  color: var(--cls-color-primary);
}

.invite-banner-desc {
  font-size: 13px;
  color: var(--cls-color-text-light);
}

/* ============ 移动端登录页适配 ============ */
@media (max-width: 767px) {
  .login-container {
    padding: var(--cls-space-lg);
  }

  .login-code-input {
    gap: var(--cls-space-sm);
  }

  .code-input-cell {
    width: 48px;
    height: 54px;
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: var(--cls-space-base);
  }

  .code-input-cell {
    width: 40px;
    height: 46px;
    font-size: 20px;
  }

  .code-input-group {
    gap: 6px;
  }

  .login-logo img {
    width: 64px;
    height: 64px;
  }

  .login-title {
    font-size: 22px;
  }

  .teacher-login-form {
    padding: 0;
  }
}
