#xuxiesd_pro {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
    background: white;
    padding: 0;
    /* 改为0，因为拖动句柄会添加padding */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    transition: transform 0.2s ease;
    /* 确保窗口高度自适应内容 */
    min-height: auto;
    height: auto;
    max-height: 90vh;
    overflow: visible;
}
  
#xuxiesd_pro .popup-content {
    padding: 20px;
}
  
/* 桌面端可拖动样式 */
@media (min-width: 769px) {

    #xuxiesd_pro.draggable {
        user-select: none;
    }

    #xuxiesd_pro.dragging {
        transition: none;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    }

    /* 确保拖动时窗口高度自适应 */
    #xuxiesd_pro.dragging {
        height: auto;
        min-height: auto;
    }
}

#xuxiesd_pro .button-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}





/* ========== 仅移动端：内容区固定高度+内部滚动 ========== */
@media (max-width: 768px) {
    /* 内容区容器：固定高度，内部滚动 */
    #xuxiesdpro {
        max-height: 50vh;      /* 固定最大高度，按需调整 */
        overflow-y: auto;       /* 垂直滚动 */
        overflow-x: hidden;     /* 水平方向隐藏 */
        padding-right: 5px;     /* 给滚动条留空间 */
        
        /* 自定义滚动条 */
        scrollbar-width: thin;
        scrollbar-color: #ccc #f1f1f1;
    }

    /* Webkit滚动条样式 */
    #xuxiesdpro::-webkit-scrollbar {
        width: 6px;
    }

    #xuxiesdpro::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }

    #xuxiesdpro::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

    #xuxiesdpro::-webkit-scrollbar-thumb:hover {
        background: #999;
    }

    /* 调整多选容器高度，避免占用太多空间 */
    #xuxiesdpro .multi-select-container {
        height: 100px;
    }

    /* 调整行间距 */
    #xuxiesdpro > div {
        margin-bottom: 12px;
    }
}





#xuxiesd_pro-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}
  

#xuxiesd_pro textarea {
    width: 100%;
    min-height: 100px;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    /* 确保文本区可以调整高度 */
    overflow: auto;
}


  
  /* 为弹窗内部直接子 div 添加垂直间距 */
  #xuxiesdpro > div {
    margin-bottom: 20px;
  }
  #xuxiesdpro > div:last-child {
    margin-bottom: 0;
  }

  /* 每一行使用弹性布局，垂直居中，允许换行 */
  #xuxiesdpro > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px; /* 换行后的间距 */
  }

  /* 文字标签右侧留空 */
  #xuxiesdpro span {
    margin-right: 12px;
    white-space: nowrap; /* 防止文字换行 */
  }

  /* 下拉框之间添加右间距 */
  #xuxiesdpro select {
    margin-right: 12px;
  }
  #xuxiesdpro select:last-child {
    margin-right: 0;
  }

  /* 按钮行特殊处理：靠右对齐 */
  #xuxiesdpro > div:last-child {
    justify-content: flex-end;
  }



.multi-select-row {
    margin: 12px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.multi-select-row > span {
    min-width: 50px;
    padding-top: 5px;
    font-weight: bold;
}

/* 关键修改：固定高度，内部布局改为纵向 */
.multi-select-container {
    flex: 1;
    height: 140px;              /* 固定高度，按需调整 */
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 8px;
    display: flex;
    flex-direction: column;     /* 纵向排列：标签区在上，下拉框在下 */
    gap: 4px;
    background: #fff;
    overflow: hidden;           /* 防止整体溢出 */
}

/* 关键修改：标签区域可滚动 */
.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;                    /* 占据剩余空间 */
    align-content: flex-start;  /* 标签从顶部开始排列 */
    overflow-y: auto;           /* 超出时滚动 */
    overflow-x: hidden;
    min-height: 0;              /* 关键：允许flex子项收缩 */
}

/* 自定义滚动条（可选） */
.selected-tags::-webkit-scrollbar {
    width: 10px;
}
.selected-tags::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.selected-tags::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}
.selected-tags::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.tag {
    display: inline-flex;
    align-items: center;
    background: #e8f4f8;
    border: 1px solid #b8d4e3;
    border-radius: 3px;
    padding: 4px 10px;
    font-size: 13px;
    color: #2c5aa0;
    white-space: nowrap;
    flex-shrink: 0;
}

.tag-remove {
    margin-left: 8px;
    cursor: pointer;
    color: #999;
    font-size: 16px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.tag-remove:hover {
    background: #ff6b6b;
    color: white;
}

.guanxi-tag {
    background: #fff3e0 !important;
    border-color: #ffcc80 !important;
    color: #e65100 !important;
}

/* 关键修改：下拉框固定在底部，高度自适应 */
.multi-select-dropdown {
    border: none;
    background: transparent;
    height: 30px;               /* 固定高度，不要100px */
    min-width: 80px;
    cursor: pointer;
    color: #666;
    flex-shrink: 0;             /* 防止被压缩 */
    align-self: flex-start;     /* 左对齐 */
}

.btn-primary {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary:hover {
    background: #357abd;
}