/* 更新后的单行布局样式 */

/* 规则网格 - 横向布局，自动填满 */
.rules-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 15px 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  align-content: flex-start;
}

/* 规则选项 - 紧凑横向布局，不限制宽度 */
.rule-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  min-height: 36px;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
  max-width: none;
}

.rule-option:hover {
  border-color: #667eea;
  background: #f7fafc;
}

.rule-option input[type="checkbox"] {
  margin: 0;
  transform: scale(1.1);
  flex-shrink: 0;
}

.rule-option label {
  display: flex;
  flex-direction: row;
  align-items: center;
  cursor: pointer;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.rule-name {
  font-weight: 600;
  color: #2d3748;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9em;
  flex: 1;
  min-width: 50px;
}

.rule-points {
  font-size: 0.85em;
  color: #718096;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 6px;
  background: #f7fafc;
  border-radius: 4px;
  min-width: 35px;
  text-align: center;
}

/* 选中状态样式 */
.rule-option input[type="checkbox"]:checked + label .rule-name {
  color: #667eea;
}

.rule-option input[type="checkbox"]:checked + label .rule-points {
  color: #667eea;
  font-weight: 600;
  background: #edf2ff;
}

/* 正负积分颜色区分 */
.rule-points.positive {
  color: #38a169;
  background: #f0fff4;
}

.rule-points.negative {
  color: #e53e3e;
  background: #fff5f5;
}

/* 选中状态下的正负积分颜色 */
.rule-option input[type="checkbox"]:checked + label .rule-points.positive {
  color: #2f855a;
  background: #e6fffa;
}

.rule-option input[type="checkbox"]:checked + label .rule-points.negative {
  color: #c53030;
  background: #fed7d7;
}

/* 批量操作中的规则选择器样式 */
#batchStudentRuleSelect .rules-grid,
#batchGroupRuleSelect .rules-grid {
  max-height: 250px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
}

#batchStudentRuleSelect .rule-option,
#batchGroupRuleSelect .rule-option {
  padding: 5px 8px;
  min-height: 32px;
  gap: 5px;
}

/* 响应式设计 - 小屏幕适配 */
@media (max-width: 768px) {
  .rules-grid {
    gap: 4px;
  }
  
  .rule-option {
    padding: 5px 8px;
    min-height: 32px;
    gap: 5px;
  }
  
  .rule-name {
    font-size: 0.85em;
    min-width: 40px;
  }
  
  .rule-points {
    font-size: 0.8em;
    min-width: 30px;
    padding: 1px 4px;
  }
}

@media (max-width: 480px) {
  .rules-grid {
    gap: 3px;
  }
  
  .rule-option {
    padding: 4px 6px;
    min-height: 28px;
    gap: 4px;
  }
  
  .rule-name {
    font-size: 0.8em;
    min-width: 35px;
  }
  
  .rule-points {
    font-size: 0.75em;
    min-width: 25px;
    padding: 1px 3px;
  }
}

/* 位置判定的关闭按钮样式 */

/* 右上角位置的关闭按钮 - 圆形×符号 */
.top-right-close {
  position: absolute !important;
  top: 15px !important;
  right: 15px !important;
  background: #e53e3e !important;
  border: 2px solid #c53030 !important;
  color: white !important;
  font-size: 24px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 8px rgba(229, 62, 62, 0.3) !important;
  z-index: 1000 !important;
  line-height: 1 !important;
  padding: 0 !important;
}

.top-right-close:hover {
  background: #c53030 !important;
  border-color: #9b2c2c !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4) !important;
}

.top-right-close:active {
  transform: scale(0.95) !important;
  box-shadow: 0 1px 4px rgba(229, 62, 62, 0.3) !important;
}

/* 底部区域的矩形取消按钮 */
.modal-buttons .modal-close-btn {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  width: auto !important;
  height: auto !important;
  border-radius: 6px !important;
  background: #6c757d !important;
  border: 1px solid #5a6268 !important;
  color: white !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 8px 16px !important;
  margin-left: 10px !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
}

.modal-buttons .modal-close-btn:hover {
  background: #5a6268 !important;
  border-color: #495057 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.modal-buttons .modal-close-btn:active {
  transform: translateY(0) !important;
  box-shadow: none !important;
}

/* 特殊处理系统配置模态框的右上角关闭按钮 */
#globalCloseSettingsBtn.top-right-close {
  background: #e53e3e !important;
  border: 2px solid #c53030 !important;
  color: white !important;
}

#globalCloseSettingsBtn.top-right-close:hover {
  background: #c53030 !important;
  border-color: #9b2c2c !important;
}

/* 确保×字符完美居中 */
.top-right-close::before {
  content: "×";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  font-weight: bold;
  font-size: 28px;
}